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 #include "ui/views/controls/textfield/native_textfield_views.h" | 5 #include "ui/views/controls/textfield/native_textfield_views.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1896 | 1896 |
1897 // Create a long press event in the selected region should start a drag. | 1897 // Create a long press event in the selected region should start a drag. |
1898 GestureEventForTest long_press(ui::ET_GESTURE_LONG_PRESS, | 1898 GestureEventForTest long_press(ui::ET_GESTURE_LONG_PRESS, |
1899 kStringPoint.x(), kStringPoint.y(), 0); | 1899 kStringPoint.x(), kStringPoint.y(), 0); |
1900 textfield_view_->OnGestureEvent(&long_press); | 1900 textfield_view_->OnGestureEvent(&long_press); |
1901 EXPECT_TRUE(textfield_view_->CanStartDragForView(NULL, | 1901 EXPECT_TRUE(textfield_view_->CanStartDragForView(NULL, |
1902 kStringPoint, kStringPoint)); | 1902 kStringPoint, kStringPoint)); |
1903 } | 1903 } |
1904 | 1904 |
1905 TEST_F(NativeTextfieldViewsTest, GetTextfieldBaseline_FontFallbackTest) { | 1905 TEST_F(NativeTextfieldViewsTest, GetTextfieldBaseline_FontFallbackTest) { |
1906 #if defined(OS_WIN) | |
1907 // This test fails on some versions of Windows because two different strings | |
1908 // have the same baseline. | |
1909 if (base::win::GetVersion() <= base::win::VERSION_XP || | |
1910 base::win::VERSION_WIN8 <= base::win::GetVersion()) | |
1911 return; | |
1912 #endif | |
1913 | |
1914 InitTextfield(Textfield::STYLE_DEFAULT); | 1906 InitTextfield(Textfield::STYLE_DEFAULT); |
1915 textfield_->SetText(UTF8ToUTF16("abc")); | 1907 textfield_->SetText(UTF8ToUTF16("abc")); |
1916 const int old_baseline = textfield_->GetBaseline(); | 1908 const int old_baseline = textfield_->GetBaseline(); |
1917 | 1909 |
1918 // Set text which may fall back to a font which has taller baseline than | 1910 // Set text which may fall back to a font which has taller baseline than |
1919 // the default font. |new_baseline| will be greater than |old_baseline|. | 1911 // the default font. |
1920 textfield_->SetText(UTF8ToUTF16("\xE0\xB9\x91")); | 1912 textfield_->SetText(UTF8ToUTF16("\xE0\xB9\x91")); |
1921 const int new_baseline = textfield_->GetBaseline(); | 1913 const int new_baseline = textfield_->GetBaseline(); |
1922 | 1914 |
1923 EXPECT_GT(new_baseline, old_baseline); | 1915 // Regardless of the text, the baseline must be the same. |
| 1916 EXPECT_EQ(new_baseline, old_baseline); |
1924 } | 1917 } |
1925 | 1918 |
1926 } // namespace views | 1919 } // namespace views |
OLD | NEW |