// Explicit Windows integration test. Opens an isolated Far profile and never // types into an existing Far window. Requires Far Manager at its default path. #include "app.h" #include #include #include #include namespace ks { struct InputRegressionAccess { static void runQueued(App &app) { std::function job; { std::lock_guard lock(app.jobsMutex); if (app.jobs.empty()) throw std::runtime_error("snippet did not queue"); job=std::move(app.jobs.front());app.jobs.pop_front(); } auto future=std::async(std::launch::async,[job=std::move(job)] { CoInitializeEx(nullptr,COINIT_APARTMENTTHREADED);job();CoUninitialize(); }); while(future.wait_for(std::chrono::milliseconds(5))!=std::future_status::ready) { MSG message{};while(PeekMessageW(&message,nullptr,0,0,PM_REMOVE)) { TranslateMessage(&message);DispatchMessageW(&message); } } future.get();app.replayTyping(); } }; } int WINAPI wWinMain(HINSTANCE instance,HINSTANCE,PWSTR,int) { auto base=std::filesystem::path(ks::executable()).parent_path(); std::ofstream log(base/L"far-snippets.log"); int checks=0; auto require=[&](bool ok,const char *message) { if(!ok)throw std::runtime_error(message); ++checks;log<<"PASS "<