summaryrefslogtreecommitdiff
path: root/NxWidgets/UnitTests/nxwm
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-01 20:36:19 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-01 20:36:19 +0000
commitfd4dd86fe8de2ddda1e8723973e8b5774528ebb7 (patch)
tree076f03852cb6bcd7a34d313558f7529143337e6d /NxWidgets/UnitTests/nxwm
parent990276740afafeb69f64b01050a99f113bb89fa6 (diff)
downloadnuttx-fd4dd86fe8de2ddda1e8723973e8b5774528ebb7.tar.gz
nuttx-fd4dd86fe8de2ddda1e8723973e8b5774528ebb7.tar.bz2
nuttx-fd4dd86fe8de2ddda1e8723973e8b5774528ebb7.zip
More NxWM support
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4682 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'NxWidgets/UnitTests/nxwm')
-rw-r--r--NxWidgets/UnitTests/nxwm/Makefile40
-rw-r--r--NxWidgets/UnitTests/nxwm/main.cxx22
2 files changed, 49 insertions, 13 deletions
diff --git a/NxWidgets/UnitTests/nxwm/Makefile b/NxWidgets/UnitTests/nxwm/Makefile
index d9cf2d051..9648ad807 100644
--- a/NxWidgets/UnitTests/nxwm/Makefile
+++ b/NxWidgets/UnitTests/nxwm/Makefile
@@ -54,12 +54,26 @@ else
CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWIDGETS_INC)"}
endif
+# Add the path to the NxWM include directory to the CFLAGS
+
+NXWM_DIR="$(TESTDIR)/../../nxwm"
+NXWM_INC="$(NXWM_DIR)/include"
+NXWM_LIB="$(NXWM_DIR)/libnxwm$(LIBEXT)"
+
+ifeq ($(WINTOOL),y)
+ CFLAGS += ${shell $(INCDIR) -w "$(CC)" "$(NXWM_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) -w "$(CXX)" "$(NXWM_INC)"}
+else
+ CFLAGS += ${shell $(INCDIR) "$(CC)" "$(NXWM_INC)"}
+ CXXFLAGS += ${shell $(INCDIR) "$(CXX)" "$(NXWM_INC)"}
+endif
+
# Get the path to the archiver tool
TESTTOOL_DIR="$(TESTDIR)/../../tools"
ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
-# Hello, World! C++ Example
+# NxWM unit test
ASRCS =
CSRCS =
@@ -92,7 +106,7 @@ STACKSIZE = 2048
VPATH =
all: .built
-.PHONY: clean depend context disclean chkcxx chklib
+.PHONY: clean depend context disclean chkcxx chklibnxwidgets chklibnxwm
# Object file creation targets
@@ -121,7 +135,7 @@ endif
# Verify that the NXWidget library has been built
-chklib:
+chklibnxwidgets:
@( \
if [ ! -e "$(NXWIDGETS_LIB)" ]; then \
echo "$(NXWIDGETS_LIB) does not exist."; \
@@ -131,18 +145,34 @@ chklib:
fi; \
)
+# Verify that the NxWM library has been built
+
+chklibnxwm:
+ @( \
+ if [ ! -e "$(NXWM_LIB)" ]; then \
+ echo "$(NXWM_LIB) does not exist."; \
+ echo "Please go to $(NXWM_LIB)"; \
+ echo "and rebuild the library"; \
+ exit 1; \
+ fi; \
+ )
+
# Library creation targets
-$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
+$(NXWIDGETS_LIB): # Just to keep make happy. chklibnxwidgets does the work.
+
+$(NXWM_LIB): # Just to keep make happy. chklibnxwm does the work.
-.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
+.built: chkcxx chklibnxwidgets chklibnxwm $(OBJS) $(NXWIDGETS_LIB)
@( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
ifeq ($(WINTOOL),y)
@$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+ @$(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWM_DIR)
else
@$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
+ @$(ARCHIVER) -p "$(CROSSDEV)" $(BIN) $(NXWM_DIR)
endif
@touch .built
diff --git a/NxWidgets/UnitTests/nxwm/main.cxx b/NxWidgets/UnitTests/nxwm/main.cxx
index b0792c1f4..d93d9b391 100644
--- a/NxWidgets/UnitTests/nxwm/main.cxx
+++ b/NxWidgets/UnitTests/nxwm/main.cxx
@@ -40,8 +40,12 @@
#include <nuttx/config.h>
#include <nuttx/arch.h>
+#include <cstdio>
+#include <cstdlib>
+
#include "ctaskbar.hxx"
#include "cstartwindow.hxx"
+#include "cnxconsole.hxx"
/////////////////////////////////////////////////////////////////////////////
// Pre-processor Definitions
@@ -61,7 +65,7 @@
// Private Types
/////////////////////////////////////////////////////////////////////////////
-struct nxwm_test_s
+struct SNxWmTest
{
NxWM::CTaskbar *taskbar; // The task bar
NxWM::CStartWindow *startwindow; // The start window
@@ -71,7 +75,7 @@ struct nxwm_test_s
// Private Data
/////////////////////////////////////////////////////////////////////////////
-static struct nxwm_test_s g_nxwmtest;
+static struct SNxWmTest g_nxwmtest;
/////////////////////////////////////////////////////////////////////////////
// Public Function Prototypes
@@ -109,7 +113,7 @@ int MAIN_NAME(int argc, char *argv[])
// 4. Call CTaskBar::startWindowManager to start the display with applications in place
printf(MAIN_STRING "Create CTaskbar instance\n");
- g_nxwmtest.taskbar = new CTaskbar();
+ g_nxwmtest.taskbar = new NxWM::CTaskbar();
if (!g_nxwmtest.taskbar)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CTaskbar\n");
@@ -150,7 +154,7 @@ int MAIN_NAME(int argc, char *argv[])
// window application.
printf(MAIN_STRING "Opening the start window application window\n");
- CApplicationWindow *window = g_nxwmtest.taskbar->openApplicationWindow();
+ NxWM::CApplicationWindow *window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
{
printf(MAIN_STRING "ERROR: Failed to create CApplicationWindow for the start window\n");
@@ -170,7 +174,8 @@ int MAIN_NAME(int argc, char *argv[])
// Add the NxConsole application to the start window
-#if 0
+ NxWM::CNxConsole *console = (NxWM::CNxConsole *)0; // Avoid compiler complaint
+
printf(MAIN_STRING "Opening the NxConsole application window\n");
window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
@@ -180,7 +185,7 @@ int MAIN_NAME(int argc, char *argv[])
}
printf(MAIN_STRING "Creating the NxConsole application\n");
- NxWM::CNxConsole *console = new CNxConsole(window);
+ console = new NxWM::CNxConsole(g_nxwmtest.taskbar, window);
if (!console)
{
printf(MAIN_STRING "ERROR: Failed to instantiate CNxConsole\n");
@@ -196,11 +201,12 @@ int MAIN_NAME(int argc, char *argv[])
}
noconsole:
-#endif
// Add the calculator application to the start window
#if 0
+ NxWM::CCalculator *calculator = (NxWM::CCalculator *)0; // Avoid compiler complaint
+
printf(MAIN_STRING "Opening the calculator application window\n");
window = g_nxwmtest.taskbar->openApplicationWindow();
if (!window)
@@ -210,7 +216,7 @@ noconsole:
}
printf(MAIN_STRING "Creating the calculator application\n");
- NxWM::CCalculator *calculator = new CCalculator(window);
+ calculator = new NxWM::CCalculator(g_nxwmtest.taskbar, window);
if (!calculator)
{
printf(MAIN_STRING "ERROR: Failed to instantiate calculator\n");