explore automatic GUI testing in VS2015, cmake and travis
local works vary good in windows with VS2015
This commit is contained in:
@@ -13,6 +13,22 @@
|
||||
|
||||
#include <nana/gui/wvl.hpp>
|
||||
#include <nana/gui/detail/bedrock.hpp>
|
||||
#include <thread>
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
//#define NANA_AUTOMATIC_GUI_TESTING
|
||||
|
||||
inline unsigned Wait(unsigned wait = 0)
|
||||
{
|
||||
#ifdef NANA_AUTOMATIC_GUI_TESTING
|
||||
return wait;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
namespace nana
|
||||
{
|
||||
namespace detail
|
||||
@@ -23,8 +39,33 @@ namespace nana
|
||||
}
|
||||
}
|
||||
|
||||
void exec()
|
||||
void exec(unsigned wait, std::function<void()> f )
|
||||
{
|
||||
#ifdef NANA_ADD_DEF_AUTOMATIC_GUI_TESTING
|
||||
if (!wait)
|
||||
wait = 10;
|
||||
if (!f)
|
||||
f = []() {API::exit(); };
|
||||
#endif
|
||||
|
||||
wait = Wait(wait);
|
||||
|
||||
std::cout << "Will wait " << wait << " sec...\n";
|
||||
std::thread t([wait, &f]()
|
||||
{ if (wait)
|
||||
{
|
||||
std::cout << "Waiting " << wait << " sec...\n";
|
||||
std::this_thread::sleep_for(std::chrono::seconds{ wait } );
|
||||
std::cout << "Waited !! running... \n" ;
|
||||
f();
|
||||
//API::exit();
|
||||
std::cout << "Runed... \n";
|
||||
}
|
||||
});
|
||||
|
||||
detail::bedrock::instance().pump_event(nullptr, false);
|
||||
|
||||
if (t.joinable())
|
||||
t.join();
|
||||
}
|
||||
}//end namespace nana
|
||||
|
||||
Reference in New Issue
Block a user