Flutter Impeller
geometry_unittests.cc File Reference
#include <memory>
#include "flutter/testing/testing.h"
#include "gtest/gtest.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/constants.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, GeometryResultHasReasonableDefaults)
 
 impeller::testing::TEST (EntityGeometryTest, AlphaCoverageStrokePaths)
 

Macro Definition Documentation

◆ EXPECT_SOLID_VERTICES_NEAR

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

Definition at line 47 of file geometry_unittests.cc.

◆ EXPECT_TEXTURE_VERTICES_NEAR

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

Definition at line 49 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 16 of file geometry_unittests.cc.

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

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

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

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

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