diff options
author | Tor Norbye <tnorbye@google.com> | 2014-09-11 12:42:11 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-09-12 11:44:50 -0700 |
commit | d331590a050628ef8852cc724d3db915d7bdf9a3 (patch) | |
tree | 76101cd8ea740217955a1ac42d90626fa95dcc87 /android/testData/guiTests/LayoutTest/app/src/main/res/layout | |
parent | 636fd55eded938ae5c43d938ebe8878bfccd6588 (diff) | |
download | idea-d331590a050628ef8852cc724d3db915d7bdf9a3.tar.gz |
Add rendering tests
This CL adds infrastructure for easily testing the visual appearance of layout
renderings. You can require that the rendering should be roughly similar to
an existing thumbnail of the same scene (and the first time you run the test
it will generate this thumbnail such that you can visually inspect it and make
sure it looks correct). On subsequent runs the rendering is painted, scaled
and compared to the golden file and the test passes if the image is sufficiently
similar to the rendering.
If the images are too different, the test will generate a "delta" image which
shows the before, after and difference.
The test currently checks a couple of key renderings:
- a basic layout with an action bar
- a layout including most of the widgets
- a layout with some gradients and included layouts
- a layout rendered as included in another (e.g. testing overlay masks)
- a drawable resource
- a menu resource
Change-Id: Ic6f32a00346ab89a0569e49ceaac89d257ab69e9
Diffstat (limited to 'android/testData/guiTests/LayoutTest/app/src/main/res/layout')
5 files changed, 263 insertions, 6 deletions
diff --git a/android/testData/guiTests/LayoutTest/app/src/main/res/layout/included.xml b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/included.xml new file mode 100644 index 00000000000..c847e87de7f --- /dev/null +++ b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/included.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="utf-8"?> +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:showIn="@layout/textstyles"> + + <TextView + android:id="@+id/textView" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Giant Text" + android:textAppearance="?android:attr/textAppearanceLarge" + android:textColor="#EEEEEE" + android:textSize="40dp" + android:layout_gravity="center_horizontal" /> + + <TextView + android:id="@+id/textView3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Large Text" + android:textAppearance="?android:attr/textAppearanceLarge" + android:layout_gravity="center_horizontal" /> + + <TextView + android:id="@+id/textView4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Medium Text" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_gravity="center_horizontal" /> + + <TextView + android:id="@+id/textView5" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="Small Text" + android:textAppearance="?android:attr/textAppearanceSmall" + android:layout_gravity="center_horizontal" /> + + +</LinearLayout>
\ No newline at end of file diff --git a/android/testData/guiTests/LayoutTest/app/src/main/res/layout/layout2.xml b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/layout2.xml index f3565c002e3..153d7994b7d 100644 --- a/android/testData/guiTests/LayoutTest/app/src/main/res/layout/layout2.xml +++ b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/layout2.xml @@ -1,10 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="match_parent"> + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:context=".MyActivity"> <TextView android:layout_width="match_parent" android:layout_height="match_parent" android:text="Layout 2, base folder"/> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/android/testData/guiTests/LayoutTest/app/src/main/res/layout/outer.xml b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/outer.xml index 55f188057e9..3cb2526d5ff 100644 --- a/android/testData/guiTests/LayoutTest/app/src/main/res/layout/outer.xml +++ b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/outer.xml @@ -1,7 +1,11 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" android:layout_width="match_parent" - android:layout_height="match_parent"> + xmlns:tools="http://schemas.android.com/tools" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical" + tools:context=".MyActivity"> + <TextView android:layout_width="match_parent" android:layout_height="wrap_content" @@ -10,4 +14,4 @@ <include layout="@layout/inner" /> <include layout="@layout/inner" /> -</LinearLayout>
\ No newline at end of file +</LinearLayout> diff --git a/android/testData/guiTests/LayoutTest/app/src/main/res/layout/textstyles.xml b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/textstyles.xml new file mode 100644 index 00000000000..29bc9d04535 --- /dev/null +++ b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/textstyles.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" + android:background="@drawable/progress" + android:orientation="vertical" android:layout_width="match_parent" + android:layout_height="match_parent" + tools:context=".MyActivity"> + + <LinearLayout + android:orientation="horizontal" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true"> + + <Button + android:layout_width="0dp" + android:layout_height="wrap_content" + android:text="Button1" + android:id="@+id/button" + android:layout_weight="1" /> + + <Button + android:layout_width="0dp" + android:layout_height="wrap_content" + android:text="Button2" + android:id="@+id/button2" + android:layout_weight="1" /> + </LinearLayout> + + <include + layout="@layout/included" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/included" + android:layout_centerVertical="true" + android:layout_centerHorizontal="true" /> + +</RelativeLayout>
\ No newline at end of file diff --git a/android/testData/guiTests/LayoutTest/app/src/main/res/layout/widgets.xml b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/widgets.xml new file mode 100644 index 00000000000..eb7ffde53a8 --- /dev/null +++ b/android/testData/guiTests/LayoutTest/app/src/main/res/layout/widgets.xml @@ -0,0 +1,166 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:orientation="vertical"> + + <Button + android:id="@+id/button" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_alignParentTop="true" + android:text="New Button" /> + + <Button + android:id="@+id/button2" + style="?android:attr/buttonStyleSmall" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_toEndOf="@+id/button" + android:layout_toRightOf="@+id/button" + android:text="New Button" /> + + <RadioButton + android:id="@+id/radioButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentTop="true" + android:layout_toEndOf="@+id/button2" + android:layout_toRightOf="@+id/button2" + android:checked="true" + android:text="New RadioButton" /> + + <CheckBox + android:id="@+id/checkBox" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_below="@+id/button" + android:checked="true" + android:text="New CheckBox" /> + + <Switch + android:id="@+id/switch1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@+id/button2" + android:layout_toEndOf="@+id/checkBox" + android:layout_toRightOf="@+id/checkBox" + android:checked="true" + android:text="New Switch" /> + + <ToggleButton + android:id="@+id/toggleButton" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_below="@+id/checkBox" + android:text="New ToggleButton" /> + + <ProgressBar + android:id="@+id/progressBar" + style="?android:attr/progressBarStyleLarge" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/toggleButton" + android:layout_toEndOf="@+id/toggleButton" + android:layout_toRightOf="@+id/toggleButton" /> + + <ProgressBar + android:id="@+id/progressBar2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignTop="@+id/progressBar" + android:layout_toEndOf="@+id/progressBar" + android:layout_toRightOf="@+id/progressBar" /> + + <ProgressBar + android:id="@+id/progressBar3" + style="?android:attr/progressBarStyleHorizontal" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignEnd="@+id/radioButton" + android:layout_alignRight="@+id/radioButton" + android:layout_below="@+id/switch1" + android:layout_toEndOf="@+id/progressBar2" + android:layout_toRightOf="@+id/progressBar2" + android:indeterminate="false" + android:progress="50" /> + + <SeekBar + android:id="@+id/seekBar" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignEnd="@+id/progressBar3" + android:layout_alignLeft="@+id/progressBar3" + android:layout_alignRight="@+id/progressBar3" + android:layout_alignStart="@+id/progressBar3" + android:layout_below="@+id/progressBar3" + android:progress="30" /> + + <RatingBar + android:id="@+id/ratingBar" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignEnd="@+id/radioButton" + android:layout_alignRight="@+id/radioButton" + android:layout_below="@+id/progressBar2" + android:rating="2.5" /> + + <EditText + android:id="@+id/editText" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignEnd="@+id/radioButton" + android:layout_alignLeft="@+id/progressBar2" + android:layout_alignRight="@+id/radioButton" + android:layout_alignStart="@+id/progressBar2" + android:layout_below="@+id/ratingBar" + android:hint="Hint Text"> + + <requestFocus /> + + </EditText> + + <EditText + android:id="@+id/editText2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignEnd="@+id/editText" + android:layout_alignRight="@+id/editText" + android:layout_below="@+id/editText" + android:ems="10" + android:inputType="textPassword" + android:text="MyPassword" /> + + <TimePicker + android:id="@+id/timePicker" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_below="@+id/editText2" /> + + <ZoomControls + android:id="@+id/zoomControls" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:layout_below="@+id/timePicker" /> + + <CheckedTextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:text="New CheckedTextView" + android:id="@+id/checkedTextView" + android:layout_below="@+id/zoomControls" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" /> + +</RelativeLayout>
\ No newline at end of file |