mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 06:53:34 +08:00
Update all unit tests to conform to recent naming convention changes in NuttX
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5151 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
@@ -63,7 +63,7 @@ ARCHIVER=$(TESTTOOL_DIR)/addobjs.sh
|
||||
|
||||
ASRCS =
|
||||
CSRCS =
|
||||
CXXSRCS = main.cxx cbuttontest.cxx
|
||||
CXXSRCS = cbutton_main.cxx cbuttontest.cxx
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
+14
-14
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// NxWidgets/UnitTests/CButton/main.cxx
|
||||
// NxWidgets/UnitTests/CButton/cbutton_main.cxx
|
||||
//
|
||||
// Copyright (C) 2012 Gregory Nutt. All rights reserved.
|
||||
// Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
@@ -68,7 +68,7 @@ static const char g_pushme[] = "Push Me";
|
||||
|
||||
// Suppress name-mangling
|
||||
|
||||
extern "C" int MAIN_NAME(int argc, char *argv[]);
|
||||
extern "C" int cbutton_main(int argc, char *argv[]);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public Functions
|
||||
@@ -78,29 +78,29 @@ extern "C" int MAIN_NAME(int argc, char *argv[]);
|
||||
// user_start/nxheaders_main
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int MAIN_NAME(int argc, char *argv[])
|
||||
int cbutton_main(int argc, char *argv[])
|
||||
{
|
||||
// Create an instance of the font test
|
||||
|
||||
printf(MAIN_STRING "Create CButtonTest instance\n");
|
||||
printf("cbutton_main: Create CButtonTest instance\n");
|
||||
CButtonTest *test = new CButtonTest();
|
||||
|
||||
// Connect the NX server
|
||||
|
||||
printf(MAIN_STRING "Connect the CButtonTest instance to the NX server\n");
|
||||
printf("cbutton_main: Connect the CButtonTest instance to the NX server\n");
|
||||
if (!test->connect())
|
||||
{
|
||||
printf(MAIN_STRING "Failed to connect the CButtonTest instance to the NX server\n");
|
||||
printf("cbutton_main: Failed to connect the CButtonTest instance to the NX server\n");
|
||||
delete test;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create a window to draw into
|
||||
|
||||
printf(MAIN_STRING "Create a Window\n");
|
||||
printf("cbutton_main: Create a Window\n");
|
||||
if (!test->createWindow())
|
||||
{
|
||||
printf(MAIN_STRING "Failed to create a window\n");
|
||||
printf("cbutton_main: Failed to create a window\n");
|
||||
delete test;
|
||||
return 1;
|
||||
}
|
||||
@@ -110,26 +110,26 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
CButton *button = test->createButton(g_pushme);
|
||||
if (!button)
|
||||
{
|
||||
printf(MAIN_STRING "Failed to create a button\n");
|
||||
printf("cbutton_main: Failed to create a button\n");
|
||||
delete test;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Show the button
|
||||
|
||||
printf(MAIN_STRING "Show the button\n");
|
||||
printf("cbutton_main: Show the button\n");
|
||||
test->showButton(button);
|
||||
|
||||
// Wait two seconds, then perform a simulated mouse click on the button
|
||||
|
||||
sleep(2);
|
||||
printf(MAIN_STRING "Click the button\n");
|
||||
printf("cbutton_main: Click the button\n");
|
||||
test->click();
|
||||
|
||||
// Poll for the mouse click event (of course this can hang if something fails)
|
||||
|
||||
bool clicked = test->poll(button);
|
||||
printf(MAIN_STRING "Button is %s\n", clicked ? "clicked" : "released");
|
||||
printf("cbutton_main: Button is %s\n", clicked ? "clicked" : "released");
|
||||
|
||||
// Wait a second, then release the mouse buttone
|
||||
|
||||
@@ -139,7 +139,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
// Poll for the mouse release event (of course this can hang if something fails)
|
||||
|
||||
clicked = test->poll(button);
|
||||
printf(MAIN_STRING "Button is %s\n", clicked ? "clicked" : "released");
|
||||
printf("cbutton_main: Button is %s\n", clicked ? "clicked" : "released");
|
||||
|
||||
// Wait a few more seconds so that the tester can ponder the result
|
||||
|
||||
@@ -147,7 +147,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
|
||||
// Clean up and exit
|
||||
|
||||
printf(MAIN_STRING "Clean-up and exit\n");
|
||||
printf("cbutton_main: Clean-up and exit\n");
|
||||
delete button;
|
||||
delete test;
|
||||
return 0;
|
||||
@@ -75,16 +75,6 @@
|
||||
# define CONFIG_CBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
||||
#endif
|
||||
|
||||
// What is the entry point called?
|
||||
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
# define MAIN_NAME cbutton_main
|
||||
# define MAIN_STRING "cbutton_main: "
|
||||
#else
|
||||
# define MAIN_NAME user_start
|
||||
# define MAIN_STRING "user_start: "
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public Classes
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user