mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-25 08:13:33 +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 clatchbuttontest.cxx
|
||||
CXXSRCS = clatchbutton_main.cxx clatchbuttontest.cxx
|
||||
|
||||
AOBJS = $(ASRCS:.S=$(OBJEXT))
|
||||
COBJS = $(CSRCS:.c=$(OBJEXT))
|
||||
|
||||
+15
-15
@@ -1,5 +1,5 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// NxWidgets/UnitTests/CLatchButton/main.cxx
|
||||
// NxWidgets/UnitTests/CLatchButton/clatchbutton_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 clatchbutton_main(int argc, char *argv[]);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Private Functions
|
||||
@@ -83,13 +83,13 @@ static void showButtonState(CLatchButton *button, bool &clicked, bool &latched)
|
||||
bool nowClicked = button->isClicked();
|
||||
bool nowLatched = button->isLatched();
|
||||
|
||||
printf(MAIN_STRING "Button state: %s and %s\n",
|
||||
printf("showButtonState: Button state: %s and %s\n",
|
||||
nowClicked ? "clicked" : "released",
|
||||
nowLatched ? "latched" : "unlatched");
|
||||
|
||||
if (clicked != nowClicked || latched != nowLatched)
|
||||
{
|
||||
printf(MAIN_STRING "ERROR: Expected %s and %s\n",
|
||||
printf("showButtonState: ERROR: Expected %s and %s\n",
|
||||
clicked ? "clicked" : "released",
|
||||
latched ? "latched" : "unlatched");
|
||||
|
||||
@@ -106,29 +106,29 @@ static void showButtonState(CLatchButton *button, bool &clicked, bool &latched)
|
||||
// user_start/nxheaders_main
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int MAIN_NAME(int argc, char *argv[])
|
||||
int clatchbutton_main(int argc, char *argv[])
|
||||
{
|
||||
// Create an instance of the font test
|
||||
|
||||
printf(MAIN_STRING "Create CLatchButtonTest instance\n");
|
||||
printf("clatchbutton_main: Create CLatchButtonTest instance\n");
|
||||
CLatchButtonTest *test = new CLatchButtonTest();
|
||||
|
||||
// Connect the NX server
|
||||
|
||||
printf(MAIN_STRING "Connect the CLatchButtonTest instance to the NX server\n");
|
||||
printf("clatchbutton_main: Connect the CLatchButtonTest instance to the NX server\n");
|
||||
if (!test->connect())
|
||||
{
|
||||
printf(MAIN_STRING "Failed to connect the CLatchButtonTest instance to the NX server\n");
|
||||
printf("clatchbutton_main: Failed to connect the CLatchButtonTest instance to the NX server\n");
|
||||
delete test;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Create a window to draw into
|
||||
|
||||
printf(MAIN_STRING "Create a Window\n");
|
||||
printf("clatchbutton_main: Create a Window\n");
|
||||
if (!test->createWindow())
|
||||
{
|
||||
printf(MAIN_STRING "Failed to create a window\n");
|
||||
printf("clatchbutton_main: Failed to create a window\n");
|
||||
delete test;
|
||||
return 1;
|
||||
}
|
||||
@@ -138,14 +138,14 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
CLatchButton *button = test->createButton(g_pushme);
|
||||
if (!button)
|
||||
{
|
||||
printf(MAIN_STRING "Failed to create a button\n");
|
||||
printf("clatchbutton_main: Failed to create a button\n");
|
||||
delete test;
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Show the button
|
||||
|
||||
printf(MAIN_STRING "Show the button\n");
|
||||
printf("clatchbutton_main: Show the button\n");
|
||||
test->showButton(button);
|
||||
|
||||
bool clicked = false;
|
||||
@@ -159,7 +159,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
// Wait two seconds, then perform a simulated mouse click on the button
|
||||
|
||||
sleep(2);
|
||||
printf(MAIN_STRING "Click the button\n");
|
||||
printf("clatchbutton_main: Click the button\n");
|
||||
test->click();
|
||||
test->poll(button);
|
||||
|
||||
@@ -173,7 +173,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
// And release the button after 0.5 seconds
|
||||
|
||||
usleep(500 * 1000);
|
||||
printf(MAIN_STRING "Release the button\n");
|
||||
printf("clatchbutton_main: Release the button\n");
|
||||
test->release();
|
||||
test->poll(button);
|
||||
|
||||
@@ -191,7 +191,7 @@ int MAIN_NAME(int argc, char *argv[])
|
||||
|
||||
// Clean up and exit
|
||||
|
||||
printf(MAIN_STRING "Clean-up and exit\n");
|
||||
printf("clatchbutton_main: Clean-up and exit\n");
|
||||
delete button;
|
||||
delete test;
|
||||
return 0;
|
||||
@@ -75,16 +75,6 @@
|
||||
# define CONFIG_CLATCHBUTTONTEST_FONTCOLOR CONFIG_NXWIDGETS_DEFAULT_FONTCOLOR
|
||||
#endif
|
||||
|
||||
// What is the entry point called?
|
||||
|
||||
#ifdef CONFIG_NSH_BUILTIN_APPS
|
||||
# define MAIN_NAME clatchbutton_main
|
||||
# define MAIN_STRING "clatchbutton_main: "
|
||||
#else
|
||||
# define MAIN_NAME user_start
|
||||
# define MAIN_STRING "user_start: "
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Public Classes
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user