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

Side by Side Diff: ui/gfx/range/range_mac_unittest.mm

Issue 24012002: Move Range code to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: d Created 7 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/range/range_mac.mm ('k') | ui/gfx/range/range_unittest.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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/base/range/range.h" 6 #include "ui/gfx/range/range.h"
7 7
8 TEST(RangeTest, FromNSRange) { 8 TEST(RangeTest, FromNSRange) {
9 NSRange nsr = NSMakeRange(10, 3); 9 NSRange nsr = NSMakeRange(10, 3);
10 ui::Range r(nsr); 10 gfx::Range r(nsr);
11 EXPECT_EQ(nsr.location, r.start()); 11 EXPECT_EQ(nsr.location, r.start());
12 EXPECT_EQ(13U, r.end()); 12 EXPECT_EQ(13U, r.end());
13 EXPECT_EQ(nsr.length, r.length()); 13 EXPECT_EQ(nsr.length, r.length());
14 EXPECT_FALSE(r.is_reversed()); 14 EXPECT_FALSE(r.is_reversed());
15 EXPECT_TRUE(r.IsValid()); 15 EXPECT_TRUE(r.IsValid());
16 } 16 }
17 17
18 TEST(RangeTest, ToNSRange) { 18 TEST(RangeTest, ToNSRange) {
19 ui::Range r(10, 12); 19 gfx::Range r(10, 12);
20 NSRange nsr = r.ToNSRange(); 20 NSRange nsr = r.ToNSRange();
21 EXPECT_EQ(10U, nsr.location); 21 EXPECT_EQ(10U, nsr.location);
22 EXPECT_EQ(2U, nsr.length); 22 EXPECT_EQ(2U, nsr.length);
23 } 23 }
24 24
25 TEST(RangeTest, ReversedToNSRange) { 25 TEST(RangeTest, ReversedToNSRange) {
26 ui::Range r(20, 10); 26 gfx::Range r(20, 10);
27 NSRange nsr = r.ToNSRange(); 27 NSRange nsr = r.ToNSRange();
28 EXPECT_EQ(10U, nsr.location); 28 EXPECT_EQ(10U, nsr.location);
29 EXPECT_EQ(10U, nsr.length); 29 EXPECT_EQ(10U, nsr.length);
30 } 30 }
31 31
32 TEST(RangeTest, FromNSRangeInvalid) { 32 TEST(RangeTest, FromNSRangeInvalid) {
33 NSRange nsr = NSMakeRange(NSNotFound, 0); 33 NSRange nsr = NSMakeRange(NSNotFound, 0);
34 ui::Range r(nsr); 34 gfx::Range r(nsr);
35 EXPECT_FALSE(r.IsValid()); 35 EXPECT_FALSE(r.IsValid());
36 } 36 }
37 37
38 TEST(RangeTest, ToNSRangeInvalid) { 38 TEST(RangeTest, ToNSRangeInvalid) {
39 ui::Range r(ui::Range::InvalidRange()); 39 gfx::Range r(gfx::Range::InvalidRange());
40 NSRange nsr = r.ToNSRange(); 40 NSRange nsr = r.ToNSRange();
41 EXPECT_EQ(NSNotFound, nsr.location); 41 EXPECT_EQ(NSNotFound, nsr.location);
42 EXPECT_EQ(0U, nsr.length); 42 EXPECT_EQ(0U, nsr.length);
43 } 43 }
OLDNEW
« no previous file with comments | « ui/gfx/range/range_mac.mm ('k') | ui/gfx/range/range_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698