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

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

Issue 7633055: base: Fix the TODO in string_util.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome_mini_installer.cc Created 9 years, 4 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 | « net/base/cookie_monster.cc ('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 // 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
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/file_util.h" 12 #include "base/file_util.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/stringprintf.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #include "skia/ext/vector_canvas.h" 17 #include "skia/ext/vector_canvas.h"
17 #include "skia/ext/vector_platform_device_emf_win.h" 18 #include "skia/ext/vector_platform_device_emf_win.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 #include "third_party/skia/include/effects/SkDashPathEffect.h" 20 #include "third_party/skia/include/effects/SkDashPathEffect.h"
20 #include "ui/gfx/codec/png_codec.h" 21 #include "ui/gfx/codec/png_codec.h"
21 #include "ui/gfx/size.h" 22 #include "ui/gfx/size.h"
22 23
23 namespace skia { 24 namespace skia {
24 25
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 pcanvas_ = new PlatformCanvas(size_, size_, false); 395 pcanvas_ = new PlatformCanvas(size_, size_, false);
395 396
396 // Clear white. 397 // Clear white.
397 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); 398 vcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
398 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode); 399 pcanvas_->drawARGB(255, 255, 255, 255, SkXfermode::kSrc_Mode);
399 } 400 }
400 401
401 // Compares both canvas and returns the pixel difference in percentage between 402 // Compares both canvas and returns the pixel difference in percentage between
402 // both images. 0 on success and ]0, 100] on failure. 403 // both images. 0 on success and ]0, 100] on failure.
403 double ProcessImage(const FilePath::StringType& filename) { 404 double ProcessImage(const FilePath::StringType& filename) {
404 std::wstring number(StringPrintf(L"%02d_", number_++)); 405 std::wstring number(base::StringPrintf(L"%02d_", number_++));
405 double diff1 = parent::ProcessCanvas(*vcanvas_, number + L"vc_" + filename); 406 double diff1 = parent::ProcessCanvas(*vcanvas_, number + L"vc_" + filename);
406 double diff2 = parent::ProcessCanvas(*pcanvas_, number + L"pc_" + filename); 407 double diff2 = parent::ProcessCanvas(*pcanvas_, number + L"pc_" + filename);
407 if (!compare_canvas_) 408 if (!compare_canvas_)
408 return std::max(diff1, diff2); 409 return std::max(diff1, diff2);
409 410
410 Image image1(*vcanvas_); 411 Image image1(*vcanvas_);
411 Image image2(*pcanvas_); 412 Image image2(*pcanvas_);
412 double diff = image1.PercentageDifferent(image2); 413 double diff = image1.PercentageDifferent(image2);
413 return std::max(std::max(diff1, diff2), diff); 414 return std::max(std::max(diff1, diff2), diff);
414 } 415 }
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 { 971 {
971 vcanvas_->rotate(67); 972 vcanvas_->rotate(67);
972 pcanvas_->rotate(67); 973 pcanvas_->rotate(67);
973 vcanvas_->drawBitmap(bitmap, 20, -50, NULL); 974 vcanvas_->drawBitmap(bitmap, 20, -50, NULL);
974 pcanvas_->drawBitmap(bitmap, 20, -50, NULL); 975 pcanvas_->drawBitmap(bitmap, 20, -50, NULL);
975 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate"))); 976 EXPECT_EQ(0., ProcessImage(FILE_PATH_LITERAL("rotate")));
976 } 977 }
977 } 978 }
978 979
979 } // namespace skia 980 } // namespace skia
OLDNEW
« no previous file with comments | « net/base/cookie_monster.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698