Flutter Impeller
geometry_unittests.cc File Reference
#include <memory>
#include "flutter/display_list/geometry/dl_path_builder.h"
#include "flutter/testing/testing.h"
#include "gtest/gtest.h"
#include "impeller/entity/contents/content_context.h"
#include "impeller/entity/contents/pipelines.h"
#include "impeller/entity/geometry/geometry.h"
#include "impeller/entity/geometry/round_rect_geometry.h"
#include "impeller/entity/geometry/stroke_path_geometry.h"
#include "impeller/geometry/constants.h"
#include "impeller/geometry/geometry_asserts.h"
#include "impeller/renderer/testing/mocks.h"

Go to the source code of this file.

Classes

class  impeller::ImpellerEntityUnitTestAccessor
 

Namespaces

 impeller
 
 impeller::testing
 

Macros

#define EXPECT_SOLID_VERTICES_NEAR(a, b)    EXPECT_PRED2(&::SolidVerticesNear, a, b)
 
#define EXPECT_TEXTURE_VERTICES_NEAR(a, b)    EXPECT_PRED2(&::TextureVerticesNear, a, b)
 

Functions

inline ::testing::AssertionResult SolidVerticesNear (std::vector< impeller::Point > a, std::vector< impeller::Point > b)
 
inline ::testing::AssertionResult TextureVerticesNear (std::vector< impeller::TextureFillVertexShader::PerVertexData > a, std::vector< impeller::TextureFillVertexShader::PerVertexData > b)
 
 impeller::testing::TEST (EntityGeometryTest, RectGeometryCoversArea)
 
 impeller::testing::TEST (EntityGeometryTest, FillPathGeometryCoversArea)
 
 impeller::testing::TEST (EntityGeometryTest, FillPathGeometryCoversAreaNoInnerRect)
 
 impeller::testing::TEST (EntityGeometryTest, FillArcGeometryCoverage)
 
 impeller::testing::TEST (EntityGeometryTest, StrokeArcGeometryCoverage)
 
 impeller::testing::TEST (EntityGeometryTest, FillRoundRectGeometryCoversArea)
 
 impeller::testing::TEST (EntityGeometryTest, LineGeometryCoverage)
 
 impeller::testing::TEST (EntityGeometryTest, RoundRectGeometryCoversArea)
 
 impeller::testing::TEST (EntityGeometryTest, GeometryResultHasReasonableDefaults)
 
 impeller::testing::TEST (EntityGeometryTest, AlphaCoverageStrokePaths)
 
 impeller::testing::TEST (EntityGeometryTest, SimpleTwoLineStrokeVerticesButtCap)
 
 impeller::testing::TEST (EntityGeometryTest, SimpleTwoLineStrokeVerticesRoundCap)
 
 impeller::testing::TEST (EntityGeometryTest, SimpleTwoLineStrokeVerticesSquareCap)
 
 impeller::testing::TEST (EntityGeometryTest, TwoLineSegmentsRightTurnStrokeVerticesBevelJoin)
 
 impeller::testing::TEST (EntityGeometryTest, TwoLineSegmentsLeftTurnStrokeVerticesBevelJoin)
 
 impeller::testing::TEST (EntityGeometryTest, TwoLineSegmentsRightTurnStrokeVerticesMiterJoin)
 
 impeller::testing::TEST (EntityGeometryTest, TwoLineSegmentsLeftTurnStrokeVerticesMiterJoin)
 
 impeller::testing::TEST (EntityGeometryTest, TinyQuadGeneratesCaps)
 
 impeller::testing::TEST (EntityGeometryTest, TinyConicGeneratesCaps)
 
 impeller::testing::TEST (EntityGeometryTest, TinyCubicGeneratesCaps)
 
 impeller::testing::TEST (EntityGeometryTest, TwoLineSegmentsMiterLimit)
 
 impeller::testing::TEST (EntityGeometryTest, TwoLineSegments180DegreeJoins)
 
 impeller::testing::TEST (EntityGeometryTest, TightQuadratic180DegreeJoins)
 
 impeller::testing::TEST (EntityGeometryTest, TightConic180DegreeJoins)
 
 impeller::testing::TEST (EntityGeometryTest, TightCubic180DegreeJoins)
 
 impeller::testing::TEST (EntityGeometryTest, RotatedFilledCircleGeometryCoverage)
 
 impeller::testing::TEST (EntityGeometryTest, RotatedStrokedCircleGeometryCoverage)
 

Macro Definition Documentation

◆ EXPECT_SOLID_VERTICES_NEAR

#define EXPECT_SOLID_VERTICES_NEAR (   a,
 
)     EXPECT_PRED2(&::SolidVerticesNear, a, b)

Definition at line 50 of file geometry_unittests.cc.

◆ EXPECT_TEXTURE_VERTICES_NEAR

#define EXPECT_TEXTURE_VERTICES_NEAR (   a,
 
)     EXPECT_PRED2(&::TextureVerticesNear, a, b)

Definition at line 52 of file geometry_unittests.cc.

Function Documentation

◆ SolidVerticesNear()

inline ::testing::AssertionResult SolidVerticesNear ( std::vector< impeller::Point a,
std::vector< impeller::Point b 
)

Definition at line 19 of file geometry_unittests.cc.

21  {
22  if (a.size() != b.size()) {
23  return ::testing::AssertionFailure() << "Colors length does not match";
24  }
25  for (auto i = 0u; i < b.size(); i++) {
26  if (!PointNear(a[i], b[i])) {
27  return ::testing::AssertionFailure() << "Positions are not equal.";
28  }
29  }
30  return ::testing::AssertionSuccess();
31 }
inline ::testing::AssertionResult PointNear(impeller::Point a, impeller::Point b)

References impeller::saturated::b, and PointNear().

◆ TextureVerticesNear()

inline ::testing::AssertionResult TextureVerticesNear ( std::vector< impeller::TextureFillVertexShader::PerVertexData >  a,
std::vector< impeller::TextureFillVertexShader::PerVertexData >  b 
)

Definition at line 33 of file geometry_unittests.cc.

35  {
36  if (a.size() != b.size()) {
37  return ::testing::AssertionFailure() << "Colors length does not match";
38  }
39  for (auto i = 0u; i < b.size(); i++) {
40  if (!PointNear(a[i].position, b[i].position)) {
41  return ::testing::AssertionFailure() << "Positions are not equal.";
42  }
43  if (!PointNear(a[i].texture_coords, b[i].texture_coords)) {
44  return ::testing::AssertionFailure() << "Texture coords are not equal.";
45  }
46  }
47  return ::testing::AssertionSuccess();
48 }

References impeller::saturated::b, and PointNear().