From 237d7e4c1c99762ee856d360eb64c3aab453c4bf Mon Sep 17 00:00:00 2001 From: patacongo Date: Tue, 22 May 2012 19:29:22 +0000 Subject: Add a hex calculator example to NxWM git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4760 42af7a65-404d-4744-a932-0658087f49c3 --- NxWidgets/UnitTests/nxwm/main.cxx | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'NxWidgets/UnitTests') diff --git a/NxWidgets/UnitTests/nxwm/main.cxx b/NxWidgets/UnitTests/nxwm/main.cxx index 3cc85dc43..f61252904 100644 --- a/NxWidgets/UnitTests/nxwm/main.cxx +++ b/NxWidgets/UnitTests/nxwm/main.cxx @@ -47,6 +47,7 @@ #include "ctaskbar.hxx" #include "cstartwindow.hxx" #include "cnxconsole.hxx" +#include "chexcalculator.hxx" #ifdef CONFIG_NXWM_TOUCHSCREEN # include "ctouchscreen.hxx" @@ -540,6 +541,35 @@ static bool createNxConsole(void) return true; } +///////////////////////////////////////////////////////////////////////////// +// Name: createHexCalculator +///////////////////////////////////////////////////////////////////////////// + +static bool createHexCalculator(void) +{ + // Add the hex calculator application to the start window + + printf("createHexCalculator: Creating the hex calculator application\n"); + NxWM::CHexCalculatorFactory *calculator = new NxWM::CHexCalculatorFactory(g_nxwmtest.taskbar); + if (!calculator) + { + printf("createHexCalculator: ERROR: Failed to instantiate CHexCalculatorFactory\n"); + return false; + } + showTestCaseMemory("createHexCalculator: After creating the hex calculator application"); + + printf("createHexCalculator: Adding the hex calculator application to the start window\n"); + if (!g_nxwmtest.startwindow->addApplication(calculator)) + { + printf("createHexCalculator: ERROR: Failed to add CNxConsoleFactory to the start window\n"); + delete calculator; + return false; + } + + showTestCaseMemory("createHexCalculator: After adding the hex calculator application"); + return true; +} + ///////////////////////////////////////////////////////////////////////////// // Public Functions ///////////////////////////////////////////////////////////////////////////// @@ -645,6 +675,14 @@ int MAIN_NAME(int argc, char *argv[]) testCleanUpAndExit(EXIT_FAILURE); } + // Create the hex calculator application and add it to the start window + + if (!createHexCalculator()) + { + printf(MAIN_STRING "ERROR: Failed to create the hex calculator application\n"); + testCleanUpAndExit(EXIT_FAILURE); + } + // Call CTaskBar::startWindowManager to start the display with applications in place. if (!startWindowManager()) -- cgit v1.2.3