From de5300d6df4bfb4abe35efadbd87315fe2588799 Mon Sep 17 00:00:00 2001 From: gaaclarke <30870216+gaaclarke@users.noreply.github.com> Date: Tue, 10 Oct 2023 09:10:12 -0700 Subject: [PATCH] [Impeller] made window size parametric in playground/golden tests (flutter/engine#46682) In https://github.com/flutter/flutter/issues/136058#issuecomment-1751507094 it was seen that some bugs manifest only with viewports of certain sizes. This allows writers of tests to adjust the window size for playgrounds and golden image tests. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style --- .../flutter/impeller/golden_tests/golden_playground_test.h | 3 +++ .../impeller/golden_tests/golden_playground_test_mac.cc | 4 ++++ .../impeller/golden_tests/golden_playground_test_stub.cc | 2 ++ engine/src/flutter/impeller/playground/playground.h | 4 ++-- 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/engine/src/flutter/impeller/golden_tests/golden_playground_test.h b/engine/src/flutter/impeller/golden_tests/golden_playground_test.h index 9754d943be..0124d86108 100644 --- a/engine/src/flutter/impeller/golden_tests/golden_playground_test.h +++ b/engine/src/flutter/impeller/golden_tests/golden_playground_test.h @@ -57,6 +57,9 @@ class GoldenPlaygroundTest ISize GetWindowSize() const; + protected: + void SetWindowSize(ISize size); + private: #if FML_OS_MACOSX // This must be placed first so that the autorelease pool is not destroyed diff --git a/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc b/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc index 1ffc25388b..686b195698 100644 --- a/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc +++ b/engine/src/flutter/impeller/golden_tests/golden_playground_test_mac.cc @@ -194,4 +194,8 @@ ISize GoldenPlaygroundTest::GetWindowSize() const { return pimpl_->window_size; } +void GoldenPlaygroundTest::GoldenPlaygroundTest::SetWindowSize(ISize size) { + pimpl_->window_size = size; +} + } // namespace impeller diff --git a/engine/src/flutter/impeller/golden_tests/golden_playground_test_stub.cc b/engine/src/flutter/impeller/golden_tests/golden_playground_test_stub.cc index fe7a931c11..7827d9c5e1 100644 --- a/engine/src/flutter/impeller/golden_tests/golden_playground_test_stub.cc +++ b/engine/src/flutter/impeller/golden_tests/golden_playground_test_stub.cc @@ -64,4 +64,6 @@ ISize GoldenPlaygroundTest::GetWindowSize() const { return ISize(); } +void GoldenPlaygroundTest::SetWindowSize(ISize size) {} + } // namespace impeller diff --git a/engine/src/flutter/impeller/playground/playground.h b/engine/src/flutter/impeller/playground/playground.h index 039777a590..27b483f6d2 100644 --- a/engine/src/flutter/impeller/playground/playground.h +++ b/engine/src/flutter/impeller/playground/playground.h @@ -92,6 +92,8 @@ class Playground { virtual bool ShouldKeepRendering() const; + void SetWindowSize(ISize size); + private: struct GLFWInitializer; @@ -105,8 +107,6 @@ class Playground { void SetCursorPosition(Point pos); - void SetWindowSize(ISize size); - FML_DISALLOW_COPY_AND_ASSIGN(Playground); };