Flutter Impeller
geometry_unittests.cc File Reference
#include <memory>
#include "flutter/testing/testing.h"
#include "impeller/entity/contents/content_context.h"
#include "impeller/entity/geometry/geometry.h"
#include "impeller/entity/geometry/stroke_path_geometry.h"
#include "impeller/geometry/geometry_asserts.h"
#include "impeller/geometry/path_builder.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::SolidFillVertexShader::PerVertexData > a, std::vector< impeller::SolidFillVertexShader::PerVertexData > 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, LineGeometryCoverage)
 
 impeller::testing::TEST (EntityGeometryTest, RoundRectGeometryCoversArea)
 
 impeller::testing::TEST (EntityGeometryTest, StrokePathGeometryTransformOfLine)
 
 impeller::testing::TEST (EntityGeometryTest, GeometryResultHasReasonableDefaults)
 

Macro Definition Documentation

◆ EXPECT_SOLID_VERTICES_NEAR

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

Definition at line 45 of file geometry_unittests.cc.

◆ EXPECT_TEXTURE_VERTICES_NEAR

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

Definition at line 47 of file geometry_unittests.cc.

Function Documentation

◆ SolidVerticesNear()

inline ::testing::AssertionResult SolidVerticesNear ( std::vector< impeller::SolidFillVertexShader::PerVertexData >  a,
std::vector< impeller::SolidFillVertexShader::PerVertexData >  b 
)

Definition at line 14 of file geometry_unittests.cc.

16  {
17  if (a.size() != b.size()) {
18  return ::testing::AssertionFailure() << "Colors length does not match";
19  }
20  for (auto i = 0u; i < b.size(); i++) {
21  if (!PointNear(a[i].position, b[i].position)) {
22  return ::testing::AssertionFailure() << "Positions are not equal.";
23  }
24  }
25  return ::testing::AssertionSuccess();
26 }

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 28 of file geometry_unittests.cc.

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

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

PointNear
inline ::testing::AssertionResult PointNear(impeller::Point a, impeller::Point b)
Definition: geometry_asserts.h:76
impeller::saturated::b
SI b
Definition: saturated_math.h:87