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

Side by Side Diff: ui/base/test/ios/ui_image_test_utils_unittest.mm

Issue 2645653003: Expose thumbnails of pages to iOS share extensions. (Closed)
Patch Set: Addressed marq's comments. Created 3 years, 10 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ui/base/test/ios/ui_image_test_utils.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 namespace ui {
10 namespace test {
11
12 // Test the creation of UIImages.
13 TEST(UIImageTestUtilsTest, TestImageCreation) {
14 CGSize size = CGSizeMake(10, 10);
15 UIImage* image =
16 uiimage_utils::UIImageWithSizeAndSolidColor(size, [UIColor redColor]);
17 EXPECT_TRUE(CGSizeEqualToSize(size, image.size));
18 }
19
20 // Test the detection of identical UIImages.
21 TEST(UIImageTestUtilsTest, TestImageEquality) {
22 CGSize size10x10 = CGSizeMake(10, 10);
23 CGSize size5x20 = CGSizeMake(5, 20);
24 UIColor* green = [UIColor greenColor];
25 UIColor* blue = [UIColor blueColor];
26
27 UIImage* imageblue10x10 =
28 uiimage_utils::UIImageWithSizeAndSolidColor(size10x10, blue);
29 UIImage* imageblue5x20 =
30 uiimage_utils::UIImageWithSizeAndSolidColor(size5x20, blue);
31 UIImage* imageGreen10x10 =
32 uiimage_utils::UIImageWithSizeAndSolidColor(size10x10, green);
33 UIImage* imageGreen10x10Bis =
34 uiimage_utils::UIImageWithSizeAndSolidColor(size10x10, green);
35
36 // Test with |nil| parameters.
37 EXPECT_TRUE(uiimage_utils::UIImagesAreEqual(nil, nil));
38 EXPECT_FALSE(uiimage_utils::UIImagesAreEqual(nil, imageblue10x10));
39 EXPECT_FALSE(uiimage_utils::UIImagesAreEqual(imageblue10x10, nil));
40
41 // Test with images with different sizes (but same amount of pixels), same
42 // color.
43 EXPECT_FALSE(uiimage_utils::UIImagesAreEqual(imageblue10x10, imageblue5x20));
44
45 // Test with images with same size, different color.
46 EXPECT_FALSE(
47 uiimage_utils::UIImagesAreEqual(imageblue10x10, imageGreen10x10));
48
49 // Test with images with same size, same color.
50 EXPECT_TRUE(
51 uiimage_utils::UIImagesAreEqual(imageGreen10x10, imageGreen10x10Bis));
52 }
53
54 } // namespace test
55 } // namespace ui
OLDNEW
« ui/base/test/ios/ui_image_test_utils.mm ('K') | « ui/base/test/ios/ui_image_test_utils.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698