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

Side by Side Diff: ui/gfx/range/range_win_unittest.cc

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_win.cc ('k') | ui/gfx/render_text.h » ('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, FromCHARRANGE) { 8 TEST(RangeTest, FromCHARRANGE) {
9 CHARRANGE cr = { 10, 32 }; 9 CHARRANGE cr = { 10, 32 };
10 ui::Range r(cr, 50); 10 gfx::Range r(cr, 50);
11 EXPECT_EQ(10U, r.start()); 11 EXPECT_EQ(10U, r.start());
12 EXPECT_EQ(32U, r.end()); 12 EXPECT_EQ(32U, r.end());
13 EXPECT_EQ(22U, r.length()); 13 EXPECT_EQ(22U, 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, FromReversedCHARRANGE) { 18 TEST(RangeTest, FromReversedCHARRANGE) {
19 CHARRANGE cr = { 20, 10 }; 19 CHARRANGE cr = { 20, 10 };
20 ui::Range r(cr, 40); 20 gfx::Range r(cr, 40);
21 EXPECT_EQ(20U, r.start()); 21 EXPECT_EQ(20U, r.start());
22 EXPECT_EQ(10U, r.end()); 22 EXPECT_EQ(10U, r.end());
23 EXPECT_EQ(10U, r.length()); 23 EXPECT_EQ(10U, r.length());
24 EXPECT_TRUE(r.is_reversed()); 24 EXPECT_TRUE(r.is_reversed());
25 EXPECT_TRUE(r.IsValid()); 25 EXPECT_TRUE(r.IsValid());
26 } 26 }
27 27
28 TEST(RangeTest, FromCHARRANGETotal) { 28 TEST(RangeTest, FromCHARRANGETotal) {
29 CHARRANGE cr = { 0, -1 }; 29 CHARRANGE cr = { 0, -1 };
30 ui::Range r(cr, 20); 30 gfx::Range r(cr, 20);
31 EXPECT_EQ(0U, r.start()); 31 EXPECT_EQ(0U, r.start());
32 EXPECT_EQ(20U, r.end()); 32 EXPECT_EQ(20U, r.end());
33 EXPECT_EQ(20U, r.length()); 33 EXPECT_EQ(20U, r.length());
34 EXPECT_FALSE(r.is_reversed()); 34 EXPECT_FALSE(r.is_reversed());
35 EXPECT_TRUE(r.IsValid()); 35 EXPECT_TRUE(r.IsValid());
36 } 36 }
37 37
38 TEST(RangeTest, ToCHARRANGE) { 38 TEST(RangeTest, ToCHARRANGE) {
39 ui::Range r(10, 30); 39 gfx::Range r(10, 30);
40 CHARRANGE cr = r.ToCHARRANGE(); 40 CHARRANGE cr = r.ToCHARRANGE();
41 EXPECT_EQ(10, cr.cpMin); 41 EXPECT_EQ(10, cr.cpMin);
42 EXPECT_EQ(30, cr.cpMax); 42 EXPECT_EQ(30, cr.cpMax);
43 } 43 }
44 44
45 TEST(RangeTest, ReversedToCHARRANGE) { 45 TEST(RangeTest, ReversedToCHARRANGE) {
46 ui::Range r(20, 10); 46 gfx::Range r(20, 10);
47 CHARRANGE cr = r.ToCHARRANGE(); 47 CHARRANGE cr = r.ToCHARRANGE();
48 EXPECT_EQ(20U, cr.cpMin); 48 EXPECT_EQ(20U, cr.cpMin);
49 EXPECT_EQ(10U, cr.cpMax); 49 EXPECT_EQ(10U, cr.cpMax);
50 } 50 }
51 51
52 TEST(RangeTest, FromCHARRANGEInvalid) { 52 TEST(RangeTest, FromCHARRANGEInvalid) {
53 CHARRANGE cr = { -1, -1 }; 53 CHARRANGE cr = { -1, -1 };
54 ui::Range r(cr, 30); 54 gfx::Range r(cr, 30);
55 EXPECT_FALSE(r.IsValid()); 55 EXPECT_FALSE(r.IsValid());
56 } 56 }
57 57
58 TEST(RangeTest, ToCHARRANGEInvalid) { 58 TEST(RangeTest, ToCHARRANGEInvalid) {
59 ui::Range r(ui::Range::InvalidRange()); 59 gfx::Range r(gfx::Range::InvalidRange());
60 CHARRANGE cr = r.ToCHARRANGE(); 60 CHARRANGE cr = r.ToCHARRANGE();
61 EXPECT_EQ(-1, cr.cpMin); 61 EXPECT_EQ(-1, cr.cpMin);
62 EXPECT_EQ(-1, cr.cpMax); 62 EXPECT_EQ(-1, cr.cpMax);
63 } 63 }
OLDNEW
« no previous file with comments | « ui/gfx/range/range_win.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698