| OLD | NEW |
| 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 // Unit tests for eliding and formatting utility functions. | 5 // Unit tests for eliding and formatting utility functions. |
| 6 | 6 |
| 7 #include "ui/gfx/text_elider.h" | 7 #include "ui/gfx/text_elider.h" |
| 8 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/gfx/font.h" | 15 #include "ui/gfx/font.h" |
| 16 #include "ui/gfx/font_list.h" | 16 #include "ui/gfx/font_list.h" |
| 17 #include "ui/gfx/text_utils.h" | 17 #include "ui/gfx/text_utils.h" |
| 18 #include "url/gurl.h" | 18 #include "url/gurl.h" |
| 19 | 19 |
| 20 using base::ASCIIToUTF16; | 20 using base::ASCIIToUTF16; |
| 21 using base::UTF16ToUTF8; | 21 using base::UTF16ToUTF8; |
| 22 using base::UTF16ToWide; |
| 22 using base::UTF8ToUTF16; | 23 using base::UTF8ToUTF16; |
| 23 using base::WideToUTF16; | 24 using base::WideToUTF16; |
| 24 | 25 |
| 25 namespace gfx { | 26 namespace gfx { |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| 28 | 29 |
| 29 struct Testcase { | 30 struct Testcase { |
| 30 const std::string input; | 31 const std::string input; |
| 31 const std::string output; | 32 const std::string output; |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 | 968 |
| 968 // Test adds ... at right spot when there is not enough room to break at a | 969 // Test adds ... at right spot when there is not enough room to break at a |
| 969 // word boundary. | 970 // word boundary. |
| 970 EXPECT_EQ(L"foooooey\x2026", UTF16ToWide(TruncateString(string, 11))); | 971 EXPECT_EQ(L"foooooey\x2026", UTF16ToWide(TruncateString(string, 11))); |
| 971 | 972 |
| 972 // Test completely truncates string if break is on initial whitespace. | 973 // Test completely truncates string if break is on initial whitespace. |
| 973 EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(ASCIIToUTF16(" "), 2))); | 974 EXPECT_EQ(L"\x2026", UTF16ToWide(TruncateString(ASCIIToUTF16(" "), 2))); |
| 974 } | 975 } |
| 975 | 976 |
| 976 } // namespace gfx | 977 } // namespace gfx |
| OLD | NEW |