diff options
author | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 22:34:14 +0000 |
---|---|---|
committer | szym@chromium.org <szym@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 22:34:14 +0000 |
commit | dfb88abf7d2927d4adb134de2b8fb01a0c897fd0 (patch) | |
tree | a3ad3e689be2d4de7072897393bcc9fd502c4b5b /ui/gfx/render_text_unittest.cc | |
parent | 36a18e4205e3fed5dcceb5c261ed959686f87f95 (diff) | |
download | chromium_src-dfb88abf7d2927d4adb134de2b8fb01a0c897fd0.zip chromium_src-dfb88abf7d2927d4adb134de2b8fb01a0c897fd0.tar.gz chromium_src-dfb88abf7d2927d4adb134de2b8fb01a0c897fd0.tar.bz2 |
Revert of https://codereview.chromium.org/107513011/
Reason for revert: Test fails on main waterfall.
TBR=jshin@chromium.org,msw@chromium.org,pkasting@chromium.org,skanuj@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=327833
Review URL: https://codereview.chromium.org/103053014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241050 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/render_text_unittest.cc')
-rw-r--r-- | ui/gfx/render_text_unittest.cc | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/ui/gfx/render_text_unittest.cc b/ui/gfx/render_text_unittest.cc index aa28b24..c8c50d4 100644 --- a/ui/gfx/render_text_unittest.cc +++ b/ui/gfx/render_text_unittest.cc @@ -401,92 +401,6 @@ TEST_F(RenderTextTest, RevealObscuredText) { EXPECT_EQ(valid_expect_5_and_6, render_text->GetLayoutText()); } -TEST_F(RenderTextTest, ElidedText) { - // TODO(skanuj) : Add more test cases for following - // - RenderText styles. - // - Cross interaction of truncate, elide and obscure. - // - ElideText tests from text_elider.cc. - struct { - const wchar_t* text; - const wchar_t* layout_text; - } cases[] = { - // Strings shorter than the elision width should be laid out in full. - { L"" , L"" }, - { kWeak , kWeak }, - { kLtr , kLtr }, - { kLtrRtl , kLtrRtl }, - { kLtrRtlLtr , kLtrRtlLtr }, - { kRtl , kRtl }, - { kRtlLtr , kRtlLtr }, - { kRtlLtrRtl , kRtlLtrRtl }, - // Strings as long as the elision width should be laid out in full. - { L"012ab", L"012ab" }, - // Long strings should be elided with an ellipsis appended at the end. - { L"012" L"abc" , L"012a\x2026" }, - { L"012" L"ab" L"\x5d0\x5d1" , L"012a\x2026" }, - { L"012" L"a" L"\x5d1" L"b" , L"012a\x2026" }, - // No RLM marker added as digits (012) have weak directionality. - { L"01" L"\x5d0\x5d1\x5d2" L"ab" , L"01\x5d0\x5d1\x2026" }, - // RLM marker added as "ab" have strong LTR directionality. - { L"ab" L"\x5d0\x5d1\x5d2" L"ab" , L"ab\x5d0\x5d1\x2026\x200f" }, - // Complex script is not handled. In this example, the "\x0915\x093f" is a - // compound glyph, but only half of it is elided. - { L"0123\x0915\x093f" L"abcd" , L"0123\x0915\x2026" }, - // Surrogate pairs should be elided reasonably enough. - { L"0\x05e9\x05bc\x05c1\x05b8" , L"0\x05e9\x05bc\x05c1\x05b8" }, - { L"0\x05e9\x05bc\x05c1\x05b8" L"ab" , L"0\x05e9\x05bc\x2026" }, - { L"01\x05e9\x05bc\x05c1\x05b8" L"ab" , L"01\x05e9\x2026" }, - { L"012\x05e9\x05bc\x05c1\x05b8" L"ab" , L"012\x2026" }, - { L"012\xF0\x9D\x84\x9E" , L"012\xF0\x2026" }, - }; - - scoped_ptr<RenderText> expected_render_text(RenderText::CreateInstance()); - expected_render_text->SetFontList(FontList("serif, Sans serif, 12px")); - expected_render_text->SetDisplayRect(gfx::Rect(0, 0, 9999, 100)); - - scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); - render_text->SetFontList(FontList("serif, Sans serif, 12px")); - render_text->SetElideBehavior(gfx::ELIDE_AT_END); - for (size_t i = 0; i < ARRAYSIZE_UNSAFE(cases); i++) { - expected_render_text->SetText(WideToUTF16(cases[i].layout_text)); - int expected_width = expected_render_text->GetContentWidth(); - render_text->SetText(WideToUTF16(cases[i].text)); -#if defined(OS_WIN) - // TODO(skanuj): It seems in some cases (on Windows XP), the original text - // is shorter than the elided text. Those cases should be modified by - // adding extra chars in the end. Currently this problem happens for the - // following test case: - // { L"012\xF0\x9D\x84\x9E" , L"012\xF0\x2026" }, - int original_width = render_text->GetContentWidth(); - if ((base::win::GetVersion() < base::win::VERSION_VISTA) && - (expected_width >= original_width)) - continue; -#endif - render_text->SetDisplayRect(gfx::Rect(0, 0, expected_width, 100)); - EXPECT_EQ(WideToUTF16(cases[i].text), render_text->text()); - EXPECT_EQ(WideToUTF16(cases[i].layout_text), render_text->GetLayoutText()) - << "->For case " << i << ": " << cases[i].text << "\n"; - expected_render_text->SetText(base::string16()); - } -} - -TEST_F(RenderTextTest, ElidedObscuredText) { - scoped_ptr<RenderText> expected_render_text(RenderText::CreateInstance()); - expected_render_text->SetFontList(FontList("serif, Sans serif, 12px")); - expected_render_text->SetDisplayRect(gfx::Rect(0, 0, 9999, 100)); - expected_render_text->SetText(WideToUTF16(L"**\x2026")); - - scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); - render_text->SetFontList(FontList("serif, Sans serif, 12px")); - render_text->SetElideBehavior(gfx::ELIDE_AT_END); - render_text->SetDisplayRect( - gfx::Rect(0, 0, expected_render_text->GetContentWidth(), 100)); - render_text->SetObscured(true); - render_text->SetText(WideToUTF16(L"abcdef")); - EXPECT_EQ(WideToUTF16(L"abcdef"), render_text->text()); - EXPECT_EQ(WideToUTF16(L"**\x2026"), render_text->GetLayoutText()); -} - TEST_F(RenderTextTest, TruncatedText) { struct { const wchar_t* text; |