Skip to content

Commit

Permalink
[flatland] Increase pixel check threshold for web_runner_pixeltest
Browse files Browse the repository at this point in the history
This CL increases the pixel threshold to accommodate for the progresive
load cases on swiftshader.

Multiply: web_runner_pixeltest
Fixed: 129359
Change-Id: I751259d6adac02c60797d94f247ffd1df5c66671
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/877778
Commit-Queue: Auto-Submit <[email protected]>
Fuchsia-Auto-Submit: Emircan Uysaler <[email protected]>
Reviewed-by: Mukesh Agrawal <[email protected]>
  • Loading branch information
uysalere authored and Rebase bot committed Jun 30, 2023
1 parent 220d14a commit c960460
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ using component_testing::Route;

constexpr zx::duration kPredicateTimeout = zx::sec(10);

const int kPixelMatchThresholdInProjections = 100000;

enum class TapLocation { kTopLeft, kTopRight };

// A dot product of the coordinates of two pixels.
Expand Down Expand Up @@ -91,6 +93,7 @@ class WebRunnerPixelTest : public ui_testing::PortableUITest,
public:
bool use_flatland() override { return true; }
std::string GetTestUIStackUrl() override { return "#meta/test-ui-stack.cm"; }
bool use_vulkan() const { return GetParam(); }

private:
void ExtendRealm() override {
Expand All @@ -108,7 +111,7 @@ class WebRunnerPixelTest : public ui_testing::PortableUITest,
realm_builder().InitMutableConfigToEmpty(kWebClient);
realm_builder().SetConfigValue(kWebClient, "html", HtmlForTestCase());
realm_builder().SetConfigValue(kWebClient, "use_vulkan",
component_testing::ConfigValue::Bool(GetParam()));
component_testing::ConfigValue::Bool(use_vulkan()));
}

virtual std::string HtmlForTestCase() = 0;
Expand Down Expand Up @@ -389,7 +392,7 @@ TEST_P(VideoHtmlPixelTests, ValidPixelTest) {

// Fail the predicate check until at least some pixels are kinda blue. This will
// cause a re-attempt of a screenshot.
if (MaxSumProject(kBlue, top) < 60000) {
if (MaxSumProject(kBlue, top) < kPixelMatchThresholdInProjections) {
return false;
}

Expand All @@ -400,10 +403,10 @@ TEST_P(VideoHtmlPixelTests, ValidPixelTest) {
// diagram. Since it is hard to assert on the exact number of pixels for each shade of the
// color, the test asserts on whether the shade that's most like the given color is
// prominent enough.
EXPECT_GT(MaxSumProject(kYellow, top), 100000);
EXPECT_GT(MaxSumProject(kRed, top), 100000);
EXPECT_GT(MaxSumProject(kBlue, top), 100000);
EXPECT_GT(MaxSumProject(kGreen, top), 100000);
EXPECT_GT(MaxSumProject(kYellow, top), kPixelMatchThresholdInProjections);
EXPECT_GT(MaxSumProject(kRed, top), kPixelMatchThresholdInProjections);
EXPECT_GT(MaxSumProject(kBlue, top), kPixelMatchThresholdInProjections);
EXPECT_GT(MaxSumProject(kGreen, top), kPixelMatchThresholdInProjections);

return true;
},
Expand Down

0 comments on commit c960460

Please sign in to comment.