diff options
Diffstat (limited to 'tests')
15 files changed, 114 insertions, 15 deletions
diff --git a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java index d151d9e..77c0a3f 100644 --- a/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java +++ b/tests/DumpRenderTree/src/com/android/dumprendertree/TestShellActivity.java @@ -168,7 +168,7 @@ public class TestShellActivity extends Activity implements LayoutTestController } // This is asynchronous, but it gets processed by WebCore before it starts loading pages. - mWebViewClassic.useMockDeviceOrientation(); + mWebViewClassic.setUseMockDeviceOrientation(); } @Override diff --git a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java index fc22472..f958ade 100644 --- a/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java +++ b/tests/DumpRenderTree2/src/com/android/dumprendertree2/LayoutTestsExecutor.java @@ -394,7 +394,7 @@ public class LayoutTestsExecutor extends Activity { webViewSettings.setPageCacheCapacity(0); // This is asynchronous, but it gets processed by WebCore before it starts loading pages. - WebViewClassic.fromWebView(mCurrentWebView).useMockDeviceOrientation(); + WebViewClassic.fromWebView(mCurrentWebView).setUseMockDeviceOrientation(); // Must do this after setting the AppCache path. WebStorage.getInstance().deleteAllData(); diff --git a/tests/GridLayoutTest/AndroidManifest.xml b/tests/GridLayoutTest/AndroidManifest.xml index 141e8fa..677220d 100644 --- a/tests/GridLayoutTest/AndroidManifest.xml +++ b/tests/GridLayoutTest/AndroidManifest.xml @@ -83,6 +83,13 @@ <category android:name="android.intent.category.LAUNCHER"/> </intent-filter> </activity> + + <activity android:name="LayoutInsetsTest" android:label="LayoutInsetsTest"> + <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/res/drawable/btn_default.xml b/tests/GridLayoutTest/res/drawable/btn_default.xml new file mode 100644 index 0000000..c6cfda0 --- /dev/null +++ b/tests/GridLayoutTest/res/drawable/btn_default.xml @@ -0,0 +1,33 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2008 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. +--> + + +<selector xmlns:android="http://schemas.android.com/apk/res/android"> + <item android:state_window_focused="false" android:state_enabled="true" + android:drawable="@drawable/my_btn_default_normal" /> + <item android:state_window_focused="false" android:state_enabled="false" + android:drawable="@drawable/my_btn_default_normal" /> + <item android:state_pressed="true" + android:drawable="@drawable/my_btn_default_pressed" /> + <item android:state_focused="true" android:state_enabled="true" + android:drawable="@drawable/my_btn_default_selected" /> + <item android:state_enabled="true" + android:drawable="@drawable/my_btn_default_normal" /> + <item android:state_focused="true" + android:drawable="@drawable/my_btn_default_normal_disable_focused" /> + <item + android:drawable="@drawable/my_btn_default_normal_disable" /> +</selector> diff --git a/tests/GridLayoutTest/res/drawable/my_btn_default_normal.9.png b/tests/GridLayoutTest/res/drawable/my_btn_default_normal.9.png Binary files differnew file mode 100644 index 0000000..cd0b7d5 --- /dev/null +++ b/tests/GridLayoutTest/res/drawable/my_btn_default_normal.9.png diff --git a/tests/GridLayoutTest/res/drawable/my_btn_default_normal_disable.9.png b/tests/GridLayoutTest/res/drawable/my_btn_default_normal_disable.9.png Binary files differnew file mode 100755 index 0000000..f4f01c7 --- /dev/null +++ b/tests/GridLayoutTest/res/drawable/my_btn_default_normal_disable.9.png diff --git a/tests/GridLayoutTest/res/drawable/my_btn_default_normal_disable_focused.9.png b/tests/GridLayoutTest/res/drawable/my_btn_default_normal_disable_focused.9.png Binary files differnew file mode 100755 index 0000000..5376db2 --- /dev/null +++ b/tests/GridLayoutTest/res/drawable/my_btn_default_normal_disable_focused.9.png diff --git a/tests/GridLayoutTest/res/drawable/my_btn_default_pressed.9.png b/tests/GridLayoutTest/res/drawable/my_btn_default_pressed.9.png Binary files differnew file mode 100755 index 0000000..4312c27 --- /dev/null +++ b/tests/GridLayoutTest/res/drawable/my_btn_default_pressed.9.png diff --git a/tests/GridLayoutTest/res/drawable/my_btn_default_selected.9.png b/tests/GridLayoutTest/res/drawable/my_btn_default_selected.9.png Binary files differnew file mode 100755 index 0000000..06b7790 --- /dev/null +++ b/tests/GridLayoutTest/res/drawable/my_btn_default_selected.9.png diff --git a/tests/GridLayoutTest/res/layout/grid7.xml b/tests/GridLayoutTest/res/layout/grid7.xml index b9e58d7..0e5be0c 100644 --- a/tests/GridLayoutTest/res/layout/grid7.xml +++ b/tests/GridLayoutTest/res/layout/grid7.xml @@ -17,7 +17,7 @@ xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> - android:columnCount="2" + <Space android:layout_row="0" android:layout_column="0" diff --git a/tests/GridLayoutTest/src/com/android/test/layout/LayoutInsetsTest.java b/tests/GridLayoutTest/src/com/android/test/layout/LayoutInsetsTest.java new file mode 100644 index 0000000..74daccc --- /dev/null +++ b/tests/GridLayoutTest/src/com/android/test/layout/LayoutInsetsTest.java @@ -0,0 +1,59 @@ +package com.android.test.layout; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Rect; +import android.graphics.drawable.Drawable; +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.widget.Button; +import android.widget.EditText; +import android.widget.GridLayout; +import android.widget.Space; +import android.widget.TextView; + +import static android.text.InputType.TYPE_CLASS_TEXT; +import static android.text.InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS; +import static android.text.InputType.TYPE_TEXT_VARIATION_PASSWORD; +import static android.widget.GridLayout.*; +import static android.widget.GridLayout.FILL; +import static android.widget.GridLayout.spec; + +public class LayoutInsetsTest extends Activity { + public static View create(Context context) { + GridLayout p = new GridLayout(context); + p.setUseDefaultMargins(true); + p.setAlignmentMode(ALIGN_BOUNDS); + p.setOrientation(VERTICAL); + + { + TextView c = new TextView(context); + c.setTextSize(32); + c.setText("Email setup"); + p.addView(c); + } + { + Button c = new Button(context); + c.setBackgroundResource(R.drawable.btn_default); + c.setText("Manual setup"); + p.addView(c); + c.setOnClickListener(new OnClickListener() { + @Override + public void onClick(View v) { + Button b = (Button) v; + b.setEnabled(false); + } + }); + } + + return p; + } + + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + //getApplicationInfo().targetSdkVersion = Build.VERSION_CODES.ICE_CREAM_SANDWICH; + getApplicationInfo().targetSdkVersion = Build.VERSION_CODES.JELLY_BEAN; + setContentView(create(this)); + } +} diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java index 3e2a2ca..f52fe6f 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_element.java @@ -108,7 +108,7 @@ public class UT_element extends UnitTest { _RS_ASSERT("complexElemsimpleElem.getDataType() == NONE", complexElem.getDataType() == DataType.NONE); _RS_ASSERT("complexElem.getSizeBytes() == ScriptField_ComplexStruct.Item.sizeof", - complexElem.getSizeBytes() == ScriptField_ComplexStruct.Item.sizeof); + complexElem.getBytesSize() == ScriptField_ComplexStruct.Item.sizeof); for (int i = 0; i < subElemCount; i ++) { _RS_ASSERT("complexElem.getSubElement(i) != null", diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java index 1de4d71..ca54ac4 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_raster.java @@ -60,13 +60,13 @@ public class UT_program_raster extends UnitTest { } private void testJavaSide(RenderScript RS) { - _RS_ASSERT("pointSpriteEnabled.getPointSpriteEnabled() == true", - pointSpriteEnabled.getPointSpriteEnabled() == true); + _RS_ASSERT("pointSpriteEnabled.isPointSpriteEnabled() == true", + pointSpriteEnabled.isPointSpriteEnabled() == true); _RS_ASSERT("pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK", pointSpriteEnabled.getCullMode() == ProgramRaster.CullMode.BACK); - _RS_ASSERT("cullMode.getPointSpriteEnabled() == false", - cullMode.getPointSpriteEnabled() == false); + _RS_ASSERT("cullMode.isPointSpriteEnabled() == false", + cullMode.isPointSpriteEnabled() == false); _RS_ASSERT("cullMode.getCullMode() == ProgramRaster.CullMode.FRONT", cullMode.getCullMode() == ProgramRaster.CullMode.FRONT); } diff --git a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java index 72a401d..4410ee3 100644 --- a/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java +++ b/tests/RenderScriptTests/tests/src/com/android/rs/test/UT_program_store.java @@ -112,15 +112,15 @@ public class UT_program_store extends UnitTest { boolean B, boolean A, boolean dither) { - _RS_ASSERT("ps.getDepthMaskEnabled() == depthMask", ps.getDepthMaskEnabled() == depthMask); + _RS_ASSERT("ps.isDepthMaskEnabled() == depthMask", ps.isDepthMaskEnabled() == depthMask); _RS_ASSERT("ps.getDepthFunc() == df", ps.getDepthFunc() == df); _RS_ASSERT("ps.getBlendSrcFunc() == bsf", ps.getBlendSrcFunc() == bsf); _RS_ASSERT("ps.getBlendDstFunc() == bdf", ps.getBlendDstFunc() == bdf); - _RS_ASSERT("ps.getColorMaskREnabled() == R", ps.getColorMaskREnabled() == R); - _RS_ASSERT("ps.getColorMaskGEnabled() == G", ps.getColorMaskGEnabled() == G); - _RS_ASSERT("ps.getColorMaskBEnabled() == B", ps.getColorMaskBEnabled() == B); - _RS_ASSERT("ps.getColorMaskAEnabled() == A", ps.getColorMaskAEnabled() == A); - _RS_ASSERT("ps.getDitherEnabled() == dither", ps.getDitherEnabled() == dither); + _RS_ASSERT("ps.isColorMaskRedEnabled() == R", ps.isColorMaskRedEnabled() == R); + _RS_ASSERT("ps.isColorMaskGreenEnabled() == G", ps.isColorMaskGreenEnabled() == G); + _RS_ASSERT("ps.isColorMaskBlueEnabled () == B", ps.isColorMaskBlueEnabled () == B); + _RS_ASSERT("ps.isColorMaskAlphaEnabled() == A", ps.isColorMaskAlphaEnabled() == A); + _RS_ASSERT("ps.isDitherEnabled() == dither", ps.isDitherEnabled() == dither); } void varyBuilderColorAndDither(ProgramStore.Builder pb, diff --git a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java index ae01c75..5eac1f2 100644 --- a/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java +++ b/tests/StatusBar/src/com/android/statusbartest/NotificationTestList.java @@ -44,7 +44,7 @@ public class NotificationTestList extends TestActivity private final static String TAG = "NotificationTestList"; NotificationManager mNM; - Vibrator mVibrator = new Vibrator(); + Vibrator mVibrator = (Vibrator)getSystemService(VIBRATOR_SERVICE); Handler mHandler = new Handler(); long mActivityCreateTime = System.currentTimeMillis(); |
