diff options
Diffstat (limited to 'tests')
36 files changed, 1967 insertions, 89 deletions
diff --git a/tests/BiDiTests/AndroidManifest.xml b/tests/BiDiTests/AndroidManifest.xml index 8a77519..ad27a62 100644 --- a/tests/BiDiTests/AndroidManifest.xml +++ b/tests/BiDiTests/AndroidManifest.xml @@ -19,7 +19,7 @@ android:versionCode="1" android:versionName="1.0"> - <application android:label="BiDiTests"> + <application android:label="BiDiTests" android:hardwareAccelerated="true"> <activity android:name=".BiDiTestActivity" android:windowSoftInputMode="stateAlwaysHidden"> @@ -57,6 +57,62 @@ </intent-filter> </activity> + <activity android:name=".BiDiTestFrameLayoutLtrActivity" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <activity android:name=".BiDiTestFrameLayoutRtlActivity" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <activity android:name=".BiDiTestRelativeLayoutLtrActivity" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <activity android:name=".BiDiTestRelativeLayoutRtlActivity" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <activity android:name=".BiDiTestRelativeLayoutLtrActivity2" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <activity android:name=".BiDiTestRelativeLayoutRtlActivity2" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <activity android:name=".BiDiTestTableLayoutLtrActivity" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + + <activity android:name=".BiDiTestTableLayoutRtlActivity" + android:windowSoftInputMode="stateAlwaysHidden"> + <intent-filter> + <action android:name="android.intent.action.MAIN" /> + </intent-filter> + </activity> + </application> -</manifest>
\ No newline at end of file +</manifest> diff --git a/tests/BiDiTests/res/layout/basic.xml b/tests/BiDiTests/res/layout/basic.xml index c4807ff..f254e3c 100644 --- a/tests/BiDiTests/res/layout/basic.xml +++ b/tests/BiDiTests/res/layout/basic.xml @@ -27,22 +27,21 @@ <Button android:id="@+id/button" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:onClick="onButtonClick" android:text="@string/button_text" android:textSize="32dip" /> <TextView android:id="@+id/textview" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - android:textSize="32dip" - android:text="@string/textview_text" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="32dip" + android:text="@string/textview_text" /> <EditText android:id="@+id/edittext" - android:layout_height="wrap_content" - android:layout_width="match_parent" - android:textSize="32dip" + android:layout_height="wrap_content" + android:layout_width="match_parent" + android:textSize="32dip" /> </LinearLayout> diff --git a/tests/BiDiTests/res/layout/frame_layout_ltr.xml b/tests/BiDiTests/res/layout/frame_layout_ltr.xml new file mode 100644 index 0000000..61fd06e --- /dev/null +++ b/tests/BiDiTests/res/layout/frame_layout_ltr.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/frame_layout_ltr" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="ltr" + android:background="#FF000000"> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="right|center_vertical" + android:background="#FFFF0000"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="left|center_vertical" + android:background="#FF00FF00"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|center_horizontal" + android:background="#FF0000FF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|center_horizontal" + android:background="#FF00FFFF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|start" + android:background="#FFFFFFFF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|end" + android:background="#FFFFFF00"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|start" + android:background="#FFFFFFFF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|end" + android:background="#FFFFFF00"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="center_horizontal|center_vertical" + android:background="#FF888888"> + </FrameLayout> + +</FrameLayout> + diff --git a/tests/BiDiTests/res/layout/frame_layout_rtl.xml b/tests/BiDiTests/res/layout/frame_layout_rtl.xml new file mode 100644 index 0000000..598b41a --- /dev/null +++ b/tests/BiDiTests/res/layout/frame_layout_rtl.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/frame_layout_ltr" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="rtl" + android:background="#FF000000"> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="right|center_vertical" + android:background="#FFFF0000"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="left|center_vertical" + android:background="#FF00FF00"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|center_horizontal" + android:background="#FF0000FF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|center_horizontal" + android:background="#FF00FFFF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|start" + android:background="#FFFFFFFF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|end" + android:background="#FFFFFF00"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|start" + android:background="#FFFFFFFF"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|end" + android:background="#FFFFFF00"> + </FrameLayout> + + <FrameLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="center_horizontal|center_vertical" + android:background="#FF888888"> + </FrameLayout> + +</FrameLayout> + diff --git a/tests/BiDiTests/res/layout/linear_layout_ltr.xml b/tests/BiDiTests/res/layout/linear_layout_ltr.xml index a95fb0e..d4386f2 100644 --- a/tests/BiDiTests/res/layout/linear_layout_ltr.xml +++ b/tests/BiDiTests/res/layout/linear_layout_ltr.xml @@ -15,35 +15,61 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/layouttest" + android:id="@+id/linear_layout_ltr" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" - android:horizontalDirection="ltr"> + android:layoutDirection="ltr"> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + + <TextView android:id="@+id/textview" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + /> + + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + + </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="inherit"> + android:layoutDirection="inherit"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -52,25 +78,25 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="ltr"> + android:layoutDirection="ltr"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -79,25 +105,25 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="rtl"> + android:layoutDirection="rtl"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -106,25 +132,25 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="inherit"> + android:layoutDirection="inherit"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -133,25 +159,25 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="ltr"> + android:layoutDirection="ltr"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -160,25 +186,25 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="rtl"> + android:layoutDirection="rtl"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> diff --git a/tests/BiDiTests/res/layout/linear_layout_rtl.xml b/tests/BiDiTests/res/layout/linear_layout_rtl.xml index 0d60950..9d07263 100644 --- a/tests/BiDiTests/res/layout/linear_layout_rtl.xml +++ b/tests/BiDiTests/res/layout/linear_layout_rtl.xml @@ -15,35 +15,61 @@ --> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/layouttest" + android:id="@+id/linear_layout_rtl" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" - android:horizontalDirection="rtl"> + android:layoutDirection="rtl"> + + <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:orientation="horizontal" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + + <TextView android:id="@+id/textview" + android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:textSize="24dip" + android:text="@string/textview_text" + /> + + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + + </LinearLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="inherit"> + android:layoutDirection="inherit"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -52,25 +78,25 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="ltr"> + android:layoutDirection="ltr"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -79,25 +105,25 @@ android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="rtl"> + android:layoutDirection="rtl"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -106,25 +132,25 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="inherit"> + android:layoutDirection="inherit"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -133,25 +159,25 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="ltr"> + android:layoutDirection="ltr"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> @@ -160,25 +186,25 @@ android:orientation="vertical" android:layout_width="match_parent" android:layout_height="wrap_content" - android:horizontalDirection="rtl"> + android:layoutDirection="rtl"> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button1_text" - android:textSize="32dip" + android:textSize="24dip" /> <TextView android:id="@+id/textview" android:layout_height="wrap_content" android:layout_width="wrap_content" - android:textSize="32dip" + android:textSize="24dip" android:text="@string/textview_text" /> <Button android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="@string/button2_text" - android:textSize="32dip" + android:textSize="24dip" /> </LinearLayout> diff --git a/tests/BiDiTests/res/layout/relative_layout_ltr.xml b/tests/BiDiTests/res/layout/relative_layout_ltr.xml new file mode 100644 index 0000000..d789707 --- /dev/null +++ b/tests/BiDiTests/res/layout/relative_layout_ltr.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/frame_layout_ltr" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="ltr" + android:background="#FF000000"> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="right|center_vertical" + android:background="#FFFF0000"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="left|center_vertical" + android:background="#FF00FF00"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|center_horizontal" + android:background="#FF0000FF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|center_horizontal" + android:background="#FF00FFFF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|start" + android:background="#FFFFFFFF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|end" + android:background="#FFFFFF00"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|start" + android:background="#FFFFFFFF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|end" + android:background="#FFFFFF00"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="center_horizontal|center_vertical" + android:background="#FF888888"> + </RelativeLayout> + +</FrameLayout> + diff --git a/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml b/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml new file mode 100644 index 0000000..a13ef8b --- /dev/null +++ b/tests/BiDiTests/res/layout/relative_layout_ltr_2.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/relative_layout_ltr" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="ltr"> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px"> + + <TextView android:id="@+id/label_1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_1" /> + + <Button android:id="@+id/ok_1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_1" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_1" + android:layout_alignTop="@id/ok_1" + android:text="Cancel" /> + + </RelativeLayout> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px" + android:layoutDirection="ltr"> + + <TextView android:id="@+id/label_2" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_2" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_2" /> + + <Button android:id="@+id/ok_2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_2" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_2" + android:layout_alignTop="@id/ok_2" + android:text="Cancel" /> + + </RelativeLayout> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px" + android:layoutDirection="inherit"> + + <TextView android:id="@+id/label_3" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_3" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_3" /> + + <Button android:id="@+id/ok_3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_3" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_3" + android:layout_alignTop="@id/ok_3" + android:text="Cancel" /> + + </RelativeLayout> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px" + android:layoutDirection="rtl"> + + <TextView android:id="@+id/label_4" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_4" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_4" /> + + <Button android:id="@+id/ok_4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_4" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_4" + android:layout_alignTop="@id/ok_4" + android:text="Cancel" /> + + </RelativeLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/relative_layout_rtl.xml b/tests/BiDiTests/res/layout/relative_layout_rtl.xml new file mode 100644 index 0000000..5808924 --- /dev/null +++ b/tests/BiDiTests/res/layout/relative_layout_rtl.xml @@ -0,0 +1,88 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/frame_layout_rtl" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="rtl" + android:background="#FF000000"> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="right|center_vertical" + android:background="#FFFF0000"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="left|center_vertical" + android:background="#FF00FF00"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|center_horizontal" + android:background="#FF0000FF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|center_horizontal" + android:background="#FF00FFFF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|start" + android:background="#FFFFFFFF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="top|end" + android:background="#FFFFFF00"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|start" + android:background="#FFFFFFFF"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="bottom|end" + android:background="#FFFFFF00"> + </RelativeLayout> + + <RelativeLayout + android:layout_width="100dp" + android:layout_height="100dp" + android:layout_gravity="center_horizontal|center_vertical" + android:background="#FF888888"> + </RelativeLayout> + +</FrameLayout> + diff --git a/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml b/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml new file mode 100644 index 0000000..1a6b3d5 --- /dev/null +++ b/tests/BiDiTests/res/layout/relative_layout_rtl_2.xml @@ -0,0 +1,155 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/relative_layout_ltr" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="rtl"> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px"> + + <TextView android:id="@+id/label_1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_1" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_1" /> + + <Button android:id="@+id/ok_1" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_1" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_1" + android:layout_alignTop="@id/ok_1" + android:text="Cancel" /> + + </RelativeLayout> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px" + android:layoutDirection="ltr"> + + <TextView android:id="@+id/label_2" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_2" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_2" /> + + <Button android:id="@+id/ok_2" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_2" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_2" + android:layout_alignTop="@id/ok_2" + android:text="Cancel" /> + + </RelativeLayout> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px" + android:layoutDirection="inherit"> + + <TextView android:id="@+id/label_3" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_3" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_3" /> + + <Button android:id="@+id/ok_3" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_3" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_3" + android:layout_alignTop="@id/ok_3" + android:text="Cancel" /> + + </RelativeLayout> + + <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:background="#FF000000" + android:padding="10px" + android:layoutDirection="rtl"> + + <TextView android:id="@+id/label_4" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:text="Type here:" /> + + <EditText android:id="@+id/entry_4" + android:layout_width="fill_parent" + android:layout_height="wrap_content" + android:layout_below="@id/label_4" /> + + <Button android:id="@+id/ok_4" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_below="@id/entry_4" + android:layout_alignParentRight="true" + android:layout_marginLeft="10px" + android:text="OK" /> + + <Button android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_toLeftOf="@id/ok_4" + android:layout_alignTop="@id/ok_4" + android:text="Cancel" /> + + </RelativeLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/table_layout_ltr.xml b/tests/BiDiTests/res/layout/table_layout_ltr.xml new file mode 100644 index 0000000..8e1891e --- /dev/null +++ b/tests/BiDiTests/res/layout/table_layout_ltr.xml @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/linear_layout_ltr" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="ltr"> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2" + android:layoutDirection="inherit"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2" + android:layoutDirection="ltr"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2" + android:layoutDirection="rtl"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/layout/table_layout_rtl.xml b/tests/BiDiTests/res/layout/table_layout_rtl.xml new file mode 100644 index 0000000..bd664e4 --- /dev/null +++ b/tests/BiDiTests/res/layout/table_layout_rtl.xml @@ -0,0 +1,215 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2011 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> + +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/linear_layout_ltr" + android:orientation="vertical" + android:layout_width="match_parent" + android:layout_height="match_parent" + android:layoutDirection="rtl"> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2" + android:layoutDirection="inherit"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2" + android:layoutDirection="ltr"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + + <TableLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:stretchColumns="1,2" + android:layoutDirection="rtl"> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button1_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_right_text" + android:textSize="24dip" + android:gravity="right" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_after_text" + android:textSize="24dip" + android:gravity="after" + /> + </TableRow> + + <TableRow> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button2_text" + android:textSize="24dip" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_left_text" + android:textSize="24dip" + android:gravity="left" + /> + <Button android:layout_height="wrap_content" + android:layout_width="wrap_content" + android:text="@string/button_before_text" + android:textSize="24dip" + android:gravity="before" + /> + </TableRow> + + </TableLayout> + +</LinearLayout>
\ No newline at end of file diff --git a/tests/BiDiTests/res/values/strings.xml b/tests/BiDiTests/res/values/strings.xml index 3795d4b..d067e7d 100644 --- a/tests/BiDiTests/res/values/strings.xml +++ b/tests/BiDiTests/res/values/strings.xml @@ -16,6 +16,12 @@ <string name="button_text">Button</string> <string name="button1_text">Button1</string> <string name="button2_text">Button2</string> + <string name="button3_text">Button3</string> + <string name="button4_text">Button4</string> + <string name="button_right_text">Right</string> + <string name="button_after_text">End</string> + <string name="button_left_text">Left</string> + <string name="button_before_text">Start</string> <string name="button_requestlayout_text">Request Layout</string> <string name="textview_text">This is a text for a TextView</string> <string name="edittext_text">mmmmmmmmmmmmmmmmmmmmmmmm</string> diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java index 0d9b4f7..2662683 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestActivity.java @@ -37,20 +37,64 @@ public class BiDiTestActivity extends TabActivity { intent = new Intent().setClass(this, BiDiTestBasicActivity.class); // Initialize a TabSpec for each tab and add it to the TabHost - spec = tabHost.newTabSpec("basic").setIndicator("Basic").setContent(intent); + spec = tabHost.newTabSpec("basic").setIndicator("Basic"). + setContent(intent); tabHost.addTab(spec); // Do the same for the other tabs intent = new Intent().setClass(this, BiDiTestCanvasActivity.class); - spec = tabHost.newTabSpec("canvas").setIndicator("Canvas").setContent(intent); + spec = tabHost.newTabSpec("canvas").setIndicator("Canvas"). + setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, BiDiTestLinearLayoutLtrActivity.class); - spec = tabHost.newTabSpec("layout-ltr").setIndicator("LinearLayout LTR").setContent(intent); + spec = tabHost.newTabSpec("linear-layout-ltr").setIndicator("Linear LTR"). + setContent(intent); tabHost.addTab(spec); intent = new Intent().setClass(this, BiDiTestLinearLayoutRtlActivity.class); - spec = tabHost.newTabSpec("layout-rtl").setIndicator("LinearLayout RTL").setContent(intent); + spec = tabHost.newTabSpec("linear-layout-rtl").setIndicator("Linear RTL"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestFrameLayoutLtrActivity.class); + spec = tabHost.newTabSpec("frame-layout-ltr").setIndicator("Frame LTR"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestFrameLayoutRtlActivity.class); + spec = tabHost.newTabSpec("frame-layout-rtl").setIndicator("Frame RTL"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity.class); + spec = tabHost.newTabSpec("relative-layout-ltr").setIndicator("Relative LTR"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity.class); + spec = tabHost.newTabSpec("relative-layout-rtl").setIndicator("Relative RTL"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestRelativeLayoutLtrActivity2.class); + spec = tabHost.newTabSpec("relative-layout-ltr-2").setIndicator("Relative2 LTR"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestRelativeLayoutRtlActivity2.class); + spec = tabHost.newTabSpec("relative-layout-rtl-2").setIndicator("Relative2 RTL"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestTableLayoutLtrActivity.class); + spec = tabHost.newTabSpec("table-layout-ltr").setIndicator("Table LTR"). + setContent(intent); + tabHost.addTab(spec); + + intent = new Intent().setClass(this, BiDiTestTableLayoutRtlActivity.class); + spec = tabHost.newTabSpec("table-layout-rtl").setIndicator("Table RTL"). + setContent(intent); tabHost.addTab(spec); tabHost.setCurrentTab(0); diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtrActivity.java new file mode 100644 index 0000000..6ce4fe4 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutLtrActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestFrameLayoutLtrActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.frame_layout_ltr); + } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtlActivity.java new file mode 100644 index 0000000..6012a5c --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestFrameLayoutRtlActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestFrameLayoutRtlActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.frame_layout_rtl); + } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtrActivity.java index 6d8f11d..280af6a 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtrActivity.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutLtrActivity.java @@ -18,18 +18,13 @@ package com.android.bidi; import android.app.Activity; import android.os.Bundle; -import android.widget.LinearLayout; public class BiDiTestLinearLayoutLtrActivity extends Activity { - private LinearLayout layout; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.linear_layout_ltr); - - layout = (LinearLayout) findViewById(R.id.layouttest); } } diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtlActivity.java index 0130793..7121a62 100644 --- a/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtlActivity.java +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestLinearLayoutRtlActivity.java @@ -18,18 +18,13 @@ package com.android.bidi; import android.app.Activity; import android.os.Bundle; -import android.widget.LinearLayout; public class BiDiTestLinearLayoutRtlActivity extends Activity { - private LinearLayout layout; - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.linear_layout_rtl); - - layout = (LinearLayout) findViewById(R.id.layouttest); } } diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity.java new file mode 100644 index 0000000..d6b8d02 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestRelativeLayoutLtrActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.relative_layout_ltr); + } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java new file mode 100644 index 0000000..476375c --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutLtrActivity2.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestRelativeLayoutLtrActivity2 extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.relative_layout_ltr_2); + } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity.java new file mode 100644 index 0000000..683b7a3 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestRelativeLayoutRtlActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.relative_layout_rtl); + } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java new file mode 100644 index 0000000..db2af7f --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestRelativeLayoutRtlActivity2.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestRelativeLayoutRtlActivity2 extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.relative_layout_rtl_2); + } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtrActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtrActivity.java new file mode 100644 index 0000000..0719dae --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutLtrActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestTableLayoutLtrActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.table_layout_ltr); + } +} + diff --git a/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtlActivity.java b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtlActivity.java new file mode 100644 index 0000000..3553ed8 --- /dev/null +++ b/tests/BiDiTests/src/com/android/bidi/BiDiTestTableLayoutRtlActivity.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.bidi; + +import android.app.Activity; +import android.os.Bundle; + +public class BiDiTestTableLayoutRtlActivity extends Activity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.table_layout_rtl); + } +} + diff --git a/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java b/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java index 2a40c57..01c1c70 100644 --- a/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java +++ b/tests/DpiTest/src/com/google/android/test/dpi/DpiTestActivity.java @@ -63,7 +63,8 @@ public class DpiTestActivity extends Activity { | ApplicationInfo.FLAG_RESIZEABLE_FOR_SCREENS | ApplicationInfo.FLAG_SUPPORTS_SCREEN_DENSITIES; app.getResources().setCompatibilityInfo(new CompatibilityInfo(ai, - getResources().getConfiguration().screenLayout, false)); + getResources().getConfiguration().screenLayout, + getResources().getConfiguration().smallestScreenWidthDp, false)); } } catch (PackageManager.NameNotFoundException e) { throw new RuntimeException("ouch", e); diff --git a/tests/GridLayoutTest/AndroidManifest.xml b/tests/GridLayoutTest/AndroidManifest.xml index 53ca4ce..1b72357 100644 --- a/tests/GridLayoutTest/AndroidManifest.xml +++ b/tests/GridLayoutTest/AndroidManifest.xml @@ -76,6 +76,27 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> + + <activity android:name="AlignmentTest" android:label="AlignmentTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + + <activity android:name="LinearLayoutTest" android:label="LinearLayoutTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> + + <activity android:name="GridLayoutTest" android:label="GridLayoutTest"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + </activity> </application> diff --git a/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java new file mode 100644 index 0000000..937eacb --- /dev/null +++ b/tests/GridLayoutTest/src/com/android/test/layout/AbstractLayoutTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.test.layout; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.os.Debug; +import android.util.Log; +import android.view.Gravity; +import android.view.View; +import android.view.ViewGroup; +import android.widget.Button; + +public abstract class AbstractLayoutTest extends Activity { + + public static final String[] HORIZONTAL_NAMES = new String[] { "LEFT", "center", "east", "fill" }; + public static final int[] HORIZONTAL_ALIGNMENTS = new int[] { Gravity.LEFT, Gravity.CENTER, Gravity.RIGHT, Gravity.FILL }; + public static final String[] VERTICAL_NAMES = new String[] { "north", "center", "baseline", "south", "fill" }; + public static final int[] VERTICAL_ALIGNMENTS = new int[] { Gravity.TOP, Gravity.CENTER, Gravity.NO_GRAVITY, Gravity.BOTTOM, Gravity.FILL }; + + public View create(Context context, String name, int size) { + Button result = new Button(context); + result.setText(name); + result.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + animate(v); + } + }); + return result; + } + + public abstract ViewGroup create(Context context); + public abstract String tag(); + + public void animate(View v) { + long start = System.currentTimeMillis(); + int N = 1000; + for (int i = 0; i < N; i++) { + ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) v.getLayoutParams(); + lp.topMargin = (lp.topMargin + 1) % 31; + lp.leftMargin = (lp.leftMargin + 1) % 31; + + v.requestLayout(); + v.invalidate(); + ViewGroup p = (ViewGroup) v.getParent(); + p.layout(0, 0, 1000 + (i % 2), 500 + (i % 2)); + } + Log.d(tag(), "Time: " + (float) (System.currentTimeMillis() - start) / N * 1000 + "mics"); + } + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(create(getBaseContext())); + } + +}
\ No newline at end of file diff --git a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java index 6359903..5e29cf1 100644 --- a/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java +++ b/tests/GridLayoutTest/src/com/android/test/layout/Activity2.java @@ -32,6 +32,7 @@ public class Activity2 extends Activity { public static View create(Context context) { GridLayout vg = new GridLayout(context); vg.setUseDefaultMargins(true); + vg.setMarginsIncludedInAlignment(false); Group row1 = new Group(1, CENTER); Group row2 = new Group(2, CENTER); diff --git a/tests/GridLayoutTest/src/com/android/test/layout/AlignmentTest.java b/tests/GridLayoutTest/src/com/android/test/layout/AlignmentTest.java new file mode 100755 index 0000000..505c83d --- /dev/null +++ b/tests/GridLayoutTest/src/com/android/test/layout/AlignmentTest.java @@ -0,0 +1,120 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.test.layout; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.view.View; +import android.view.ViewGroup; +import android.view.ViewParent; +import android.widget.Button; +import android.widget.EditText; +import android.widget.GridLayout; +import android.widget.TextView; + +import static android.widget.GridLayout.*; + +public class AlignmentTest extends Activity { + + public static final String[] HORIZONTAL_NAMES = {"LEFT", "center", "east", "fill"}; + public static final Alignment[] HORIZONTAL_ALIGNMENTS = {LEFT, CENTER, RIGHT, FILL}; + public static final String[] VERTICAL_NAMES = {"north", "center", "baseline", "south", "fill"}; + public static final Alignment[] VERTICAL_ALIGNMENTS = {TOP, CENTER, BASELINE, BOTTOM, FILL}; + private static Context CONTEXT; + + public static interface ViewFactory { + View create(String name, int size); + } + + public static final ViewFactory BUTTON_FACTORY = new ViewFactory() { + public View create(String name, int size) { + Button result = new Button(CONTEXT); + result.setText(name); + result.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + animate(v); + } + }); + return result; + } + }; + + public static final ViewFactory LABEL_FACTORY = new ViewFactory() { + public View create(String name, int size) { + TextView result = new TextView(CONTEXT); + result.setText(name); + result.setTextSize(40); + return result; + } + }; + + public static final ViewFactory TEXT_FIELD_FACTORY = new ViewFactory() { + public View create(String name, int size) { + EditText result = new EditText(CONTEXT); + result.setText(name); + return result; + } + }; + + public static final ViewFactory[] FACTORIES = + {BUTTON_FACTORY, LABEL_FACTORY, TEXT_FIELD_FACTORY}; + + public static ViewGroup create(Context context1) { + CONTEXT = context1; + GridLayout container = new GridLayout(context1); + container.setUseDefaultMargins(true); + + for (int i = 0; i < VERTICAL_ALIGNMENTS.length; i++) { + Alignment va = VERTICAL_ALIGNMENTS[i]; + for (int j = 0; j < HORIZONTAL_ALIGNMENTS.length; j++) { + Alignment ha = HORIZONTAL_ALIGNMENTS[j]; + Group rowGroup = new Group(i, va); + Group colGroup = new Group(j, ha); + LayoutParams layoutParams = new LayoutParams(rowGroup, colGroup); + String name = VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j]; + ViewFactory factory = FACTORIES[(i + j) % FACTORIES.length]; + container.addView(factory.create(name, 20), layoutParams); + } + } + + return container; + } + + public static void animate(View v) { + + long start = System.currentTimeMillis(); + int N = 1000; + for (int i = 0; i < N; i++) { + ViewGroup.LayoutParams lp = v.getLayoutParams(); + lp.width += 1; // width; + lp.height += 1; // height; + v.requestLayout(); + GridLayout p = (GridLayout) v.getParent(); + p.layout(0, 0, 1000 + (i % 2), 500 + (i % 2)); + } + float time = (float) (System.currentTimeMillis() - start) / N * 1000; + System.out.println("Time: " + time + "mics"); + } + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(create(getBaseContext())); + } + +}
\ No newline at end of file diff --git a/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java new file mode 100644 index 0000000..2eecb8a --- /dev/null +++ b/tests/GridLayoutTest/src/com/android/test/layout/GridLayoutTest.java @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.test.layout; + +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; +import android.widget.GridLayout; + +import static android.widget.GridLayout.*; + +public class GridLayoutTest extends AbstractLayoutTest { + public ViewGroup create(Context context) { + GridLayout container = new GridLayout(context); + container.setOrientation(VERTICAL); +// container.setUseDefaultMargins(true); + + for (int i = 0; i < VERTICAL_ALIGNMENTS.length; i++) { + int va = VERTICAL_ALIGNMENTS[i]; + for (int j = 0; j < HORIZONTAL_ALIGNMENTS.length; j++) { + int ha = HORIZONTAL_ALIGNMENTS[j]; + GridLayout.Group rowGroup = new GridLayout.Group(UNDEFINED, null); + GridLayout.Group colGroup = new GridLayout.Group(UNDEFINED, null); + GridLayout.LayoutParams lp = new GridLayout.LayoutParams(rowGroup, colGroup); + lp.setGravity(va | ha); + View v = create(context, VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j], 20); + container.addView(v, lp); + } + } + + return container; + } + + public String tag() { + return GridLayoutTest.class.getName(); + } +} diff --git a/tests/GridLayoutTest/src/com/android/test/layout/LinearLayoutTest.java b/tests/GridLayoutTest/src/com/android/test/layout/LinearLayoutTest.java new file mode 100644 index 0000000..c7f4665 --- /dev/null +++ b/tests/GridLayoutTest/src/com/android/test/layout/LinearLayoutTest.java @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.test.layout; + +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; +import android.widget.LinearLayout; + +import static android.widget.LinearLayout.*; +import static android.widget.LinearLayout.LayoutParams.*; + +public class LinearLayoutTest extends AbstractLayoutTest { + public ViewGroup create(Context context) { + LinearLayout container = new LinearLayout(context); + container.setOrientation(LinearLayout.VERTICAL); + + for (int i = 0; i < VERTICAL_ALIGNMENTS.length; i++) { + int va = VERTICAL_ALIGNMENTS[i]; + for (int j = 0; j < HORIZONTAL_ALIGNMENTS.length; j++) { + int ha = HORIZONTAL_ALIGNMENTS[j]; + LayoutParams lp = new LayoutParams(WRAP_CONTENT, WRAP_CONTENT); + lp.gravity = va | ha; + View v = create(context, VERTICAL_NAMES[i] + "-" + HORIZONTAL_NAMES[j], 20); + container.addView(v, lp); + } + } + + return container; + } + + public String tag() { + return LinearLayoutTest.class.getName(); + } +} diff --git a/tests/RenderScriptTests/PerfTest/res/drawable/globe.png b/tests/RenderScriptTests/PerfTest/res/drawable/globe.png Binary files differnew file mode 100755 index 0000000..f9d6172 --- /dev/null +++ b/tests/RenderScriptTests/PerfTest/res/drawable/globe.png diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java index 5377f12..3ba6ba4 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/RsBenchRS.java @@ -113,16 +113,20 @@ public class RsBenchRS { private Allocation mTexOpaque; private Allocation mTexTransparent; private Allocation mTexChecker; + private Allocation mTexGlobe; private Mesh m10by10Mesh; private Mesh m100by100Mesh; private Mesh mWbyHMesh; private Mesh mTorus; + private Mesh mSingleMesh; Font mFontSans; Font mFontSerif; private Allocation mTextAlloc; + private ScriptField_TexAllocs_s mTextureAllocs; + private ScriptC_rsbench mScript; private final BitmapFactory.Options mOptionsARGB = new BitmapFactory.Options(); @@ -253,6 +257,27 @@ public class RsBenchRS { return tmb.create(true); } + /** + * Create a mesh with a single quad for the given width and height. + */ + private Mesh getSingleMesh(float width, float height) { + Mesh.TriangleMeshBuilder tmb = new Mesh.TriangleMeshBuilder(mRS, + 2, Mesh.TriangleMeshBuilder.TEXTURE_0); + float xOffset = width/2; + float yOffset = height/2; + tmb.setTexture(0, 0); + tmb.addVertex(-1.0f * xOffset, -1.0f * yOffset); + tmb.setTexture(1, 0); + tmb.addVertex(xOffset, -1.0f * yOffset); + tmb.setTexture(1, 1); + tmb.addVertex(xOffset, yOffset); + tmb.setTexture(0, 1); + tmb.addVertex(-1.0f * xOffset, yOffset); + tmb.addTriangle(0, 3, 1); + tmb.addTriangle(1, 3, 2); + return tmb.create(true); + } + private void initProgramStore() { // Use stock the stock program store object mProgStoreBlendNoneDepth = ProgramStore.BLEND_NONE_DEPTH_TEST(mRS); @@ -392,11 +417,13 @@ public class RsBenchRS { mTexOpaque = loadTextureRGB(R.drawable.data); mTexTransparent = loadTextureARGB(R.drawable.leaf); mTexChecker = loadTextureRGB(R.drawable.checker); + mTexGlobe = loadTextureRGB(R.drawable.globe); mScript.set_gTexTorus(mTexTorus); mScript.set_gTexOpaque(mTexOpaque); mScript.set_gTexTransparent(mTexTransparent); mScript.set_gTexChecker(mTexChecker); + mScript.set_gTexGlobe(mTexGlobe); } private void initFonts() { @@ -418,6 +445,8 @@ public class RsBenchRS { mScript.set_g100by100Mesh(m100by100Mesh); mWbyHMesh= getMbyNMesh(mBenchmarkDimX, mBenchmarkDimY, mBenchmarkDimX/4, mBenchmarkDimY/4); mScript.set_gWbyHMesh(mWbyHMesh); + mSingleMesh = getSingleMesh(50, 50); + mScript.set_gSingleMesh(mSingleMesh); FileA3D model = FileA3D.createFromResource(mRS, mRes, R.raw.torus); FileA3D.IndexEntry entry = model.getIndexEntry(0); @@ -517,6 +546,16 @@ public class RsBenchRS { Allocation.USAGE_GRAPHICS_RENDER_TARGET); mScript.set_gRenderBufferDepth(offscreen); + + mTextureAllocs = new ScriptField_TexAllocs_s(mRS, 100); + for (int i = 0; i < 100; i++) { + ScriptField_TexAllocs_s.Item texElem = new ScriptField_TexAllocs_s.Item(); + texElem.texture = loadTextureRGB(R.drawable.globe); + mTextureAllocs.set(texElem, i, false); + } + mTextureAllocs.copyAll(); + mScript.bind_gTexList100(mTextureAllocs); + mRS.bindRootScript(mScript); } } diff --git a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs index e7f5cd4..b6572fb 100644 --- a/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs +++ b/tests/RenderScriptTests/PerfTest/src/com/android/perftest/rsbench.rs @@ -23,7 +23,7 @@ const int RS_MSG_TEST_DONE = 100; const int RS_MSG_RESULTS_READY = 101; -const int gMaxModes = 25; +const int gMaxModes = 27; int gMaxLoops; // Allocation to send test names back to java @@ -44,11 +44,19 @@ rs_allocation gTexOpaque; rs_allocation gTexTorus; rs_allocation gTexTransparent; rs_allocation gTexChecker; +rs_allocation gTexGlobe; + +typedef struct TexAllocs_s { + rs_allocation texture; +} TexAllocs; + +TexAllocs *gTexList100; rs_mesh g10by10Mesh; rs_mesh g100by100Mesh; rs_mesh gWbyHMesh; rs_mesh gTorusMesh; +rs_mesh gSingleMesh; rs_font gFontSans; rs_font gFontSerif; @@ -142,7 +150,7 @@ static void displayFontSamples(int fillNum) { } static void bindProgramVertexOrtho() { - // Default vertex sahder + // Default vertex shader rsgBindProgramVertex(gProgVertex); // Setup the projection matrix rs_matrix4x4 proj; @@ -198,6 +206,33 @@ static void displayMeshSamples(int meshNum) { } } +// Display sample images in a mesh with different texture +static void displayMeshWithMultiTexture(int meshMode) { + bindProgramVertexOrtho(); + + // Fragment shader with texture + rsgBindProgramStore(gProgStoreBlendAlpha); + rsgBindProgramFragment(gProgFragmentTexture); + rsgBindSampler(gProgFragmentTexture, 0, gLinearClamp); + + int meshCount = (int)pow(10.0f, (float)(meshMode + 1)); + + float yPos = 0; + for (int y = 0; y < meshCount; y++) { + yPos = (y + 1) * 50; + float xPos = 0; + for (int x = 0; x < meshCount; x++) { + xPos = (x + 1) * 50; + rs_matrix4x4 matrix; + rsMatrixLoadTranslate(&matrix, xPos, yPos, 0); + rsgProgramVertexLoadModelMatrix(&matrix); + int i = (x + y * meshCount) % 100; + rsgBindTexture(gProgFragmentTexture, 0, gTexList100[i].texture); + rsgDrawMesh(gSingleMesh); + } + } +} + static float gTorusRotation = 0; static void updateModelMatrix(rs_matrix4x4 *matrix, void *buffer) { if (buffer == 0) { @@ -497,6 +532,8 @@ static const char *testNames[] = { "Geo test 25.6k heavy fragment heavy vertex", "Geo test 51.2k heavy fragment heavy vertex", "Geo test 204.8k small tries heavy fragment heavy vertex", + "Mesh with 10 by 10 texture", + "Mesh with 100 by 100 texture", }; void getTestName(int testIndex) { @@ -589,6 +626,12 @@ static void runTest(int index) { case 24: displayPixelLightSamples(8, true); break; + case 25: + displayMeshWithMultiTexture(0); + break; + case 26: + displayMeshWithMultiTexture(1); + break; } } diff --git a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java index 0129114..b212533 100644 --- a/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java +++ b/tests/StatusBar/src/com/android/statusbartest/StatusBarTest.java @@ -145,13 +145,10 @@ public class StatusBarTest extends TestActivity }, new Test("Priority notification") { public void run() { - Notification not = new Notification(StatusBarTest.this, + Notification not = new Notification( R.drawable.stat_sys_phone, "Incoming call from: Imperious Leader", - System.currentTimeMillis()-(1000*60*60*24), - "Imperious Leader", - "(888) 555-5038", - null + System.currentTimeMillis()-(1000*60*60*24) ); not.flags |= Notification.FLAG_HIGH_PRIORITY; Intent fullScreenIntent = new Intent(StatusBarTest.this, TestAlertActivity.class); @@ -248,12 +245,10 @@ public class StatusBarTest extends TestActivity mHandler.postDelayed(new Runnable() { public void run() { mNotificationManager.notify(1, - new Notification(StatusBarTest.this, + new Notification( R.drawable.ic_statusbar_missedcall, "tick tick tick", - System.currentTimeMillis()-(1000*60*60*24), - "(453) 123-2328", - "", null + System.currentTimeMillis()-(1000*60*60*24) )); } }, 3000); diff --git a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java index e0f0f05..f015378 100644 --- a/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java +++ b/tests/permission/src/com/android/framework/permission/tests/WindowManagerPermissionTests.java @@ -164,7 +164,7 @@ public class WindowManagerPermissionTests extends TestCase { } try { - mWm.setAppStartingWindow(null, "foo", 0, null, 0, 0, 0, null, false); + mWm.setAppStartingWindow(null, "foo", 0, null, null, 0, 0, 0, null, false); fail("IWindowManager.setAppStartingWindow did not throw SecurityException as" + " expected"); } catch (SecurityException e) { |