OLD | NEW |
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 "base/file_path.h" | 5 #include "base/file_path.h" |
6 #include "base/i18n/rtl.h" | 6 #include "base/i18n/rtl.h" |
7 #include "base/scoped_ptr.h" | 7 #include "base/scoped_ptr.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "ui/base/text/text_elider.h" | 12 #include "ui/base/text/text_elider.h" |
13 #include "ui/gfx/font.h" | 13 #include "ui/gfx/font.h" |
14 | 14 |
15 namespace ui { | 15 namespace ui { |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 // U+2026 in utf8 | |
20 const char kEllipsis[] = "\xe2\x80\xa6"; | |
21 | |
22 struct Testcase { | 19 struct Testcase { |
23 const std::string input; | 20 const std::string input; |
24 const std::string output; | 21 const std::string output; |
25 }; | 22 }; |
26 | 23 |
27 struct FileTestcase { | 24 struct FileTestcase { |
28 const FilePath::StringType input; | 25 const FilePath::StringType input; |
29 const std::string output; | 26 const std::string output; |
30 }; | 27 }; |
31 | 28 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 " aaaaa")); | 432 " aaaaa")); |
436 const string16 out(UTF8ToUTF16( | 433 const string16 out(UTF8ToUTF16( |
437 "\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\n" | 434 "\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\xF0\x9D\x92\x9C\n" |
438 "\xF0\x9D\x92\x9C \naaa\n...")); | 435 "\xF0\x9D\x92\x9C \naaa\n...")); |
439 string16 output; | 436 string16 output; |
440 EXPECT_TRUE(ui::ElideRectangleString(str, 3, 3, &output)); | 437 EXPECT_TRUE(ui::ElideRectangleString(str, 3, 3, &output)); |
441 EXPECT_EQ(out, output); | 438 EXPECT_EQ(out, output); |
442 } | 439 } |
443 | 440 |
444 } // namespace ui | 441 } // namespace ui |
OLD | NEW |