5#include "gtest/gtest.h"
7#include "flutter/impeller/geometry/matrix.h"
9#include "flutter/impeller/geometry/geometry_asserts.h"
14TEST(MatrixTest, Multiply) {
24 11.0, 21.0, 0.0, 1.0)));
27TEST(MatrixTest, HasPerspective2D) {
28 EXPECT_FALSE(
Matrix().HasPerspective2D());
30 auto test = [](
int index,
bool expect) {
32 EXPECT_FALSE(
matrix.HasPerspective2D());
34 EXPECT_EQ(
matrix.HasPerspective2D(), expect) <<
"index: " << index;
45TEST(MatrixTest, HasPerspective) {
46 EXPECT_FALSE(
Matrix().HasPerspective());
48 auto test = [](
int index,
bool expect) {
50 EXPECT_FALSE(
matrix.HasPerspective());
52 EXPECT_EQ(
matrix.HasPerspective(), expect) <<
"index: " << index;
63TEST(MatrixTest, HasTranslation) {
67 EXPECT_FALSE(
Matrix().HasTranslation());
70TEST(MatrixTest, IsAligned2D) {
74 auto test = [](
int index,
bool expect) {
78 EXPECT_EQ(
matrix.IsAligned2D(), expect) <<
"index: " << index;
89 for (
int i = -1000;
i < 1000;
i++) {
96 for (
int i = -1000;
i < 1000;
i++) {
99 EXPECT_FALSE(
matrix.IsAligned2D()) <<
"degrees: " <<
d.degrees;
121 auto test = [](
int index,
bool expect) {
125 EXPECT_EQ(
matrix.IsAligned(), expect) <<
"index: " << index;
136 for (
int i = -1000;
i < 1000;
i++) {
143 for (
int i = -1000;
i < 1000;
i++) {
146 EXPECT_FALSE(
matrix.IsAligned()) <<
"degrees: " <<
d.degrees;
150TEST(MatrixTest, TransformHomogenous) {
153 2.0f, 3.0f, 5.0f, 7.0f,
154 11.0f, 13.0f, 17.0f, 19.0f,
155 23.0f, 29.0f, 31.0f, 37.0f,
156 41.0f, 43.0f, 47.0f, 53.0f
159 EXPECT_EQ(
matrix.TransformHomogenous({1.0f, -1.0f}),
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
inline ::testing::AssertionResult MatrixNear(impeller::Matrix a, impeller::Matrix b)
unsigned useCenter Optional< SkMatrix > matrix
TEST(AiksCanvasTest, EmptyCullRect)
SK_API sk_sp< PrecompileColorFilter > Matrix()
A 4x4 matrix using column-major storage.
static constexpr Matrix MakeTranslation(const Vector3 &t)
static constexpr Matrix MakeColumn(Scalar m0, Scalar m1, Scalar m2, Scalar m3, Scalar m4, Scalar m5, Scalar m6, Scalar m7, Scalar m8, Scalar m9, Scalar m10, Scalar m11, Scalar m12, Scalar m13, Scalar m14, Scalar m15)
static Matrix MakeRotationZ(Radians r)
static constexpr Matrix MakeScale(const Vector3 &s)
#define EXPECT_TRUE(handle)