| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 /* Description: | 8 /* Description: |
| 9 * This test defines a series of elementatry test steps that perform | 9 * This test defines a series of elementatry test steps that perform |
| 10 * a single or a small group of canvas API calls. Each test step is | 10 * a single or a small group of canvas API calls. Each test step is |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 SIMPLE_TEST_STEP(DrawData, drawData(kTestText.c_str(), kTestText.size())); | 362 SIMPLE_TEST_STEP(DrawData, drawData(kTestText.c_str(), kTestText.size())); |
| 363 SIMPLE_TEST_STEP(BeginGroup, beginCommentGroup(kTestText.c_str())); | 363 SIMPLE_TEST_STEP(BeginGroup, beginCommentGroup(kTestText.c_str())); |
| 364 SIMPLE_TEST_STEP(AddComment, addComment(kTestText.c_str(), kTestText.c_str())); | 364 SIMPLE_TEST_STEP(AddComment, addComment(kTestText.c_str(), kTestText.c_str())); |
| 365 SIMPLE_TEST_STEP(EndGroup, endCommentGroup()); | 365 SIMPLE_TEST_STEP(EndGroup, endCommentGroup()); |
| 366 | 366 |
| 367 /////////////////////////////////////////////////////////////////////////////// | 367 /////////////////////////////////////////////////////////////////////////////// |
| 368 // Complex test steps | 368 // Complex test steps |
| 369 | 369 |
| 370 // Save/restore calls cannot be in isolated simple test steps because the test | 370 // Save/restore calls cannot be in isolated simple test steps because the test |
| 371 // cases that use SkPicture require that save and restore calls be balanced. | 371 // cases that use SkPicture require that save and restore calls be balanced. |
| 372 #ifdef SK_SUPPORT_LEGACY_SAVEFLAGS |
| 372 static void SaveMatrixStep(SkCanvas* canvas, | 373 static void SaveMatrixStep(SkCanvas* canvas, |
| 373 skiatest::Reporter* reporter, | 374 skiatest::Reporter* reporter, |
| 374 CanvasTestStep* testStep) { | 375 CanvasTestStep* testStep) { |
| 375 int saveCount = canvas->getSaveCount(); | 376 int saveCount = canvas->getSaveCount(); |
| 376 canvas->save(SkCanvas::kMatrix_SaveFlag); | 377 canvas->save(SkCanvas::kMatrix_SaveFlag); |
| 377 canvas->clipRegion(kTestRegion); | 378 canvas->clipRegion(kTestRegion); |
| 378 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); | 379 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); |
| 379 canvas->restore(); | 380 canvas->restore(); |
| 380 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, | 381 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, |
| 381 testStep->assertMessage()); | 382 testStep->assertMessage()); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 393 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); | 394 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); |
| 394 canvas->clipRegion(kTestRegion); | 395 canvas->clipRegion(kTestRegion); |
| 395 canvas->restore(); | 396 canvas->restore(); |
| 396 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, | 397 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, |
| 397 testStep->assertMessage()); | 398 testStep->assertMessage()); |
| 398 REPORTER_ASSERT_MESSAGE(reporter, !canvas->getTotalMatrix().isIdentity(), | 399 REPORTER_ASSERT_MESSAGE(reporter, !canvas->getTotalMatrix().isIdentity(), |
| 399 testStep->assertMessage()); | 400 testStep->assertMessage()); |
| 400 // REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion, t
estStep->assertMessage()); | 401 // REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion, t
estStep->assertMessage()); |
| 401 } | 402 } |
| 402 TEST_STEP(SaveClip, SaveClipStep); | 403 TEST_STEP(SaveClip, SaveClipStep); |
| 404 #endif |
| 403 | 405 |
| 404 static void SaveMatrixClipStep(SkCanvas* canvas, | 406 static void SaveMatrixClipStep(SkCanvas* canvas, |
| 405 skiatest::Reporter* reporter, | 407 skiatest::Reporter* reporter, |
| 406 CanvasTestStep* testStep) { | 408 CanvasTestStep* testStep) { |
| 407 int saveCount = canvas->getSaveCount(); | 409 int saveCount = canvas->getSaveCount(); |
| 408 canvas->save(SkCanvas::kMatrixClip_SaveFlag); | 410 canvas->save(); |
| 409 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); | 411 canvas->translate(SkIntToScalar(1), SkIntToScalar(2)); |
| 410 canvas->clipRegion(kTestRegion); | 412 canvas->clipRegion(kTestRegion); |
| 411 canvas->restore(); | 413 canvas->restore(); |
| 412 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, | 414 REPORTER_ASSERT_MESSAGE(reporter, canvas->getSaveCount() == saveCount, |
| 413 testStep->assertMessage()); | 415 testStep->assertMessage()); |
| 414 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(), | 416 REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalMatrix().isIdentity(), |
| 415 testStep->assertMessage()); | 417 testStep->assertMessage()); |
| 416 // REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion, t
estStep->assertMessage()); | 418 // REPORTER_ASSERT_MESSAGE(reporter, canvas->getTotalClip() != kTestRegion, t
estStep->assertMessage()); |
| 417 } | 419 } |
| 418 TEST_STEP(SaveMatrixClip, SaveMatrixClipStep); | 420 TEST_STEP(SaveMatrixClip, SaveMatrixClipStep); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 952 if (testStepArray()[testStep]->enablePdfTesting()) { | 954 if (testStepArray()[testStep]->enablePdfTesting()) { |
| 953 TestPdfDevice(reporter, testStepArray()[testStep]); | 955 TestPdfDevice(reporter, testStepArray()[testStep]); |
| 954 } | 956 } |
| 955 } | 957 } |
| 956 | 958 |
| 957 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) | 959 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) |
| 958 kTestBitmap.reset(); | 960 kTestBitmap.reset(); |
| 959 | 961 |
| 960 test_newraster(reporter); | 962 test_newraster(reporter); |
| 961 } | 963 } |
| OLD | NEW |