Skip to content

Commit

Permalink
added msaa test
Browse files Browse the repository at this point in the history
  • Loading branch information
gaaclarke committed Apr 6, 2023
1 parent 2ae7d69 commit cf3333e
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions shell/platform/android/android_surface_gl_impeller_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,41 @@ class MockDisplay : public impeller::egl::Display {
};
} // namespace

TEST(AndroidSurfaceGLImpeller, MSAAFirstAttempt) {
auto context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto jni = std::make_shared<JNIMock>();
auto display = std::make_unique<MockDisplay>();
EXPECT_CALL(*display, IsValid).WillRepeatedly(Return(true));
auto first_result = std::make_unique<impeller::egl::Config>(
impeller::egl::ConfigDescriptor(), EGLConfig());
auto second_result = std::make_unique<impeller::egl::Config>(
impeller::egl::ConfigDescriptor(), EGLConfig());
EXPECT_CALL(*display,
ChooseConfig(Matcher<impeller::egl::ConfigDescriptor>(
AllOf(Field(&impeller::egl::ConfigDescriptor::samples,
impeller::egl::Samples::kFour),
Field(&impeller::egl::ConfigDescriptor::surface_type,
impeller::egl::SurfaceType::kWindow)))))
.WillOnce(Return(ByMove(std::move(first_result))));
EXPECT_CALL(*display,
ChooseConfig(Matcher<impeller::egl::ConfigDescriptor>(
Field(&impeller::egl::ConfigDescriptor::surface_type,
impeller::egl::SurfaceType::kPBuffer))))
.WillOnce(Return(ByMove(std::move(second_result))));
ON_CALL(*display, ChooseConfig(_))
.WillByDefault(Return(ByMove(std::unique_ptr<impeller::egl::Config>())));
auto surface = std::make_unique<AndroidSurfaceGLImpeller>(context, jni,
std::move(display));
ASSERT_TRUE(surface);
}

TEST(AndroidSurfaceGLImpeller, FallbackForEmulator) {
auto context =
std::make_shared<AndroidContext>(AndroidRenderingAPI::kSoftware);
auto jni = std::make_shared<JNIMock>();
auto display = std::make_unique<MockDisplay>();
EXPECT_CALL(*display, IsFallbackForEmulatorValid)
.WillRepeatedly(Return(true));
EXPECT_CALL(*display, IsValid).WillRepeatedly(Return(true));
std::unique_ptr<impeller::egl::Config> first_result;
auto second_result = std::make_unique<impeller::egl::Config>(
impeller::egl::ConfigDescriptor(), EGLConfig());
Expand Down

0 comments on commit cf3333e

Please sign in to comment.