Flutter Impeller
aiks_gradient_unittests.cc
Go to the documentation of this file.
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
6 
7 #include "impeller/aiks/canvas.h"
15 #include "third_party/imgui/imgui.h"
16 
17 ////////////////////////////////////////////////////////////////////////////////
18 // This is for tests of Canvas that are interested the results of rendering
19 // gradients.
20 ////////////////////////////////////////////////////////////////////////////////
21 
22 namespace impeller {
23 namespace testing {
24 
25 #define APPLY_COLOR_FILTER_GRADIENT_TEST(name) \
26  TEST_P(AiksTest, name##GradientApplyColorFilter) { \
27  auto contents = name##GradientContents(); \
28  contents.SetColors({Color::CornflowerBlue().WithAlpha(0.75)}); \
29  auto result = contents.ApplyColorFilter([](const Color& color) { \
30  return color.Blend(Color::LimeGreen().WithAlpha(0.75), \
31  BlendMode::kScreen); \
32  }); \
33  ASSERT_TRUE(result); \
34  \
35  std::vector<Color> expected = {Color(0.433247, 0.879523, 0.825324, 0.75)}; \
36  ASSERT_COLORS_NEAR(contents.GetColors(), expected); \
37  }
38 
43 
44 } // namespace testing
45 } // namespace impeller
geometry_asserts.h
aiks_unittests.h
sweep_gradient_contents.h
path_builder.h
widgets.h
conical_gradient_contents.h
canvas.h
radial_gradient_contents.h
impeller::testing::APPLY_COLOR_FILTER_GRADIENT_TEST
APPLY_COLOR_FILTER_GRADIENT_TEST(Linear)
impeller
Definition: aiks_blend_unittests.cc:18
linear_gradient_contents.h