diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-01 20:36:19 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-05-01 20:36:19 +0000 |
commit | fd4dd86fe8de2ddda1e8723973e8b5774528ebb7 (patch) | |
tree | 076f03852cb6bcd7a34d313558f7529143337e6d /NxWidgets/UnitTests | |
parent | 990276740afafeb69f64b01050a99f113bb89fa6 (diff) | |
download | px4-nuttx-fd4dd86fe8de2ddda1e8723973e8b5774528ebb7.tar.gz px4-nuttx-fd4dd86fe8de2ddda1e8723973e8b5774528ebb7.tar.bz2 px4-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')
-rw-r--r-- | NxWidgets/UnitTests/README.txt | 28 | ||||
-rw-r--r-- | NxWidgets/UnitTests/nxwm/Makefile | 40 | ||||
-rw-r--r-- | NxWidgets/UnitTests/nxwm/main.cxx | 22 |
3 files changed, 73 insertions, 17 deletions
diff --git a/NxWidgets/UnitTests/README.txt b/NxWidgets/UnitTests/README.txt index 8534efb9d..b19ed4462 100644 --- a/NxWidgets/UnitTests/README.txt +++ b/NxWidgets/UnitTests/README.txt @@ -35,6 +35,9 @@ Installing and Building the Unit Tests for the STM3210E-EVAL available. However, the unit test can be run on other configurations (see steps d and e below). + NOTE: The special configuratin sim/nxwm is recommended for unit-leveling + testing of NxWM because the configuration is more complex in that case. + We will assume the sim/nsh2 configuration in this discussion. The sim/nsh2 configuration is installed as follows: @@ -48,7 +51,7 @@ Installing and Building the Unit Tests <nuttx-directory-path> is the full, absolute path to the NuttX build directory If you are using the sim/nsh2 or stm3210e-eval configurations, then skip - to step 2. + to step 2 (Hmmm.. better check 1d) too). There may be certain requirements for the configuration that you select... for example, certain widget tests may require touchscreen support or special @@ -77,7 +80,12 @@ Installing and Building the Unit Tests Then you can run the simulation using GDB or DDD which is a very powerful debugging environment! - d) Other nuttx/.config changes -- NSH configurations only. + d) Special configuration requirements for the nxwm unit test: + + CONFIG_NXCONSOLE=y + CONFIG_NX_MULTIUSER=y + + e) Other nuttx/.config changes -- NSH configurations only. If the configuration that you are using supports NSH and NSH built-in tasks then all is well. If it is an NSH configuration, then you will have to define @@ -89,7 +97,7 @@ Installing and Building the Unit Tests to change anything further in the nuttx/.config file if you are using either of these configurations. - e) Other apps/.config changes -- NON-NSH configurations only. + f) Other apps/.config changes -- NON-NSH configurations only. For non-NSH configurations (such as the sim/touchscreen) you will have to remove the CONFIGURED_APPS seting that contains the user_start function so @@ -147,7 +155,15 @@ Installing and Building the Unit Tests cd <nxwidgets-directory>/libnxwidgets make TOPDIR=<nuttx-directory-path> -6. Build NuttX including the unit test and the NXWidgets library +6. Build the NxWM library. + + The NxWM library (libnxwm.a) is required only for the NxWM unit test at + NxWidgets/UnitTests/nxwm. For other unit tests, skip to step 7. + + cd <nxwidgets-directory>/nxwm + make TOPDIR=<nuttx-directory-path> + +7. Build NuttX including the unit test and the NXWidgets library cd <nuttx-directory-path> . ./setenv.sh @@ -268,6 +284,10 @@ CTextBox Exercises the CTextBox widget Depends on CLabel +nxwm + Exercises the NxWM window manager. + Use the special configuration nuttx/configs/sim/nxwm + Example ======= 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"); |