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

Side by Side Diff: tests/Matrix44Test.cpp

Issue 2098583002: SkMatrix44 clarifications and clean-ups (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 months 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
« no previous file with comments | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * 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
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMatrix44.h" 8 #include "SkMatrix44.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 REPORTER_ASSERT(reporter, 477 REPORTER_ASSERT(reporter,
478 nearly_equal_double(3.141592653589793, 478 nearly_equal_double(3.141592653589793,
479 a.getDouble(row, col))); 479 a.getDouble(row, col)));
480 a.setDouble(row, col, 0); 480 a.setDouble(row, col, 0);
481 REPORTER_ASSERT(reporter, 481 REPORTER_ASSERT(reporter,
482 nearly_equal_double(0, a.getDouble(row, col))); 482 nearly_equal_double(0, a.getDouble(row, col)));
483 } 483 }
484 } 484 }
485 } 485 }
486 486
487 static void test_set_3x3(skiatest::Reporter* r) {
488 static float vals[9] = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f, 6.0f, 7.0f, 8.0f, 9.0 f, };
489
490 SkMatrix44 mat(SkMatrix44::kUninitialized_Constructor);
491 mat.set3x3RowMajorf(vals);
492
493 REPORTER_ASSERT(r, 1.0f == mat.getFloat(0, 0));
494 REPORTER_ASSERT(r, 2.0f == mat.getFloat(0, 1));
495 REPORTER_ASSERT(r, 3.0f == mat.getFloat(0, 2));
496 REPORTER_ASSERT(r, 4.0f == mat.getFloat(1, 0));
497 REPORTER_ASSERT(r, 5.0f == mat.getFloat(1, 1));
498 REPORTER_ASSERT(r, 6.0f == mat.getFloat(1, 2));
499 REPORTER_ASSERT(r, 7.0f == mat.getFloat(2, 0));
500 REPORTER_ASSERT(r, 8.0f == mat.getFloat(2, 1));
501 REPORTER_ASSERT(r, 9.0f == mat.getFloat(2, 2));
502 }
503
487 static void test_set_row_col_major(skiatest::Reporter* reporter) { 504 static void test_set_row_col_major(skiatest::Reporter* reporter) {
488 SkMatrix44 a(SkMatrix44::kUninitialized_Constructor); 505 SkMatrix44 a(SkMatrix44::kUninitialized_Constructor);
489 SkMatrix44 b(SkMatrix44::kUninitialized_Constructor); 506 SkMatrix44 b(SkMatrix44::kUninitialized_Constructor);
490 507
491 for (int row = 0; row < 4; ++row) { 508 for (int row = 0; row < 4; ++row) {
492 for (int col = 0; col < 4; ++col) { 509 for (int col = 0; col < 4; ++col) {
493 a.setDouble(row, col, row * 4 + col); 510 a.setDouble(row, col, row * 4 + col);
494 } 511 }
495 } 512 }
496 513
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 test_common_angles(reporter); 926 test_common_angles(reporter);
910 } 927 }
911 928
912 test_constructor(reporter); 929 test_constructor(reporter);
913 test_gettype(reporter); 930 test_gettype(reporter);
914 test_determinant(reporter); 931 test_determinant(reporter);
915 test_invert(reporter); 932 test_invert(reporter);
916 test_transpose(reporter); 933 test_transpose(reporter);
917 test_get_set_double(reporter); 934 test_get_set_double(reporter);
918 test_set_row_col_major(reporter); 935 test_set_row_col_major(reporter);
936 test_set_3x3(reporter);
919 test_translate(reporter); 937 test_translate(reporter);
920 test_scale(reporter); 938 test_scale(reporter);
921 test_map2(reporter); 939 test_map2(reporter);
922 test_3x3_conversion(reporter); 940 test_3x3_conversion(reporter);
923 test_has_perspective(reporter); 941 test_has_perspective(reporter);
924 test_preserves_2d_axis_alignment(reporter); 942 test_preserves_2d_axis_alignment(reporter);
925 test_toint(reporter); 943 test_toint(reporter);
926 } 944 }
OLDNEW
« no previous file with comments | « tests/ColorSpaceTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698