2121#include " impeller/aiks/paint_pass_delegate.h"
2222#include " impeller/aiks/testing/context_spy.h"
2323#include " impeller/core/capture.h"
24- #include " impeller/entity/contents/conical_gradient_contents.h"
2524#include " impeller/entity/contents/filters/gaussian_blur_filter_contents.h"
26- #include " impeller/entity/contents/filters/inputs/filter_input.h"
27- #include " impeller/entity/contents/linear_gradient_contents.h"
28- #include " impeller/entity/contents/radial_gradient_contents.h"
2925#include " impeller/entity/contents/solid_color_contents.h"
30- #include " impeller/entity/contents/sweep_gradient_contents.h"
3126#include " impeller/entity/render_target_cache.h"
3227#include " impeller/geometry/color.h"
3328#include " impeller/geometry/constants.h"
3833#include " impeller/playground/widgets.h"
3934#include " impeller/renderer/command_buffer.h"
4035#include " impeller/renderer/snapshot.h"
41- #include " impeller/renderer/testing/mocks.h"
42- #include " impeller/scene/material.h"
43- #include " impeller/scene/node.h"
4436#include " impeller/typographer/backends/skia/text_frame_skia.h"
4537#include " impeller/typographer/backends/skia/typographer_context_skia.h"
4638#include " impeller/typographer/backends/stb/text_frame_stb.h"
4739#include " impeller/typographer/backends/stb/typeface_stb.h"
4840#include " impeller/typographer/backends/stb/typographer_context_stb.h"
4941#include " third_party/imgui/imgui.h"
5042#include " third_party/skia/include/core/SkFontMgr.h"
51- #include " third_party/skia/include/core/SkTypeface.h"
5243#include " txt/platform.h"
5344
5445namespace impeller {
@@ -818,12 +809,14 @@ TEST_P(AiksTest, TextFrameSubpixelAlignment) {
818809 static float phase_variation = 0.2 ;
819810 static float speed = 0.5 ;
820811 static float magnitude = 100 ;
821- ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
822- ImGui::SliderFloat (" Font size" , &font_size, 5 , 50 );
823- ImGui::SliderFloat (" Phase variation" , &phase_variation, 0 , 1 );
824- ImGui::SliderFloat (" Oscillation speed" , &speed, 0 , 2 );
825- ImGui::SliderFloat (" Oscillation magnitude" , &magnitude, 0 , 300 );
826- ImGui::End ();
812+ if (AiksTest::ImGuiBegin (" Controls" , nullptr ,
813+ ImGuiWindowFlags_AlwaysAutoResize)) {
814+ ImGui::SliderFloat (" Font size" , &font_size, 5 , 50 );
815+ ImGui::SliderFloat (" Phase variation" , &phase_variation, 0 , 1 );
816+ ImGui::SliderFloat (" Oscillation speed" , &speed, 0 , 2 );
817+ ImGui::SliderFloat (" Oscillation magnitude" , &magnitude, 0 , 300 );
818+ ImGui::End ();
819+ }
827820
828821 Canvas canvas;
829822 canvas.Scale (GetContentScale ());
@@ -1067,15 +1060,15 @@ TEST_P(AiksTest, CanDrawPaintMultipleTimesInteractive) {
10671060 static Color foreground = Color::Color::OrangeRed ().WithAlpha (0.5 );
10681061 static int current_blend_index = 3 ;
10691062
1070- ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
1071- {
1063+ if ( AiksTest::ImGuiBegin (" Controls" , nullptr ,
1064+ ImGuiWindowFlags_AlwaysAutoResize)) {
10721065 ImGui::ColorEdit4 (" Background" , reinterpret_cast <float *>(&background));
10731066 ImGui::ColorEdit4 (" Foreground" , reinterpret_cast <float *>(&foreground));
10741067 ImGui::ListBox (" Blend mode" , ¤t_blend_index,
10751068 modes.blend_mode_names .data (),
10761069 modes.blend_mode_names .size ());
1070+ ImGui::End ();
10771071 }
1078- ImGui::End ();
10791072
10801073 Canvas canvas;
10811074 canvas.Scale (Vector2 (0.2 , 0.2 ));
@@ -1162,8 +1155,8 @@ TEST_P(AiksTest, ColorWheel) {
11621155 static Color color1 = Color::Green ();
11631156 static Color color2 = Color::Blue ();
11641157
1165- ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
1166- {
1158+ if ( AiksTest::ImGuiBegin (" Controls" , nullptr ,
1159+ ImGuiWindowFlags_AlwaysAutoResize)) {
11671160 ImGui::Checkbox (" Cache the wheel" , &cache_the_wheel);
11681161 ImGui::ListBox (" Blending mode" , ¤t_blend_index,
11691162 blend_modes.blend_mode_names .data (),
@@ -1173,8 +1166,8 @@ TEST_P(AiksTest, ColorWheel) {
11731166 ImGui::ColorEdit4 (" Color B" , reinterpret_cast <float *>(&color1));
11741167 ImGui::ColorEdit4 (" Color C" , reinterpret_cast <float *>(&color2));
11751168 ImGui::SliderFloat (" Destination alpha" , &dst_alpha, 0 , 1 );
1169+ ImGui::End ();
11761170 }
1177- ImGui::End ();
11781171
11791172 static Point content_scale;
11801173 Point new_content_scale = GetContentScale ();
@@ -1868,14 +1861,16 @@ TEST_P(AiksTest, SceneColorSource) {
18681861 auto callback = [&](AiksContext& renderer) -> std::optional<Picture> {
18691862 Paint paint;
18701863
1871- ImGui::Begin (" Controls" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
18721864 static Scalar distance = 2 ;
1873- ImGui::SliderFloat (" Distance" , &distance, 0 , 4 );
18741865 static Scalar y_pos = 0 ;
1875- ImGui::SliderFloat (" Y" , &y_pos, -3 , 3 );
18761866 static Scalar fov = 45 ;
1877- ImGui::SliderFloat (" FOV" , &fov, 1 , 180 );
1878- ImGui::End ();
1867+ if (AiksTest::ImGuiBegin (" Controls" , nullptr ,
1868+ ImGuiWindowFlags_AlwaysAutoResize)) {
1869+ ImGui::SliderFloat (" Distance" , &distance, 0 , 4 );
1870+ ImGui::SliderFloat (" Y" , &y_pos, -3 , 3 );
1871+ ImGui::SliderFloat (" FOV" , &fov, 1 , 180 );
1872+ ImGui::End ();
1873+ }
18791874
18801875 Scalar angle = GetSecondsElapsed ();
18811876 auto camera_position =
@@ -3066,13 +3061,16 @@ TEST_P(AiksTest, CaptureContext) {
30663061 auto color = document.AddColor (" Background color" , Color::CornflowerBlue ());
30673062 canvas.DrawPaint ({.color = color});
30683063
3069- ImGui::Begin (" TestDocument" , nullptr , ImGuiWindowFlags_AlwaysAutoResize);
3070- document.GetElement ()->properties .Iterate ([](CaptureProperty& property) {
3071- property.Invoke ({.color = [](CaptureColorProperty& p) {
3072- ImGui::ColorEdit4 (p.label .c_str (), reinterpret_cast <float *>(&p.value ));
3073- }});
3074- });
3075- ImGui::End ();
3064+ if (AiksTest::ImGuiBegin (" TestDocument" , nullptr ,
3065+ ImGuiWindowFlags_AlwaysAutoResize)) {
3066+ document.GetElement ()->properties .Iterate ([](CaptureProperty& property) {
3067+ property.Invoke ({.color = [](CaptureColorProperty& p) {
3068+ ImGui::ColorEdit4 (p.label .c_str (),
3069+ reinterpret_cast <float *>(&p.value ));
3070+ }});
3071+ });
3072+ ImGui::End ();
3073+ }
30763074
30773075 return canvas.EndRecordingAsPicture ();
30783076 };
0 commit comments