Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(370)

Unified Diff: ui/gfx/text_elider_unittest.cc

Issue 614103007: Error in popup on Link (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update after review Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698