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

Side by Side Diff: ui/gfx/image/image_mac_unittest.mm

Issue 10933083: Remove deprecated gfx::Image::operator NSImage*(). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments and merge Created 8 years, 3 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 | « ui/gfx/image/image.cc ('k') | webkit/glue/webcursor_mac.mm » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <Cocoa/Cocoa.h> 5 #include <Cocoa/Cocoa.h>
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_nsobject.h" 8 #include "base/memory/scoped_nsobject.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gfx/image/image.h" 10 #include "ui/gfx/image/image.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 image_skia.AddRepresentation(gfx::ImageSkiaRep( 153 image_skia.AddRepresentation(gfx::ImageSkiaRep(
154 gt::CreateBitmap(kWidth1x, kHeight1x), ui::SCALE_FACTOR_100P)); 154 gt::CreateBitmap(kWidth1x, kHeight1x), ui::SCALE_FACTOR_100P));
155 image_skia.AddRepresentation(gfx::ImageSkiaRep( 155 image_skia.AddRepresentation(gfx::ImageSkiaRep(
156 gt::CreateBitmap(kWidth2x, kHeight2x), ui::SCALE_FACTOR_200P)); 156 gt::CreateBitmap(kWidth2x, kHeight2x), ui::SCALE_FACTOR_200P));
157 157
158 gfx::Image image(image_skia); 158 gfx::Image image(image_skia);
159 159
160 EXPECT_EQ(1u, image.RepresentationCount()); 160 EXPECT_EQ(1u, image.RepresentationCount());
161 EXPECT_EQ(2u, image.ToImageSkia()->image_reps().size()); 161 EXPECT_EQ(2u, image.ToImageSkia()->image_reps().size());
162 162
163 NSImage* ns_image = image; 163 NSImage* ns_image = image.ToNSImage();
164 EXPECT_TRUE(ns_image); 164 EXPECT_TRUE(ns_image);
165 165
166 // Image size should be the same as the 1x bitmap. 166 // Image size should be the same as the 1x bitmap.
167 EXPECT_EQ([ns_image size].width, kWidth1x); 167 EXPECT_EQ([ns_image size].width, kWidth1x);
168 EXPECT_EQ([ns_image size].height, kHeight1x); 168 EXPECT_EQ([ns_image size].height, kHeight1x);
169 169
170 EXPECT_EQ(2u, [[image representations] count]); 170 EXPECT_EQ(2u, [[ns_image representations] count]);
171 NSImageRep* ns_image_rep1 = [[image representations] objectAtIndex:0]; 171 NSImageRep* ns_image_rep1 = [[ns_image representations] objectAtIndex:0];
172 NSImageRep* ns_image_rep2 = [[image representations] objectAtIndex:1]; 172 NSImageRep* ns_image_rep2 = [[ns_image representations] objectAtIndex:1];
173 173
174 if ([ns_image_rep1 size].width == kWidth1x) { 174 if ([ns_image_rep1 size].width == kWidth1x) {
175 EXPECT_EQ([ns_image_rep1 size].width, kWidth1x); 175 EXPECT_EQ([ns_image_rep1 size].width, kWidth1x);
176 EXPECT_EQ([ns_image_rep1 size].height, kHeight1x); 176 EXPECT_EQ([ns_image_rep1 size].height, kHeight1x);
177 EXPECT_EQ([ns_image_rep2 size].width, kWidth2x); 177 EXPECT_EQ([ns_image_rep2 size].width, kWidth2x);
178 EXPECT_EQ([ns_image_rep2 size].height, kHeight2x); 178 EXPECT_EQ([ns_image_rep2 size].height, kHeight2x);
179 } else { 179 } else {
180 EXPECT_EQ([ns_image_rep1 size].width, kWidth2x); 180 EXPECT_EQ([ns_image_rep1 size].width, kWidth2x);
181 EXPECT_EQ([ns_image_rep1 size].height, kHeight2x); 181 EXPECT_EQ([ns_image_rep1 size].height, kHeight2x);
182 EXPECT_EQ([ns_image_rep2 size].width, kWidth1x); 182 EXPECT_EQ([ns_image_rep2 size].width, kWidth1x);
183 EXPECT_EQ([ns_image_rep2 size].height, kHeight1x); 183 EXPECT_EQ([ns_image_rep2 size].height, kHeight1x);
184 } 184 }
185 185
186 // Cast to NSImage* should create a second representation. 186 // Cast to NSImage* should create a second representation.
187 EXPECT_EQ(2u, image.RepresentationCount()); 187 EXPECT_EQ(2u, image.RepresentationCount());
188 } 188 }
189 189
190 } // namespace 190 } // namespace
OLDNEW
« no previous file with comments | « ui/gfx/image/image.cc ('k') | webkit/glue/webcursor_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698