Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: tests/MatrixTest.cpp

Issue 100113004: Use DEFINE_TESTCLASS_SHORT macro in tests. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/Matrix44Test.cpp ('k') | tests/MemsetTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1
2 /* 1 /*
3 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
4 * 3 *
5 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 5 * found in the LICENSE file.
7 */ 6 */
7
8 #include "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h"
9 #include "SkMath.h" 10 #include "SkMath.h"
10 #include "SkMatrix.h" 11 #include "SkMatrix.h"
11 #include "SkMatrixUtils.h" 12 #include "SkMatrixUtils.h"
12 #include "SkRandom.h" 13 #include "SkRandom.h"
13 14
14 static bool nearly_equal_scalar(SkScalar a, SkScalar b) { 15 static bool nearly_equal_scalar(SkScalar a, SkScalar b) {
15 // Note that we get more compounded error for multiple operations when 16 // Note that we get more compounded error for multiple operations when
16 // SK_SCALAR_IS_FIXED. 17 // SK_SCALAR_IS_FIXED.
17 #ifdef SK_SCALAR_IS_FLOAT 18 #ifdef SK_SCALAR_IS_FLOAT
18 const SkScalar tolerance = SK_Scalar1 / 200000; 19 const SkScalar tolerance = SK_Scalar1 / 200000;
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 for (int j = 0; j < kTripleCount; ++j) { 683 for (int j = 0; j < kTripleCount; ++j) {
683 SkScalar dst[3]; 684 SkScalar dst[3];
684 mats[i].mapHomogeneousPoints(dst, &randTriples[j*3], 1); 685 mats[i].mapHomogeneousPoints(dst, &randTriples[j*3], 1);
685 REPORTER_ASSERT(reporter, naive_homogeneous_mapping(mats[i], &randTr iples[j*3], dst)); 686 REPORTER_ASSERT(reporter, naive_homogeneous_mapping(mats[i], &randTr iples[j*3], dst));
686 } 687 }
687 } 688 }
688 } 689 }
689 690
690 } 691 }
691 692
692 static void TestMatrix(skiatest::Reporter* reporter) { 693 DEF_TEST(Matrix, reporter) {
693 SkMatrix mat, inverse, iden1, iden2; 694 SkMatrix mat, inverse, iden1, iden2;
694 695
695 mat.reset(); 696 mat.reset();
696 mat.setTranslate(SK_Scalar1, SK_Scalar1); 697 mat.setTranslate(SK_Scalar1, SK_Scalar1);
697 REPORTER_ASSERT(reporter, mat.invert(&inverse)); 698 REPORTER_ASSERT(reporter, mat.invert(&inverse));
698 iden1.setConcat(mat, inverse); 699 iden1.setConcat(mat, inverse);
699 REPORTER_ASSERT(reporter, is_identity(iden1)); 700 REPORTER_ASSERT(reporter, is_identity(iden1));
700 701
701 mat.setScale(SkIntToScalar(2), SkIntToScalar(4)); 702 mat.setScale(SkIntToScalar(2), SkIntToScalar(4));
702 REPORTER_ASSERT(reporter, mat.invert(&inverse)); 703 REPORTER_ASSERT(reporter, mat.invert(&inverse));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 #else 806 #else
806 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2)); 807 REPORTER_ASSERT(reporter, !are_equal(reporter, mat, mat2));
807 #endif 808 #endif
808 809
809 test_matrix_min_max_stretch(reporter); 810 test_matrix_min_max_stretch(reporter);
810 test_matrix_is_similarity(reporter); 811 test_matrix_is_similarity(reporter);
811 test_matrix_recttorect(reporter); 812 test_matrix_recttorect(reporter);
812 test_matrix_decomposition(reporter); 813 test_matrix_decomposition(reporter);
813 test_matrix_homogeneous(reporter); 814 test_matrix_homogeneous(reporter);
814 } 815 }
815
816 #include "TestClassDef.h"
817 DEFINE_TESTCLASS("Matrix", MatrixTestClass, TestMatrix)
OLDNEW
« no previous file with comments | « tests/Matrix44Test.cpp ('k') | tests/MemsetTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698