Flutter Impeller
uber_sdf_contents_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 "gtest/gtest.h"
9 
10 namespace impeller {
11 namespace testing {
12 
13 TEST(UberSDFContentsTest, ApplyColorFilter) {
14  auto rect = Rect::MakeXYWH(100, 100, 200, 200);
15  FillRectGeometry geometry(rect);
16  auto contents = UberSDFContents::MakeRect(Color::Red(), 0.0f, Join::kMiter,
17  false, &geometry);
18 
19  ASSERT_EQ(contents->GetColor(), Color::Red());
20 
21  bool result =
22  contents->ApplyColorFilter([](Color color) { return Color::Blue(); });
23 
24  ASSERT_TRUE(result);
25  ASSERT_EQ(contents->GetColor(), Color::Blue());
26 }
27 
28 } // namespace testing
29 } // namespace impeller
static std::unique_ptr< UberSDFContents > MakeRect(Color color, Scalar stroke_width, Join stroke_join, bool stroked, const FillRectGeometry *geometry)
TEST(AllocationSizeTest, CanCreateTypedAllocations)
static constexpr Color Red()
Definition: color.h:272
static constexpr Color Blue()
Definition: color.h:276
constexpr static TRect MakeXYWH(Type x, Type y, Type width, Type height)
Definition: rect.h:136