[Impeller] Turn on golden tests that use the ImGui widgets functions (flutter/engine#50606)
[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
@@ -63,13 +63,6 @@ const std::unique_ptr<PlaygroundImpl>& GetSharedVulkanPlayground(
|
||||
// If you add a new playground test to the aiks unittests and you do not want it
|
||||
// to also be a golden test, then add the test name here.
|
||||
static const std::vector<std::string> kSkipTests = {
|
||||
IMP_AIKSTEST(GaussianBlurAnimatedBackdrop),
|
||||
IMP_AIKSTEST(CanRenderBackdropBlurInteractive),
|
||||
IMP_AIKSTEST(ClippedBlurFilterRendersCorrectlyInteractive),
|
||||
IMP_AIKSTEST(GradientStrokesRenderCorrectly),
|
||||
IMP_AIKSTEST(SolidStrokesRenderCorrectly),
|
||||
IMP_AIKSTEST(GaussianBlurRotatedAndClippedInteractive),
|
||||
IMP_AIKSTEST(CoverageOriginShouldBeAccountedForInSubpasses),
|
||||
// TextRotated is flakey and we can't seem to get it to stabilize on Skia
|
||||
// Gold.
|
||||
IMP_AIKSTEST(TextRotated),
|
||||
|
||||
@@ -7,39 +7,43 @@
|
||||
namespace impeller {
|
||||
|
||||
Point DrawPlaygroundPoint(PlaygroundPoint& point) {
|
||||
impeller::Point mouse_pos(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
|
||||
if (!point.prev_mouse_pos.has_value()) {
|
||||
if (ImGui::GetCurrentContext()) {
|
||||
impeller::Point mouse_pos(ImGui::GetMousePos().x, ImGui::GetMousePos().y);
|
||||
if (!point.prev_mouse_pos.has_value()) {
|
||||
point.prev_mouse_pos = mouse_pos;
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_R)) {
|
||||
point.position = point.reset_position;
|
||||
point.dragging = false;
|
||||
}
|
||||
|
||||
bool hovering =
|
||||
point.position.GetDistance(mouse_pos) < point.radius &&
|
||||
point.position.GetDistance(point.prev_mouse_pos.value()) < point.radius;
|
||||
if (!ImGui::IsMouseDown(0)) {
|
||||
point.dragging = false;
|
||||
} else if (hovering && ImGui::IsMouseClicked(0)) {
|
||||
point.dragging = true;
|
||||
}
|
||||
if (point.dragging) {
|
||||
point.position += mouse_pos - point.prev_mouse_pos.value();
|
||||
}
|
||||
ImGui::GetBackgroundDrawList()->AddCircleFilled(
|
||||
{point.position.x, point.position.y}, point.radius,
|
||||
ImColor(point.color.red, point.color.green, point.color.blue,
|
||||
(hovering || point.dragging) ? 0.6f : 0.3f));
|
||||
if (hovering || point.dragging) {
|
||||
ImGui::GetBackgroundDrawList()->AddText(
|
||||
{point.position.x - point.radius,
|
||||
point.position.y + point.radius + 10},
|
||||
ImColor(point.color.red, point.color.green, point.color.blue, 1.0f),
|
||||
impeller::SPrintF("x:%0.3f y:%0.3f", point.position.x,
|
||||
point.position.y)
|
||||
.c_str());
|
||||
}
|
||||
point.prev_mouse_pos = mouse_pos;
|
||||
}
|
||||
|
||||
if (ImGui::IsKeyPressed(ImGuiKey_R)) {
|
||||
point.position = point.reset_position;
|
||||
point.dragging = false;
|
||||
}
|
||||
|
||||
bool hovering =
|
||||
point.position.GetDistance(mouse_pos) < point.radius &&
|
||||
point.position.GetDistance(point.prev_mouse_pos.value()) < point.radius;
|
||||
if (!ImGui::IsMouseDown(0)) {
|
||||
point.dragging = false;
|
||||
} else if (hovering && ImGui::IsMouseClicked(0)) {
|
||||
point.dragging = true;
|
||||
}
|
||||
if (point.dragging) {
|
||||
point.position += mouse_pos - point.prev_mouse_pos.value();
|
||||
}
|
||||
ImGui::GetBackgroundDrawList()->AddCircleFilled(
|
||||
{point.position.x, point.position.y}, point.radius,
|
||||
ImColor(point.color.red, point.color.green, point.color.blue,
|
||||
(hovering || point.dragging) ? 0.6f : 0.3f));
|
||||
if (hovering || point.dragging) {
|
||||
ImGui::GetBackgroundDrawList()->AddText(
|
||||
{point.position.x - point.radius, point.position.y + point.radius + 10},
|
||||
ImColor(point.color.red, point.color.green, point.color.blue, 1.0f),
|
||||
impeller::SPrintF("x:%0.3f y:%0.3f", point.position.x, point.position.y)
|
||||
.c_str());
|
||||
}
|
||||
point.prev_mouse_pos = mouse_pos;
|
||||
return point.position;
|
||||
}
|
||||
|
||||
@@ -48,14 +52,15 @@ std::tuple<Point, Point> DrawPlaygroundLine(PlaygroundPoint& point_a,
|
||||
Point position_a = DrawPlaygroundPoint(point_a);
|
||||
Point position_b = DrawPlaygroundPoint(point_b);
|
||||
|
||||
auto dir = (position_b - position_a).Normalize() * point_a.radius;
|
||||
auto line_a = position_a + dir;
|
||||
auto line_b = position_b - dir;
|
||||
ImGui::GetBackgroundDrawList()->AddLine(
|
||||
{line_a.x, line_a.y}, {line_b.x, line_b.y},
|
||||
ImColor(point_b.color.red, point_b.color.green, point_b.color.blue,
|
||||
0.3f));
|
||||
|
||||
if (ImGui::GetCurrentContext()) {
|
||||
auto dir = (position_b - position_a).Normalize() * point_a.radius;
|
||||
auto line_a = position_a + dir;
|
||||
auto line_b = position_b - dir;
|
||||
ImGui::GetBackgroundDrawList()->AddLine(
|
||||
{line_a.x, line_a.y}, {line_b.x, line_b.y},
|
||||
ImColor(point_b.color.red, point_b.color.green, point_b.color.blue,
|
||||
0.3f));
|
||||
}
|
||||
return std::make_tuple(position_a, position_b);
|
||||
}
|
||||
//
|
||||
|
||||
@@ -40,7 +40,7 @@ FONT_SUBSET_DIR = os.path.join(BUILDROOT_DIR, 'flutter', 'tools', 'font_subset')
|
||||
ENCODING = 'UTF-8'
|
||||
|
||||
# This number must be updated when adding new golden tests to impeller.
|
||||
_NUM_EXPECTED_GENERATED_IMPELLER_GOLDEN_FILES = 578
|
||||
_NUM_EXPECTED_GENERATED_IMPELLER_GOLDEN_FILES = 599
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
logger_handler = logging.StreamHandler()
|
||||
|
||||
Reference in New Issue
Block a user