Lines Matching refs:reporter

36 static bool are_equal(skiatest::Reporter* reporter,
52 REPORTER_ASSERT(reporter, aVal == bVal && aValI == bValI);
55 REPORTER_ASSERT(reporter, foundZeroSignDiff);
66 REPORTER_ASSERT(reporter, aVal == bVal && aValI == bValI);
69 REPORTER_ASSERT(reporter, foundNaN);
81 static void assert9(skiatest::Reporter* reporter, const SkMatrix& m,
87 REPORTER_ASSERT(reporter, buffer[0] == a);
88 REPORTER_ASSERT(reporter, buffer[1] == b);
89 REPORTER_ASSERT(reporter, buffer[2] == c);
90 REPORTER_ASSERT(reporter, buffer[3] == d);
91 REPORTER_ASSERT(reporter, buffer[4] == e);
92 REPORTER_ASSERT(reporter, buffer[5] == f);
93 REPORTER_ASSERT(reporter, buffer[6] == g);
94 REPORTER_ASSERT(reporter, buffer[7] == h);
95 REPORTER_ASSERT(reporter, buffer[8] == i);
97 REPORTER_ASSERT(reporter, m.rc(0, 0) == a);
98 REPORTER_ASSERT(reporter, m.rc(0, 1) == b);
99 REPORTER_ASSERT(reporter, m.rc(0, 2) == c);
100 REPORTER_ASSERT(reporter, m.rc(1, 0) == d);
101 REPORTER_ASSERT(reporter, m.rc(1, 1) == e);
102 REPORTER_ASSERT(reporter, m.rc(1, 2) == f);
103 REPORTER_ASSERT(reporter, m.rc(2, 0) == g);
104 REPORTER_ASSERT(reporter, m.rc(2, 1) == h);
105 REPORTER_ASSERT(reporter, m.rc(2, 2) == i);
108 static void test_set9(skiatest::Reporter* reporter) {
112 assert9(reporter, m, 1, 0, 0, 0, 1, 0, 0, 0, 1);
115 assert9(reporter, m, 2, 0, 0, 0, 3, 0, 0, 0, 1);
118 assert9(reporter, m, 2, 0, 4, 0, 3, 5, 0, 0, 1);
125 REPORTER_ASSERT(reporter, !m.isIdentity());
127 REPORTER_ASSERT(reporter, m.isIdentity());
130 static void test_matrix_recttorect(skiatest::Reporter* reporter) {
137 REPORTER_ASSERT(reporter, SkMatrix::kIdentity_Mask == matrix.getType());
138 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
142 REPORTER_ASSERT(reporter, SkMatrix::kTranslate_Mask == matrix.getType());
143 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
147 REPORTER_ASSERT(reporter,
149 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
154 REPORTER_ASSERT(reporter, SkMatrix::kScale_Mask == matrix.getType());
155 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
158 static void test_flatten(skiatest::Reporter* reporter, const SkMatrix& m) {
164 REPORTER_ASSERT(reporter, size1 == size2);
165 REPORTER_ASSERT(reporter, size1 <= SkMatrixPriv::kMaxFlattenSize);
169 REPORTER_ASSERT(reporter, size1 == size3);
170 REPORTER_ASSERT(reporter, are_equal(reporter, m, m2));
174 REPORTER_ASSERT(reporter, size1 == size3);
175 REPORTER_ASSERT(reporter, memcmp(buffer, buffer2, size1) == 0);
178 static void test_matrix_min_max_scale(skiatest::Reporter* reporter) {
184 REPORTER_ASSERT(reporter, 1 == identity.getMinScale());
185 REPORTER_ASSERT(reporter, 1 == identity.getMaxScale());
187 REPORTER_ASSERT(reporter, success && 1 == scales[0] && 1 == scales[1]);
191 REPORTER_ASSERT(reporter, 2 == scale.getMinScale());
192 REPORTER_ASSERT(reporter, 4 == scale.getMaxScale());
194 REPORTER_ASSERT(reporter, success && 2 == scales[0] && 4 == scales[1]);
198 REPORTER_ASSERT(reporter, SK_Scalar1 / 4 == rot90Scale.getMinScale());
199 REPORTER_ASSERT(reporter, SK_Scalar1 / 2 == rot90Scale.getMaxScale());
201 REPORTER_ASSERT(reporter, success && SK_Scalar1 / 4 == scales[0] && SK_Scalar1 / 2 == scales[1]);
205 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(1, rotate.getMinScale(), SK_ScalarNearlyZero));
206 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(1, rotate.getMaxScale(), SK_ScalarNearlyZero));
208 REPORTER_ASSERT(reporter, success);
209 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(1, scales[0], SK_ScalarNearlyZero));
210 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(1, scales[1], SK_ScalarNearlyZero));
214 REPORTER_ASSERT(reporter, 1 == translate.getMinScale());
215 REPORTER_ASSERT(reporter, 1 == translate.getMaxScale());
217 REPORTER_ASSERT(reporter, success && 1 == scales[0] && 1 == scales[1]);
221 REPORTER_ASSERT(reporter, -1 == perspX.getMinScale());
222 REPORTER_ASSERT(reporter, -1 == perspX.getMaxScale());
224 REPORTER_ASSERT(reporter, !success);
232 REPORTER_ASSERT(reporter, !success);
240 REPORTER_ASSERT(reporter, success && 0 == scales[0]);
244 REPORTER_ASSERT(reporter, -1 == perspY.getMinScale());
245 REPORTER_ASSERT(reporter, -1 == perspY.getMaxScale());
249 REPORTER_ASSERT(reporter, !success && -5 == scales[0] && -5 == scales[1]);
257 REPORTER_ASSERT(reporter, invertible);
270 REPORTER_ASSERT(reporter, (minScale < 0) == (maxScale < 0));
271 REPORTER_ASSERT(reporter, (maxScale < 0) == mat.hasPerspective());
274 REPORTER_ASSERT(reporter, success == !mat.hasPerspective());
275 REPORTER_ASSERT(reporter, !success || (scales[0] == minScale && scales[1] == maxScale));
299 REPORTER_ASSERT(reporter, d / maxScale < gVectorScaleTol);
300 REPORTER_ASSERT(reporter, minScale / d < gVectorScaleTol);
308 REPORTER_ASSERT(reporter, max / maxScale >= gCloseScaleTol);
309 REPORTER_ASSERT(reporter, minScale / min >= gCloseScaleTol);
313 static void test_matrix_preserve_shape(skiatest::Reporter* reporter) {
318 REPORTER_ASSERT(reporter, mat.isSimilarity());
319 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
323 REPORTER_ASSERT(reporter, mat.isSimilarity());
324 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
328 REPORTER_ASSERT(reporter, mat.isSimilarity());
329 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
333 REPORTER_ASSERT(reporter, mat.isSimilarity());
334 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
338 REPORTER_ASSERT(reporter, !mat.isSimilarity());
339 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
343 REPORTER_ASSERT(reporter, mat.isSimilarity());
344 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
348 REPORTER_ASSERT(reporter, !mat.isSimilarity());
349 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
353 REPORTER_ASSERT(reporter, !mat.isSimilarity());
354 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
358 REPORTER_ASSERT(reporter, !mat.isSimilarity());
359 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
363 REPORTER_ASSERT(reporter, !mat.isSimilarity());
364 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
368 REPORTER_ASSERT(reporter, !mat.isSimilarity());
369 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
373 REPORTER_ASSERT(reporter, !mat.isSimilarity());
374 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
378 REPORTER_ASSERT(reporter, !mat.isSimilarity());
379 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
384 REPORTER_ASSERT(reporter, mat.isSimilarity());
385 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
393 REPORTER_ASSERT(reporter, mat.isSimilarity());
394 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
398 REPORTER_ASSERT(reporter, mat.isSimilarity());
399 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
403 REPORTER_ASSERT(reporter, mat.isSimilarity());
404 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
408 REPORTER_ASSERT(reporter, !mat.isSimilarity());
409 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
413 REPORTER_ASSERT(reporter, !mat.isSimilarity());
414 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
418 REPORTER_ASSERT(reporter, !mat.isSimilarity());
419 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
423 REPORTER_ASSERT(reporter, !mat.isSimilarity());
424 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
430 REPORTER_ASSERT(reporter, mat.isSimilarity());
431 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
437 REPORTER_ASSERT(reporter, mat.isSimilarity());
438 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
486 static void test_matrix_decomposition(skiatest::Reporter* reporter) {
497 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
498 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
500 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, nullptr, nullptr, nullptr));
504 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
505 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
509 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
510 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
514 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
515 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
519 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
520 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
524 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
525 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
529 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
530 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
534 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
535 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
539 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
540 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
544 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
545 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
549 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
550 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
554 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
555 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
559 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
560 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
564 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
565 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
569 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
570 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
582 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
587 REPORTER_ASSERT(reporter, SkScalarNearlyZero(perpdot));
593 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
594 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
600 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
601 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
607 REPORTER_ASSERT(reporter, !SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
610 REPORTER_ASSERT(reporter, !SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
617 REPORTER_ASSERT(reporter, !SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
650 static void test_matrix_homogeneous(skiatest::Reporter* reporter) {
686 REPORTER_ASSERT(reporter, point3_array_nearly_equal_relative(randTriples, dst, kTripleCount));
696 REPORTER_ASSERT(reporter, point3_array_nearly_equal_relative(&dst[i], &zeros, 1));
705 REPORTER_ASSERT(reporter, point3_array_nearly_equal_relative(&dst, &zeros, 1));
723 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fX, pnt.fX));
724 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fY, pnt.fY));
725 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fZ, 1));
737 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fX, pnt.fX));
738 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fY, pnt.fY));
739 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fZ, 1));
753 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fX, pnt.fX));
754 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fY, pnt.fY));
755 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst.fZ, 1));
764 REPORTER_ASSERT(reporter, naive_homogeneous_mapping(mats[i], randTriples[j], dst));
822 static void test_decompScale(skiatest::Reporter* reporter) {
826 REPORTER_ASSERT(reporter, check_decompScale(m));
828 REPORTER_ASSERT(reporter, check_decompScale(m));
830 REPORTER_ASSERT(reporter, check_decompScale(m));
833 REPORTER_ASSERT(reporter, !check_decompScale(m));
836 REPORTER_ASSERT(reporter, check_decompScale(m));
839 REPORTER_ASSERT(reporter, check_decompScale(m));
842 DEF_TEST(Matrix, reporter) {
847 REPORTER_ASSERT(reporter, mat.invert(&inverse));
849 REPORTER_ASSERT(reporter, is_identity(iden1));
852 REPORTER_ASSERT(reporter, mat.invert(&inverse));
854 REPORTER_ASSERT(reporter, is_identity(iden1));
855 test_flatten(reporter, mat);
858 REPORTER_ASSERT(reporter, mat.invert(&inverse));
860 REPORTER_ASSERT(reporter, is_identity(iden1));
861 test_flatten(reporter, mat);
864 REPORTER_ASSERT(reporter, mat.invert(nullptr));
865 REPORTER_ASSERT(reporter, mat.invert(&inverse));
867 REPORTER_ASSERT(reporter, is_identity(iden1));
869 REPORTER_ASSERT(reporter, is_identity(iden2));
870 test_flatten(reporter, mat);
871 test_flatten(reporter, iden2);
874 REPORTER_ASSERT(reporter, !mat.invert(nullptr));
875 REPORTER_ASSERT(reporter, !mat.invert(&inverse));
877 REPORTER_ASSERT(reporter, !mat.invert(nullptr));
878 REPORTER_ASSERT(reporter, !mat.invert(&inverse));
884 REPORTER_ASSERT(reporter, !mat.invert(nullptr));
885 REPORTER_ASSERT(reporter, !mat.invert(&inverse));
920 REPORTER_ASSERT(reporter,
933 REPORTER_ASSERT(reporter, mat.asAffine(affine));
936 REPORTER_ASSERT(reporter, affineEqual(ScaleX));
937 REPORTER_ASSERT(reporter, affineEqual(SkewY));
938 REPORTER_ASSERT(reporter, affineEqual(SkewX));
939 REPORTER_ASSERT(reporter, affineEqual(ScaleY));
940 REPORTER_ASSERT(reporter, affineEqual(TransX));
941 REPORTER_ASSERT(reporter, affineEqual(TransY));
945 REPORTER_ASSERT(reporter, !mat.asAffine(affine));
952 REPORTER_ASSERT(reporter, are_equal(reporter, mat, mat2));
958 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2));
960 test_matrix_min_max_scale(reporter);
961 test_matrix_preserve_shape(reporter);
962 test_matrix_recttorect(reporter);
963 test_matrix_decomposition(reporter);
964 test_matrix_homogeneous(reporter);
965 test_set9(reporter);
967 test_decompScale(reporter);
971 REPORTER_ASSERT(reporter, mat == mat2);