explore automatic GUI testing in VS2015, cmake and travis

local works vary good in windows with VS2015
This commit is contained in:
qPCR4vir
2016-03-01 18:59:57 +01:00
parent cbe6399008
commit 976b5ec275
4 changed files with 64 additions and 5 deletions

View File

@@ -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