Lines Matching refs:Reporter
29 static bool are_equal(skiatest::Reporter* reporter,
45 REPORTER_ASSERT(reporter, aVal == bVal && aValI == bValI);
48 REPORTER_ASSERT(reporter, foundZeroSignDiff);
59 REPORTER_ASSERT(reporter, aVal == bVal && aValI == bValI);
62 REPORTER_ASSERT(reporter, foundNaN);
74 static void assert9(skiatest::Reporter* reporter, const SkMatrix& m,
80 REPORTER_ASSERT(reporter, buffer[0] == a);
81 REPORTER_ASSERT(reporter, buffer[1] == b);
82 REPORTER_ASSERT(reporter, buffer[2] == c);
83 REPORTER_ASSERT(reporter, buffer[3] == d);
84 REPORTER_ASSERT(reporter, buffer[4] == e);
85 REPORTER_ASSERT(reporter, buffer[5] == f);
86 REPORTER_ASSERT(reporter, buffer[6] == g);
87 REPORTER_ASSERT(reporter, buffer[7] == h);
88 REPORTER_ASSERT(reporter, buffer[8] == i);
91 static void test_set9(skiatest::Reporter* reporter) {
95 assert9(reporter, m, 1, 0, 0, 0, 1, 0, 0, 0, 1);
98 assert9(reporter, m, 2, 0, 0, 0, 3, 0, 0, 0, 1);
101 assert9(reporter, m, 2, 0, 4, 0, 3, 5, 0, 0, 1);
108 REPORTER_ASSERT(reporter, !m.isIdentity());
110 REPORTER_ASSERT(reporter, m.isIdentity());
113 static void test_matrix_recttorect(skiatest::Reporter* reporter) {
120 REPORTER_ASSERT(reporter, SkMatrix::kIdentity_Mask == matrix.getType());
121 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
125 REPORTER_ASSERT(reporter, SkMatrix::kTranslate_Mask == matrix.getType());
126 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
130 REPORTER_ASSERT(reporter,
132 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
137 REPORTER_ASSERT(reporter, SkMatrix::kScale_Mask == matrix.getType());
138 REPORTER_ASSERT(reporter, matrix.rectStaysRect());
141 static void test_flatten(skiatest::Reporter* reporter, const SkMatrix& m) {
147 REPORTER_ASSERT(reporter, size1 == size2);
148 REPORTER_ASSERT(reporter, size1 <= SkMatrix::kMaxFlattenSize);
152 REPORTER_ASSERT(reporter, size1 == size3);
153 REPORTER_ASSERT(reporter, are_equal(reporter, m, m2));
157 REPORTER_ASSERT(reporter, size1 == size3);
158 REPORTER_ASSERT(reporter, memcmp(buffer, buffer2, size1) == 0);
161 static void test_matrix_min_max_scale(skiatest::Reporter* reporter) {
167 REPORTER_ASSERT(reporter, SK_Scalar1 == identity.getMinScale());
168 REPORTER_ASSERT(reporter, SK_Scalar1 == identity.getMaxScale());
170 REPORTER_ASSERT(reporter, success && SK_Scalar1 == scales[0] && SK_Scalar1 == scales[1]);
174 REPORTER_ASSERT(reporter, SK_Scalar1 * 2 == scale.getMinScale());
175 REPORTER_ASSERT(reporter, SK_Scalar1 * 4 == scale.getMaxScale());
177 REPORTER_ASSERT(reporter, success && SK_Scalar1 * 2 == scales[0] && SK_Scalar1 * 4 == scales[1]);
182 REPORTER_ASSERT(reporter, SK_Scalar1 / 4 == rot90Scale.getMinScale());
183 REPORTER_ASSERT(reporter, SK_Scalar1 / 2 == rot90Scale.getMaxScale());
185 REPORTER_ASSERT(reporter, success && SK_Scalar1 / 4 == scales[0] && SK_Scalar1 / 2 == scales[1]);
189 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SK_Scalar1, rotate.getMinScale(), SK_ScalarNearlyZero));
190 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SK_Scalar1, rotate.getMaxScale(), SK_ScalarNearlyZero));
192 REPORTER_ASSERT(reporter, success);
193 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SK_Scalar1, scales[0], SK_ScalarNearlyZero));
194 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(SK_Scalar1, scales[1], SK_ScalarNearlyZero));
198 REPORTER_ASSERT(reporter, SK_Scalar1 == translate.getMinScale());
199 REPORTER_ASSERT(reporter, SK_Scalar1 == translate.getMaxScale());
201 REPORTER_ASSERT(reporter, success && SK_Scalar1 == scales[0] && SK_Scalar1 == scales[1]);
206 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMinScale());
207 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspX.getMaxScale());
209 REPORTER_ASSERT(reporter, !success);
217 REPORTER_ASSERT(reporter, !success);
225 REPORTER_ASSERT(reporter, success && 0 == scales[0]);
230 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMinScale());
231 REPORTER_ASSERT(reporter, -SK_Scalar1 == perspY.getMaxScale());
235 REPORTER_ASSERT(reporter, !success && -5 * SK_Scalar1 == scales[0] && -5 * SK_Scalar1 == scales[1]);
243 REPORTER_ASSERT(reporter, invertible);
256 REPORTER_ASSERT(reporter, (minScale < 0) == (maxScale < 0));
257 REPORTER_ASSERT(reporter, (maxScale < 0) == mat.hasPerspective());
261 REPORTER_ASSERT(reporter, success == !mat.hasPerspective());
262 REPORTER_ASSERT(reporter, !success || (scales[0] == minScale && scales[1] == maxScale));
286 REPORTER_ASSERT(reporter, d / maxScale < gVectorScaleTol);
287 REPORTER_ASSERT(reporter, minScale / d < gVectorScaleTol);
295 REPORTER_ASSERT(reporter, max / maxScale >= gCloseScaleTol);
296 REPORTER_ASSERT(reporter, minScale / min >= gCloseScaleTol);
300 static void test_matrix_preserve_shape(skiatest::Reporter* reporter) {
305 REPORTER_ASSERT(reporter, mat.isSimilarity());
306 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
311 REPORTER_ASSERT(reporter, mat.isSimilarity());
312 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
317 REPORTER_ASSERT(reporter, mat.isSimilarity());
318 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
323 REPORTER_ASSERT(reporter, mat.isSimilarity());
324 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
329 REPORTER_ASSERT(reporter, !mat.isSimilarity());
330 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
336 REPORTER_ASSERT(reporter, mat.isSimilarity());
337 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
343 REPORTER_ASSERT(reporter, !mat.isSimilarity());
344 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
349 REPORTER_ASSERT(reporter, !mat.isSimilarity());
350 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
355 REPORTER_ASSERT(reporter, !mat.isSimilarity());
356 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
362 REPORTER_ASSERT(reporter, !mat.isSimilarity());
363 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
369 REPORTER_ASSERT(reporter, !mat.isSimilarity());
370 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
375 REPORTER_ASSERT(reporter, !mat.isSimilarity());
376 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
381 REPORTER_ASSERT(reporter, !mat.isSimilarity());
382 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
388 REPORTER_ASSERT(reporter, mat.isSimilarity());
389 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
397 REPORTER_ASSERT(reporter, mat.isSimilarity());
398 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
404 REPORTER_ASSERT(reporter, mat.isSimilarity());
405 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
411 REPORTER_ASSERT(reporter, mat.isSimilarity());
412 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
418 REPORTER_ASSERT(reporter, !mat.isSimilarity());
419 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
425 REPORTER_ASSERT(reporter, !mat.isSimilarity());
426 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
430 REPORTER_ASSERT(reporter, !mat.isSimilarity());
431 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
436 REPORTER_ASSERT(reporter, !mat.isSimilarity());
437 REPORTER_ASSERT(reporter, !mat.preservesRightAngles());
443 REPORTER_ASSERT(reporter, mat.isSimilarity());
444 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
450 REPORTER_ASSERT(reporter, mat.isSimilarity());
451 REPORTER_ASSERT(reporter, mat.preservesRightAngles());
499 static void test_matrix_decomposition(skiatest::Reporter* reporter) {
510 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
511 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
513 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, nullptr, nullptr, nullptr));
517 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
518 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
522 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
523 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
527 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
528 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
533 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
534 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));
545 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
546 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
551 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
552 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
557 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
558 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
563 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
564 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));
575 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
576 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
582 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
583 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
589 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
590 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
596 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
597 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
611 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
616 REPORTER_ASSERT(reporter, SkScalarNearlyZero(perpdot));
622 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
623 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
629 REPORTER_ASSERT(reporter, SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
630 REPORTER_ASSERT(reporter, check_matrix_recomposition(mat, rotation1, scale, rotation2));
636 REPORTER_ASSERT(reporter, !SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
639 REPORTER_ASSERT(reporter, !SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
646 REPORTER_ASSERT(reporter, !SkDecomposeUpper2x2(mat, &rotation1, &scale, &rotation2));
673 static void test_matrix_homogeneous(skiatest::Reporter* reporter) {
707 REPORTER_ASSERT(reporter, scalar_array_nearly_equal_relative(randTriples, dst, kTripleCount*3));
717 REPORTER_ASSERT(reporter, scalar_array_nearly_equal_relative(&dst[i*3], zeros, 3));
727 REPORTER_ASSERT(reporter, scalar_array_nearly_equal_relative(dst, zeros, 3));
745 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[0], pnt.fX));
746 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[1], pnt.fY));
747 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[2], SK_Scalar1));
759 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[0], pnt.fX));
760 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[1], pnt.fY));
761 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[2], SK_Scalar1));
775 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[0], pnt.fX));
776 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[1], pnt.fY));
777 REPORTER_ASSERT(reporter, SkScalarNearlyEqual(dst[2], SK_Scalar1));
786 REPORTER_ASSERT(reporter, naive_homogeneous_mapping(mats[i], &randTriples[j*3], dst));
807 static void test_decompScale(skiatest::Reporter* reporter) {
811 REPORTER_ASSERT(reporter, check_decompScale(m));
813 REPORTER_ASSERT(reporter, check_decompScale(m));
815 REPORTER_ASSERT(reporter, check_decompScale(m));
818 REPORTER_ASSERT(reporter, !check_decompScale(m));
821 DEF_TEST(Matrix, reporter) {
826 REPORTER_ASSERT(reporter, mat.invert(&inverse));
828 REPORTER_ASSERT(reporter, is_identity(iden1));
831 REPORTER_ASSERT(reporter, mat.invert(&inverse));
833 REPORTER_ASSERT(reporter, is_identity(iden1));
834 test_flatten(reporter, mat);
837 REPORTER_ASSERT(reporter, mat.invert(&inverse));
839 REPORTER_ASSERT(reporter, is_identity(iden1));
840 test_flatten(reporter, mat);
844 REPORTER_ASSERT(reporter, mat.invert(nullptr));
845 REPORTER_ASSERT(reporter, mat.invert(&inverse));
847 REPORTER_ASSERT(reporter, is_identity(iden1));
849 REPORTER_ASSERT(reporter, is_identity(iden2));
850 test_flatten(reporter, mat);
851 test_flatten(reporter, iden2);
854 REPORTER_ASSERT(reporter, !mat.invert(nullptr));
855 REPORTER_ASSERT(reporter, !mat.invert(&inverse));
857 REPORTER_ASSERT(reporter, !mat.invert(nullptr));
858 REPORTER_ASSERT(reporter, !mat.invert(&inverse));
864 REPORTER_ASSERT(reporter, !mat.invert(nullptr));
865 REPORTER_ASSERT(reporter, !mat.invert(&inverse));
900 REPORTER_ASSERT(reporter,
913 REPORTER_ASSERT(reporter, mat.asAffine(affine));
916 REPORTER_ASSERT(reporter, affineEqual(ScaleX));
917 REPORTER_ASSERT(reporter, affineEqual(SkewY));
918 REPORTER_ASSERT(reporter, affineEqual(SkewX));
919 REPORTER_ASSERT(reporter, affineEqual(ScaleY));
920 REPORTER_ASSERT(reporter, affineEqual(TransX));
921 REPORTER_ASSERT(reporter, affineEqual(TransY));
925 REPORTER_ASSERT(reporter, !mat.asAffine(affine));
932 REPORTER_ASSERT(reporter, are_equal(reporter, mat, mat2));
938 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2));
940 test_matrix_min_max_scale(reporter);
941 test_matrix_preserve_shape(reporter);
942 test_matrix_recttorect(reporter);
943 test_matrix_decomposition(reporter);
944 test_matrix_homogeneous(reporter);
945 test_set9(reporter);
947 test_decompScale(reporter);
952 REPORTER_ASSERT(reporter, mat == mat2);