all demos added because exec() don't need main form to exit_all
This commit is contained in:
49
.travis.yml
49
.travis.yml
@@ -86,7 +86,7 @@ script:
|
|||||||
- ./animate-bmp
|
- ./animate-bmp
|
||||||
- ./audio_player
|
- ./audio_player
|
||||||
- ./background-effects
|
- ./background-effects
|
||||||
#- ./calculator ?
|
- ./calculator
|
||||||
- ./categ
|
- ./categ
|
||||||
- ./clicked
|
- ./clicked
|
||||||
- ./decore
|
- ./decore
|
||||||
@@ -94,18 +94,45 @@ script:
|
|||||||
- ./drag-button
|
- ./drag-button
|
||||||
- ./draw
|
- ./draw
|
||||||
- ./file_explorer
|
- ./file_explorer
|
||||||
#- ./example_menu
|
- ./example_menu
|
||||||
- ./example_listbox
|
- ./example_listbox
|
||||||
#- ./example_combox
|
- ./example_combox
|
||||||
- ./example.button
|
- ./example.button
|
||||||
|
- ./folder_tree_nana
|
||||||
|
- ./folder_tree_std
|
||||||
|
- ./framework_design_1
|
||||||
|
- ./framework_design_2
|
||||||
|
- ./framework_design_3
|
||||||
|
- ./group
|
||||||
- ./HelloWord
|
- ./HelloWord
|
||||||
#- ./MontiHall
|
- ./helloword_quit
|
||||||
#- ./helloworld_demo
|
- ./inputbox
|
||||||
#- ./notepad
|
- ./label_listener
|
||||||
#- ./loader_2
|
- ./lambda_event.cpp11
|
||||||
#- ./widget_show2
|
- ./listbox_inline_widget
|
||||||
#- ./widget_show
|
- ./listbox_Resolver
|
||||||
|
- ./loader_1
|
||||||
|
- ./loader_2
|
||||||
|
- ./mbox
|
||||||
|
- ./menu_debug
|
||||||
|
- ./MontiHall
|
||||||
|
- ./helloworld_demo
|
||||||
|
- ./notepad
|
||||||
|
- ./loader_2
|
||||||
|
- ./mbox
|
||||||
|
- ./menu_debug
|
||||||
|
- ./menu_popuper
|
||||||
|
- ./modal_form
|
||||||
|
- ./widget_show2
|
||||||
|
- ./widget_show
|
||||||
|
- ./place_login
|
||||||
|
- ./png
|
||||||
|
- ./screen
|
||||||
|
- ./stretch_image
|
||||||
|
- ./threading
|
||||||
|
- ./thread-pool
|
||||||
|
- ./various_events
|
||||||
|
- ./window-dragger
|
||||||
|
- ./windows-subclassing
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ option(NANA_CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the
|
|||||||
option(NANA_CMAKE_BUILD_DEMOS "Build all the demos form the nana_demo repository." OFF)
|
option(NANA_CMAKE_BUILD_DEMOS "Build all the demos form the nana_demo repository." OFF)
|
||||||
option(NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS "" ON)
|
option(NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS "" ON)
|
||||||
option(NANA_CMAKE_AUTOMATIC_GUI_TESTING "Activate automatic GUI testing?" OFF)
|
option(NANA_CMAKE_AUTOMATIC_GUI_TESTING "Activate automatic GUI testing?" OFF)
|
||||||
option(NANA_CMAKE_ADD_DEF_AUTOMATIC_GUI_TESTING "Add defoult automatic GUI test?" OFF)
|
|
||||||
option(NANA_CMAKE_BUILD_FreeMe "Build FreeMe (currently broken)?" OFF)
|
option(NANA_CMAKE_BUILD_FreeMe "Build FreeMe (currently broken)?" OFF)
|
||||||
|
|
||||||
|
|
||||||
@@ -177,10 +176,6 @@ if(NANA_CMAKE_ENABLE_AUDIO)
|
|||||||
endif(UNIX)
|
endif(UNIX)
|
||||||
endif(NANA_CMAKE_ENABLE_AUDIO)
|
endif(NANA_CMAKE_ENABLE_AUDIO)
|
||||||
|
|
||||||
if (NANA_CMAKE_BUILD_FreeMe)
|
|
||||||
add_definitions(-DBUILD_FreeMe)
|
|
||||||
endif (NANA_CMAKE_BUILD_FreeMe)
|
|
||||||
|
|
||||||
if(NANA_CMAKE_VERBOSE_PREPROCESSOR)
|
if(NANA_CMAKE_VERBOSE_PREPROCESSOR)
|
||||||
add_definitions(-DVERBOSE_PREPROCESSOR)
|
add_definitions(-DVERBOSE_PREPROCESSOR)
|
||||||
endif(NANA_CMAKE_VERBOSE_PREPROCESSOR)
|
endif(NANA_CMAKE_VERBOSE_PREPROCESSOR)
|
||||||
@@ -249,10 +244,6 @@ if (NANA_CMAKE_BUILD_DEMOS)
|
|||||||
enable_testing ()
|
enable_testing ()
|
||||||
endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING)
|
endif(NANA_CMAKE_AUTOMATIC_GUI_TESTING)
|
||||||
|
|
||||||
if(NANA_CMAKE_ADD_DEF_AUTOMATIC_GUI_TESTING)
|
|
||||||
add_definitions(-DNANA_ADD_DEF_AUTOMATIC_GUI_TESTING)
|
|
||||||
endif(NANA_CMAKE_ADD_DEF_AUTOMATIC_GUI_TESTING)
|
|
||||||
|
|
||||||
set (demos calculator file_explorer helloworld_demo notepad )
|
set (demos calculator file_explorer helloworld_demo notepad )
|
||||||
|
|
||||||
foreach ( demo ${demos})
|
foreach ( demo ${demos})
|
||||||
@@ -270,6 +261,10 @@ if (NANA_CMAKE_BUILD_DEMOS)
|
|||||||
|
|
||||||
set (demos widget_show widget_show2 )
|
set (demos widget_show widget_show2 )
|
||||||
|
|
||||||
|
if (NANA_CMAKE_BUILD_FreeMe)
|
||||||
|
add_definitions(-DBUILD_FreeMe)
|
||||||
|
endif (NANA_CMAKE_BUILD_FreeMe)
|
||||||
|
|
||||||
if (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS)
|
if (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS)
|
||||||
list(APPEND demos FreeMe) # ??
|
list(APPEND demos FreeMe) # ??
|
||||||
endif (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS)
|
endif (NANA_CMAKE_INCLUDE_EXPERIMENTAL_DEMOS)
|
||||||
|
|||||||
@@ -96,15 +96,11 @@
|
|||||||
|
|
||||||
///////////////////
|
///////////////////
|
||||||
// Support for NANA_AUTOMATIC_GUI_TESTING
|
// Support for NANA_AUTOMATIC_GUI_TESTING
|
||||||
// Will cause the program to self-test the GUI.
|
// Will cause the program to self-test the GUI. A default automatic GUI test
|
||||||
// If NANA_ADD_DEF_AUTOMATIC_GUI_TESTING is also defined a default automatic GUI test
|
|
||||||
// will be added to all programs which don't have yet one defined. This default test will simple
|
// will be added to all programs which don't have yet one defined. This default test will simple
|
||||||
// wait 10 sec. (time to construct, show and execute the GUI) and then exit normally.
|
// wait 10 sec. (time to construct, show and execute the GUI) and then exit normally.
|
||||||
//
|
//
|
||||||
//#define NANA_AUTOMATIC_GUI_TESTING
|
#define NANA_AUTOMATIC_GUI_TESTING
|
||||||
//#if defined(NANA_AUTOMATIC_GUI_TESTING)
|
|
||||||
//#define NANA_ADD_DEF_AUTOMATIC_GUI_TESTING
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -66,9 +66,8 @@ namespace nana
|
|||||||
/// from the underlying OS, interpreting and sending it with suitable arguments
|
/// from the underlying OS, interpreting and sending it with suitable arguments
|
||||||
/// to the nana widgets that registered a response in the corresponding event.
|
/// to the nana widgets that registered a response in the corresponding event.
|
||||||
/// It also accept arguments to be used in case of automatic GUI testing.
|
/// It also accept arguments to be used in case of automatic GUI testing.
|
||||||
/// Other Way the arguments are ignored. It seems that only works in simple
|
/// Other Way the arguments are ignored.
|
||||||
/// programs with only one active form ??
|
void exec(
|
||||||
void exec(form *main_form = nullptr, ///< used to close the program
|
|
||||||
unsigned wait = 1, ///< for the GUI to be constructed, in seconds
|
unsigned wait = 1, ///< for the GUI to be constructed, in seconds
|
||||||
unsigned wait_end = 1, ///< for the GUI to be destructed, in seconds
|
unsigned wait_end = 1, ///< for the GUI to be destructed, in seconds
|
||||||
std::function<void()> = {} ///< emit events to mimics user actions and may asert results
|
std::function<void()> = {} ///< emit events to mimics user actions and may asert results
|
||||||
|
|||||||
@@ -49,46 +49,39 @@ namespace nana
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void exec(form *main_form, //= nullptr, ///< used to close the program
|
void exec(
|
||||||
unsigned wait, // = 1, ///< for the GUI to be constructed, in seconds
|
unsigned wait, // = 1, ///< for the GUI to be constructed, in seconds
|
||||||
unsigned wait_end, // = 1, ///< for the GUI to be destructed, in seconds
|
unsigned wait_end, // = 1, ///< for the GUI to be destructed, in seconds
|
||||||
std::function<void()>f // = {} ///< emit events to mimics user actions and may asert results
|
std::function<void()>f // = {} ///< emit events to mimics user actions and may asert results
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef NANA_AUTOMATIC_GUI_TESTING
|
#ifdef NANA_AUTOMATIC_GUI_TESTING
|
||||||
//if (!wait)
|
|
||||||
// wait = 1;
|
|
||||||
//if (!main_form && !f)
|
|
||||||
// f = []() {API::exit_all(); };
|
|
||||||
|
|
||||||
std::cout << "Will wait " << wait << " sec...\n";
|
std::cout << "Will wait " << wait << " sec...\n";
|
||||||
std::thread t([wait, &f, wait_end, main_form]()
|
|
||||||
{ if (wait)
|
std::thread t([wait, &f, wait_end]()
|
||||||
{
|
{
|
||||||
Wait( wait );
|
Wait( wait );
|
||||||
std::cout << "running... \n" ;
|
std::cout << "running... \n" ;
|
||||||
if (f)
|
if (f)
|
||||||
{
|
{
|
||||||
f();
|
f();
|
||||||
std::cout << "\nCongratulations, this was not trivial !" << std::endl;
|
std::cout << "\nCongratulations, this was not trivial !" << std::endl;
|
||||||
}else
|
}else
|
||||||
{
|
{
|
||||||
std::cout << "\nJust a trivial test." << std::endl;
|
std::cout << "\nJust a trivial test." << std::endl;
|
||||||
}
|
}
|
||||||
std::cout << "Done... \n";
|
std::cout << "Done... \n";
|
||||||
std::cout << "Now again ";
|
std::cout << "Now again ";
|
||||||
Wait(wait_end);
|
Wait(wait_end);
|
||||||
std::cout << "Done... Now closing the main form...\n";
|
std::cout << "Done... Now API::exit all ...\n";
|
||||||
/*if (main_form)
|
API::exit_all();
|
||||||
main_form->close();*/
|
});
|
||||||
std::cout << "Closed... Now API::exit ...\n";
|
|
||||||
API::exit_all(); // why not works?
|
|
||||||
std::cout << "Done... Upps - this had not to appear !! \n";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
pump();
|
pump();
|
||||||
if (t.joinable())
|
if (t.joinable())
|
||||||
t.join();
|
t.join();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
pump();
|
pump();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user