Fixes auto accept of options screen not applying options.

This commit is contained in:
Erik Abair 2022-07-13 14:46:59 -07:00
parent 337757a9fa
commit f106535eef
2 changed files with 13 additions and 4 deletions

View File

@ -261,7 +261,6 @@ MenuItemRoot::MenuItemRoot(const std::vector<std::shared_ptr<TestSuite>> &suites
#ifdef DISABLE_AUTORUN
submenu.push_back(std::make_shared<MenuItemCallable>(on_run_all, "! Run all and exit", width, height));
#endif // DISABLE_AUTORUN
start_time = std::chrono::high_resolution_clock::now();
}
void MenuItemRoot::ActivateCurrentSuite() {
@ -270,6 +269,11 @@ void MenuItemRoot::ActivateCurrentSuite() {
}
void MenuItemRoot::Draw() {
if (!timer_valid) {
start_time = std::chrono::high_resolution_clock::now();
timer_valid = true;
}
#ifndef DISABLE_AUTORUN
if (!timer_cancelled) {
auto now = std::chrono::high_resolution_clock::now();
@ -388,16 +392,19 @@ MenuItemOptions::MenuItemOptions(const std::vector<std::shared_ptr<TestSuite>> &
};
submenu.push_back(std::make_shared<MenuItemOption>("Previous crashes", values, on_apply));
}
start_time = std::chrono::high_resolution_clock::now();
}
void MenuItemOptions::Draw() {
if (!timer_valid) {
start_time = std::chrono::high_resolution_clock::now();
timer_valid = true;
}
if (!timer_cancelled) {
auto now = std::chrono::high_resolution_clock::now();
auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(now - start_time).count();
if (elapsed > kAutoTestAllTimeoutMilliseconds) {
on_exit();
cursor_position = 0;
Activate();
return;
}

View File

@ -112,6 +112,7 @@ struct MenuItemRoot : public MenuItem {
std::function<void()> on_run_all;
std::function<void()> on_exit;
std::chrono::steady_clock::time_point start_time;
bool timer_valid{false};
bool timer_cancelled{false};
};
@ -130,6 +131,7 @@ struct MenuItemOptions : public MenuItem {
std::function<void()> on_exit;
std::chrono::steady_clock::time_point start_time;
bool timer_valid{false};
bool timer_cancelled{false};
};