Niedzielski has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/327427 )

Change subject: Hygiene: add AppTextViewTest
......................................................................

Hygiene: add AppTextViewTest

This tests shows that simple usage doesn't cause incorrect leading.

Bug: T152213
Change-Id: I4e2c3bb32862b9fa360ab885b9b91e8e1fde7909
---
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
A 
app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
A app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
19 files changed, 61 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/27/327427/1

diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
new file mode 100644
index 0000000..d347971
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-ltr-font1.0x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
new file mode 100644
index 0000000..ea0af03
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLayoutDirection-480dp-en-rtl-font1.0x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
new file mode 100644
index 0000000..94dc452
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.0x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
new file mode 100644
index 0000000..e3c63f1
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-320dp-en-ltr-font1.5x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
new file mode 100644
index 0000000..dffc44c
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.0x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
new file mode 100644
index 0000000..a990a0c
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testLeading-480dp-en-ltr-font1.5x-light.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
new file mode 100644
index 0000000..cd9c164
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
new file mode 100644
index 0000000..6d65e91
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-null_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
new file mode 100644
index 0000000..af50098
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.0x-light-short_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
new file mode 100644
index 0000000..eef510f
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
new file mode 100644
index 0000000..3ad537f
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-null_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
new file mode 100644
index 0000000..50e79c2
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-320dp-en-ltr-font1.5x-light-short_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
new file mode 100644
index 0000000..93e5f02
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
new file mode 100644
index 0000000..dfbca86
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-null_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
new file mode 100644
index 0000000..d347971
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.0x-light-short_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
new file mode 100644
index 0000000..830086f
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-long_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
new file mode 100644
index 0000000..34744a5
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-null_text.png
Binary files differ
diff --git 
a/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
new file mode 100644
index 0000000..0647f7b
--- /dev/null
+++ 
b/app/screenshots-ref/org.wikipedia.views.AppTextViewTest.testWidth-480dp-en-ltr-font1.5x-light-short_text.png
Binary files differ
diff --git a/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java 
b/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
new file mode 100644
index 0000000..fc7ae8e
--- /dev/null
+++ b/app/src/androidTest/java/org/wikipedia/views/AppTextViewTest.java
@@ -0,0 +1,61 @@
+package org.wikipedia.views;
+
+import android.os.Build;
+import android.support.annotation.NonNull;
+import android.support.annotation.Nullable;
+import android.support.test.filters.SmallTest;
+import android.view.View;
+
+import org.apache.commons.lang3.StringUtils;
+import org.junit.experimental.theories.Theory;
+import org.junit.experimental.theories.suppliers.TestedOn;
+import org.wikipedia.test.view.FontScale;
+import org.wikipedia.test.view.LayoutDirection;
+import org.wikipedia.test.view.PrimaryTestStr;
+import org.wikipedia.test.view.TestStr;
+import org.wikipedia.test.view.ViewTest;
+import org.wikipedia.theme.Theme;
+
+@SmallTest public class AppTextViewTest extends ViewTest {
+    private AppTextView subject;
+
+    @Theory public void testWidth(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) 
int widthDp,
+                                  @NonNull FontScale fontScale, @NonNull 
PrimaryTestStr text) {
+        setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, text);
+        snap(subject, text + "_text");
+    }
+
+    @Theory public void testLayoutDirection(@NonNull LayoutDirection 
direction) {
+        setUp(WIDTH_DP_L, direction, FontScale.DEFAULT, Theme.LIGHT, 
PrimaryTestStr.SHORT);
+        snap(subject);
+    }
+
+    @Theory public void testLeading(@TestedOn(ints = {WIDTH_DP_L, WIDTH_DP_M}) 
int widthDp,
+                                    @NonNull FontScale fontScale) {
+        final String str = StringUtils.repeat("Mm%Z@OQW|Pbdpqg ", 100);
+        setUp(widthDp, LayoutDirection.LOCALE, fontScale, Theme.LIGHT, str);
+        subject.requestLayout();
+        snap(subject);
+    }
+
+    private void setUp(int widthDp, @NonNull LayoutDirection layoutDirection,
+                       @NonNull FontScale fontScale, @NonNull Theme theme, 
@NonNull TestStr text) {
+        setUp(widthDp, layoutDirection, fontScale, theme);
+        init(str(text));
+    }
+
+    private void setUp(int widthDp, @NonNull LayoutDirection layoutDirection,
+                       @NonNull FontScale fontScale, @NonNull Theme theme,
+                       @Nullable CharSequence text) {
+        setUp(widthDp, layoutDirection, fontScale, theme);
+        init(text);
+    }
+
+    private void init(@Nullable CharSequence text) {
+        subject = new AppTextView(ctx());
+        subject.setText(text);
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
+            subject.setTextAlignment(View.TEXT_ALIGNMENT_VIEW_START);
+        }
+    }
+}
\ No newline at end of file

-- 
To view, visit https://gerrit.wikimedia.org/r/327427
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e2c3bb32862b9fa360ab885b9b91e8e1fde7909
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: Niedzielski <sniedziel...@wikimedia.org>
Gerrit-Reviewer: Sniedzielski <sniedziel...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to