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

Side by Side Diff: skia/ext/vector_canvas_unittest.cc

Issue 9416017: Optionally clear PlatformCanvas instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Address comments. Created 8 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « skia/ext/platform_canvas_win.cc ('k') | skia/ext/vector_platform_device_emf_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if !defined(OS_WIN) 7 #if !defined(OS_WIN)
8 #include <unistd.h> 8 #include <unistd.h>
9 #endif 9 #endif
10 10
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 // When true (default), vcanvas_ and pcanvas_ contents are compared and 442 // When true (default), vcanvas_ and pcanvas_ contents are compared and
443 // verified to be identical. 443 // verified to be identical.
444 bool compare_canvas_; 444 bool compare_canvas_;
445 }; 445 };
446 446
447 447
448 //////////////////////////////////////////////////////////////////////////////// 448 ////////////////////////////////////////////////////////////////////////////////
449 // Actual tests 449 // Actual tests
450 450
451 TEST_F(VectorCanvasTest, Uninitialized) {
452 // Do a little mubadumba do get uninitialized stuff.
453 VectorCanvasTest::TearDown();
454
455 // The goal is not to verify that have the same uninitialized data.
456 compare_canvas_ = false;
457
458 context_ = new Context();
459 bitmap_ = new Bitmap(*context_, size_, size_);
460 vcanvas_ = new VectorCanvas(VectorPlatformDeviceEmf::CreateDevice(
461 size_, size_, true, context_->context()));
462 pcanvas_ = new PlatformCanvas(size_, size_, false);
463
464 // VectorCanvas default initialization is black.
465 // PlatformCanvas default initialization is almost white 0x01FFFEFD (invalid
466 // Skia color) in both Debug and Release. See magicTransparencyColor in
467 // platform_device.cc
468 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("empty")));
469 }
470
471 TEST_F(VectorCanvasTest, BasicDrawing) { 451 TEST_F(VectorCanvasTest, BasicDrawing) {
472 EXPECT_EQ(Image(*vcanvas_).PercentageDifferent(Image(*pcanvas_)), 0.) 452 EXPECT_EQ(Image(*vcanvas_).PercentageDifferent(Image(*pcanvas_)), 0.)
473 << L"clean"; 453 << L"clean";
474 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("clean"))); 454 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("clean")));
475 455
476 // Clear white. 456 // Clear white.
477 { 457 {
478 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); 458 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
479 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); 459 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
480 } 460 }
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 { 951 {
972 vcanvas_->rotate(67); 952 vcanvas_->rotate(67);
973 pcanvas_->rotate(67); 953 pcanvas_->rotate(67);
974 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); 954 vcanvas_->drawBitmap(bitmap, 20, -50, NULL);
975 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); 955 pcanvas_->drawBitmap(bitmap, 20, -50, NULL);
976 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); 956 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate")));
977 } 957 }
978 } 958 }
979 959
980 } // namespace skia 960 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/platform_canvas_win.cc ('k') | skia/ext/vector_platform_device_emf_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698