From b667d595e4dd349d30c8c232d34f44af5d9802a8 Mon Sep 17 00:00:00 2001 From: jonahwilliams Date: Sat, 7 Dec 2024 13:26:13 -0800 Subject: [PATCH] update testing. --- impeller/entity/save_layer_utils_unittests.cc | 71 ++----------------- 1 file changed, 6 insertions(+), 65 deletions(-) diff --git a/impeller/entity/save_layer_utils_unittests.cc b/impeller/entity/save_layer_utils_unittests.cc index d86c8209ab6e3..cb398857bcc7c 100644 --- a/impeller/entity/save_layer_utils_unittests.cc +++ b/impeller/entity/save_layer_utils_unittests.cc @@ -280,77 +280,18 @@ TEST(SaveLayerUtilsTest, EXPECT_EQ(coverage.value(), Rect::MakeLTRB(0, 0, 50, 50)); } -TEST(SaveLayerUtilsTest, - PartiallyIntersectingCoverageIgnoresOriginWithSlideSemanticsX) { +TEST(SaveLayerUtilsTest, RoundUpCoverageWhenCloseToCoverageLimit) { // X varies, translation is performed on coverage. auto coverage = ComputeSaveLayerCoverage( - /*content_coverage=*/Rect::MakeLTRB(5, 0, 210, 210), // - /*effect_transform=*/{}, // - /*coverage_limit=*/Rect::MakeLTRB(0, 0, 100, 100), // - /*image_filter=*/nullptr // - ); - - ASSERT_TRUE(coverage.has_value()); - // Size that matches coverage limit - EXPECT_EQ(coverage.value(), Rect::MakeLTRB(5, 0, 105, 100)); -} - -TEST(SaveLayerUtilsTest, - PartiallyIntersectingCoverageIgnoresOriginWithSlideSemanticsY) { - // Y varies, translation is performed on coverage. - auto coverage = ComputeSaveLayerCoverage( - /*content_coverage=*/Rect::MakeLTRB(0, 5, 210, 210), // - /*effect_transform=*/{}, // - /*coverage_limit=*/Rect::MakeLTRB(0, 0, 100, 100), // - /*image_filter=*/nullptr // - ); - - ASSERT_TRUE(coverage.has_value()); - // Size that matches coverage limit - EXPECT_EQ(coverage.value(), Rect::MakeLTRB(0, 5, 100, 105)); -} - -TEST(SaveLayerUtilsTest, PartiallyIntersectingCoverageIgnoresOriginBothXAndY) { - // Both X and Y vary, no transation is performed. - auto coverage = ComputeSaveLayerCoverage( - /*content_coverage=*/Rect::MakeLTRB(5, 5, 210, 210), // - /*effect_transform=*/{}, // - /*coverage_limit=*/Rect::MakeLTRB(0, 0, 100, 100), // - /*image_filter=*/nullptr // - ); - - ASSERT_TRUE(coverage.has_value()); - EXPECT_EQ(coverage.value(), Rect::MakeLTRB(5, 5, 100, 100)); -} - -TEST(SaveLayerUtilsTest, PartiallyIntersectingCoverageWithOveriszedThresholdY) { - // Y varies, translation is not performed on coverage because it is too far - // offscreen. - auto coverage = ComputeSaveLayerCoverage( - /*content_coverage=*/Rect::MakeLTRB(0, 80, 200, 200), // - /*effect_transform=*/{}, // - /*coverage_limit=*/Rect::MakeLTRB(0, 0, 100, 100), // - /*image_filter=*/nullptr // - ); - - ASSERT_TRUE(coverage.has_value()); - // Size that matches coverage limit - EXPECT_EQ(coverage.value(), Rect::MakeLTRB(0, 80, 100, 100)); -} - -TEST(SaveLayerUtilsTest, PartiallyIntersectingCoverageWithOveriszedThresholdX) { - // X varies, translation is not performed on coverage because it is too far - // offscreen. - auto coverage = ComputeSaveLayerCoverage( - /*content_coverage=*/Rect::MakeLTRB(80, 0, 200, 200), // - /*effect_transform=*/{}, // - /*coverage_limit=*/Rect::MakeLTRB(0, 0, 100, 100), // - /*image_filter=*/nullptr // + /*content_coverage=*/Rect::MakeLTRB(0, 0, 90, 90), // + /*effect_transform=*/{}, // + /*coverage_limit=*/Rect::MakeLTRB(0, 0, 100, 100), // + /*image_filter=*/nullptr // ); ASSERT_TRUE(coverage.has_value()); // Size that matches coverage limit - EXPECT_EQ(coverage.value(), Rect::MakeLTRB(80, 0, 100, 100)); + EXPECT_EQ(coverage.value(), Rect::MakeLTRB(0, 0, 100, 100)); } } // namespace testing