[Impeller] Skip all playground tests if SHIFT, SUPER, or CTRL is held. (flutter/engine#35446)

This commit is contained in:
Chinmay Garde 2022-08-16 19:46:04 -07:00 committed by GitHub
parent eb9bac63b9
commit c8dd6748aa
3 changed files with 16 additions and 0 deletions

View File

@ -126,12 +126,21 @@ void Playground::TeardownWindow() {
impl_.reset();
}
static std::atomic_bool gShouldOpenNewPlaygrounds = true;
bool Playground::ShouldOpenNewPlaygrounds() {
return gShouldOpenNewPlaygrounds;
}
static void PlaygroundKeyCallback(GLFWwindow* window,
int key,
int scancode,
int action,
int mods) {
if ((key == GLFW_KEY_ESCAPE || key == GLFW_KEY_Q) && action == GLFW_RELEASE) {
if (mods & (GLFW_MOD_CONTROL | GLFW_MOD_SUPER | GLFW_MOD_SHIFT)) {
gShouldOpenNewPlaygrounds = false;
}
::glfwSetWindowShouldClose(window, GLFW_TRUE);
}
}

View File

@ -34,6 +34,8 @@ class Playground {
static constexpr bool is_enabled() { return is_enabled_; }
static bool ShouldOpenNewPlaygrounds();
void SetupWindow(PlaygroundBackend backend);
void TeardownWindow();

View File

@ -16,6 +16,11 @@ void PlaygroundTest::SetUp() {
return;
}
if (!Playground::ShouldOpenNewPlaygrounds()) {
GTEST_SKIP_("Skipping due to user action.");
return;
}
SetupWindow(GetParam());
}