Index: ui/gfx/text_elider_unittest.cc |
diff --git a/ui/gfx/text_elider_unittest.cc b/ui/gfx/text_elider_unittest.cc |
index 8bf3f655ca0c308ab064a3467ae37a7b4c68be37..01269ae7315a949118cc4aaddd193e023f49c94f 100644 |
--- a/ui/gfx/text_elider_unittest.cc |
+++ b/ui/gfx/text_elider_unittest.cc |
@@ -14,6 +14,7 @@ |
#include "testing/gtest/include/gtest/gtest.h" |
#include "ui/gfx/font.h" |
#include "ui/gfx/font_list.h" |
+#include "ui/gfx/font_render_params.h" |
#include "ui/gfx/text_utils.h" |
using base::ASCIIToUTF16; |
@@ -676,6 +677,23 @@ TEST(TextEliderTest, MAYBE_ElideRectangleTextCheckLineWidth) { |
EXPECT_LE(GetStringWidthF(lines[1], font_list), kAvailableWidth); |
} |
+#ifdef OS_CHROMEOS |
+// This test was created specifically to test a message from crbug.com/415213. |
+// It tests that width of concatenation of words equals sum of widths of the |
+// words. |
+TEST(TextEliderTest, ElideRectangleTextCheckConcatWidthEqualsSumOfWidths) { |
+ FontList font_list; |
+ font_list = FontList("Noto Sans UI,ui-sans, 12px"); |
+ SetFontRenderParamsDeviceScaleFactor(1.25f); |
+#define WIDTH(x) GetStringWidthF(UTF8ToUTF16(x), font_list) |
+ EXPECT_EQ(WIDTH("The administrator for this account has"), |
+ WIDTH("The ") + WIDTH("administrator ") + WIDTH("for ") + |
+ WIDTH("this ") + WIDTH("account ") + WIDTH("has")); |
+#undef WIDTH |
+ SetFontRenderParamsDeviceScaleFactor(1.0f); |
+} |
+#endif // OS_CHROMEOS |
+ |
TEST(TextEliderTest, ElideRectangleString) { |
struct TestData { |
const char* input; |