Flutter Engine
The Flutter Engine
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
5#include "flutter/impeller/aiks/aiks_unittests.h"
6
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
22namespace impeller {
23namespace 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
APPLY_COLOR_FILTER_GRADIENT_TEST(Linear)