OLD | NEW |
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 "Test.h" | 8 #include "Test.h" |
9 #include "SkMatrix44.h" | 9 #include "SkMatrix44.h" |
10 | 10 |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 rot.setRotateDegreesAbout(0, 0, -1, 90); | 409 rot.setRotateDegreesAbout(0, 0, -1, 90); |
410 mat.postConcat(rot); | 410 mat.postConcat(rot); |
411 mat.postTranslate(1.0e-12, 1.0e-12, 1.0e-12); | 411 mat.postTranslate(1.0e-12, 1.0e-12, 1.0e-12); |
412 REPORTER_ASSERT(reporter, mat.invert(NULL)); | 412 REPORTER_ASSERT(reporter, mat.invert(NULL)); |
413 mat.invert(&inverse); | 413 mat.invert(&inverse); |
414 iden1.setConcat(mat, inverse); | 414 iden1.setConcat(mat, inverse); |
415 REPORTER_ASSERT(reporter, is_identity(iden1)); | 415 REPORTER_ASSERT(reporter, is_identity(iden1)); |
416 | 416 |
417 // test mixed-valued matrix inverse | 417 // test mixed-valued matrix inverse |
418 mat.reset(); | 418 mat.reset(); |
419 mat.setScale(1.0e-11, 3.0, 1.0e+11); | 419 mat.setScale(1.0e-10, 3.0, 1.0e+10); |
420 rot.setRotateDegreesAbout(0, 0, -1, 90); | 420 rot.setRotateDegreesAbout(0, 0, -1, 90); |
421 mat.postConcat(rot); | 421 mat.postConcat(rot); |
422 mat.postTranslate(1.0e+11, 3.0, 1.0e-11); | 422 mat.postTranslate(1.0e+10, 3.0, 1.0e-10); |
423 REPORTER_ASSERT(reporter, mat.invert(NULL)); | 423 REPORTER_ASSERT(reporter, mat.invert(NULL)); |
424 mat.invert(&inverse); | 424 mat.invert(&inverse); |
425 iden1.setConcat(mat, inverse); | 425 iden1.setConcat(mat, inverse); |
426 REPORTER_ASSERT(reporter, is_identity(iden1)); | 426 REPORTER_ASSERT(reporter, is_identity(iden1)); |
427 | 427 |
428 // test degenerate matrix | 428 // test degenerate matrix |
429 mat.reset(); | 429 mat.reset(); |
430 mat.set3x3(1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0); | 430 mat.set3x3(1.0, 1.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 0.0); |
431 REPORTER_ASSERT(reporter, !mat.invert(NULL)); | 431 REPORTER_ASSERT(reporter, !mat.invert(NULL)); |
432 | 432 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 test_transpose(reporter); | 471 test_transpose(reporter); |
472 test_get_set_double(reporter); | 472 test_get_set_double(reporter); |
473 test_set_row_col_major(reporter); | 473 test_set_row_col_major(reporter); |
474 test_translate(reporter); | 474 test_translate(reporter); |
475 test_scale(reporter); | 475 test_scale(reporter); |
476 test_map2(reporter); | 476 test_map2(reporter); |
477 } | 477 } |
478 | 478 |
479 #include "TestClassDef.h" | 479 #include "TestClassDef.h" |
480 DEFINE_TESTCLASS("Matrix44", Matrix44TestClass, TestMatrix44) | 480 DEFINE_TESTCLASS("Matrix44", Matrix44TestClass, TestMatrix44) |
OLD | NEW |