diff --git a/CleanSpec.mk b/CleanSpec.mk index b2474c2..b84e1b6 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -44,7 +44,6 @@ #$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) #$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) -$(call add-clean-step, rm -rf $(HOST_OUT_INTERMEDIATES)/EXECUTABLES/vm-tests-tf_intermediates) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/CtsTestCaseList.mk b/CtsTestCaseList.mk index df7b03d..1d60713 100644 --- a/CtsTestCaseList.mk +++ b/CtsTestCaseList.mk @@ -12,6 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +CTS_APPS_LIST := \ + CtsVerifier + CTS_SECURITY_APPS_LIST := \ CtsAppAccessData \ CtsAppWithData \ @@ -26,18 +29,14 @@ CTS_SECURITY_APPS_LIST := \ # These test cases will be analyzed by the CTS API coverage tools. CTS_COVERAGE_TEST_CASE_LIST := \ - CtsAccelerationTestCases \ - CtsAccelerationTestStubs \ CtsAccessibilityServiceTestCases \ CtsAccountManagerTestCases \ - CtsAdminTestCases \ CtsAppTestCases \ CtsBluetoothTestCases \ CtsContentTestCases \ CtsDatabaseTestCases \ CtsDpiTestCases \ CtsDpiTestCases2 \ - CtsDrmTestCases \ CtsExampleTestCases \ CtsGestureTestCases \ CtsGraphicsTestCases \ @@ -46,34 +45,34 @@ CTS_COVERAGE_TEST_CASE_LIST := \ CtsLocationTestCases \ CtsMediaTestCases \ CtsNdefTestCases \ - CtsNetTestCases \ CtsOsTestCases \ CtsPermissionTestCases \ CtsPermission2TestCases \ CtsPreferenceTestCases \ CtsProviderTestCases \ - CtsRenderscriptTestCases \ CtsSaxTestCases \ CtsSecurityTestCases \ CtsSpeechTestCases \ CtsTelephonyTestCases \ CtsTestStubs \ CtsTextTestCases \ - CtsThemeTestCases \ CtsUtilTestCases \ CtsViewTestCases \ CtsWebkitTestCases \ - CtsWidgetTestCases + CtsWidgetTestCases \ + CtsNetTestCases \ + CtsPerformanceTestCases \ + CtsPerformance2TestCases \ + CtsPerformance3TestCases \ + CtsPerformance4TestCases \ + CtsPerformance5TestCases CTS_TEST_CASE_LIST := \ TestDeviceSetup \ CtsDelegatingAccessibilityService \ - CtsDeviceAdmin \ SignatureTest \ ApiDemos \ ApiDemosReferenceTest \ + $(CTS_APPS_LIST) \ $(CTS_COVERAGE_TEST_CASE_LIST) \ $(CTS_SECURITY_APPS_LIST) - -# The following files will be placed in the tools directory of the CTS distribution -CTS_TOOLS_LIST := diff --git a/CtsTestCoverage.mk b/CtsTestCoverage.mk index 8e00913..7053fea 100644 --- a/CtsTestCoverage.mk +++ b/CtsTestCoverage.mk @@ -19,30 +19,22 @@ include cts/CtsTestCaseList.mk -cts_api_coverage_exe := $(HOST_OUT_EXECUTABLES)/cts-api-coverage -dexdeps_exe := $(HOST_OUT_EXECUTABLES)/dexdeps +CTS_API_COVERAGE_EXE := $(HOST_OUT_EXECUTABLES)/cts-api-coverage +DEXDEPS_EXE := $(HOST_OUT_EXECUTABLES)/dexdeps -coverage_out := $(HOST_OUT)/cts-api-coverage +COVERAGE_OUT := $(HOST_OUT)/cts-api-coverage +cts-test-coverage-report := $(COVERAGE_OUT)/test-coverage.html +cts-verifier-coverage-report := $(COVERAGE_OUT)/verifier-coverage.html -api_text_description := $(SRC_API_DIR)/current.txt -api_xml_description := $(coverage_out)/api.xml -$(api_xml_description) : $(api_text_description) $(APICHECK) - $(hide) echo "Converting API file to XML: $@" - $(hide) mkdir -p $(coverage_out) - $(hide) $(APICHECK_COMMAND) -convert2xml $(api_text_description) $(api_xml_description) +CTS_API_COVERAGE_DEPENDENCIES := $(CTS_API_COVERAGE_EXE) $(DEXDEPS_EXE) $(ACP) -cts-test-coverage-report := $(coverage_out)/test-coverage.html -cts-verifier-coverage-report := $(coverage_out)/verifier-coverage.html - -cts_api_coverage_dependencies := $(cts_api_coverage_exe) $(dexdeps_exe) $(api_xml_description) $(ACP) - -$(cts-test-coverage-report) : $(CTS_COVERAGE_TEST_CASE_LIST) $(cts_api_coverage_dependencies) +$(cts-test-coverage-report) : $(CTS_COVERAGE_TEST_CASE_LIST) $(CTS_API_COVERAGE_DEPENDENCIES) $(call generate-coverage-report,"CTS Tests API Coverage Report",\ - $(CTS_COVERAGE_TEST_CASE_LIST),cts-test-apks,html,test-coverage.html) + $(CTS_COVERAGE_TEST_CASE_LIST),html,test-coverage.html) -$(cts-verifier-coverage-report) : CtsVerifier $(cts_api_coverage_dependencies) +$(cts-verifier-coverage-report) : CtsVerifier $(CTS_API_COVERAGE_DEPENDENCIES) $(call generate-coverage-report,"CTS Verifier API Coverage Report",\ - CtsVerifier,cts-verifier-apks,html,verifier-coverage.html) + CtsVerifier,html,verifier-coverage.html) .PHONY: cts-test-coverage cts-test-coverage : $(cts-test-coverage-report) @@ -59,18 +51,15 @@ endif # Arguments; # 1 - Name of the report printed out on the screen # 2 - Name of APK packages that will be scanned to generate the report -# 3 - Name of variable to hold the calculated paths of the APKs -# 4 - Format of the report -# 5 - Output file name of the report +# 3 - Format of the report +# 4 - Output file name of the report define generate-coverage-report - $(foreach testcase,$(2),$(eval $(call add-testcase-apk,$(3),$(testcase)))) - $(hide) mkdir -p $(coverage_out) - $(hide) $(cts_api_coverage_exe) -d $(dexdeps_exe) -a $(api_xml_description) -f $(4) -o $(coverage_out)/$(5) $($(3)) - $(hide) echo $(1): file://$(ANDROID_BUILD_TOP)/$(coverage_out)/$(5) + $(foreach testcase,$(2),$(eval $(call add-testcase-apk,$(testcase)))) + $(hide) mkdir -p $(COVERAGE_OUT) + $(hide) $(CTS_API_COVERAGE_EXE) -d $(DEXDEPS_EXE) -f $(3) -o $(COVERAGE_OUT)/$(4) $(TEST_APKS) + $(hide) echo $(1): file://$(ANDROID_BUILD_TOP)/$(COVERAGE_OUT)/$(4) endef -# classes.dex is stripped from package.apk if dex-preopt is enabled, -# so we use the copy that definitely includes classes.dex. define add-testcase-apk - $(1) += $(call intermediates-dir-for,APPS,$(2))/package.apk.unaligned + TEST_APKS += $(call intermediates-dir-for,APPS,$(1))/package.apk endef diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk index 16d3de1..bbf7eaf 100644 --- a/apps/CtsVerifier/Android.mk +++ b/apps/CtsVerifier/Android.mk @@ -25,9 +25,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_PACKAGE_NAME := CtsVerifier -LOCAL_JNI_SHARED_LIBRARIES := libctsverifier_jni libaudioquality libcameraanalyzer - -LOCAL_PROGUARD_FLAG_FILES := proguard.flags +LOCAL_JNI_SHARED_LIBRARIES := libctsverifier_jni libaudioquality LOCAL_SDK_VERSION := current @@ -39,31 +37,4 @@ cts-verifier: CtsVerifier adb adb install -r $(ANDROID_PRODUCT_OUT)/data/app/CtsVerifier.apk \ && adb shell "am start -n com.android.cts.verifier/.CtsVerifierActivity" -# -# Creates a "cts-verifier" directory that will contain: -# -# 1. Out directory with a "android-cts-verifier" containing the CTS Verifier -# and other binaries it needs. -# -# 2. Zipped version of the android-cts-verifier directory to be included with -# the build distribution. -# -cts-dir := $(HOST_OUT)/cts-verifier -verifier-dir-name := android-cts-verifier -verifier-dir := $(cts-dir)/$(verifier-dir-name) -verifier-zip-name := $(verifier-dir-name).zip -verifier-zip := $(cts-dir)/$(verifier-zip-name) - -cts : $(verifier-zip) -$(verifier-zip) : CtsVerifier $(ACP) $(HOST_OUT)/bin/cts-usb-accessory - $(hide) mkdir -p $(verifier-dir) - $(hide) $(ACP) -fp $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk \ - $(verifier-dir)/CtsVerifier.apk - $(hide) $(ACP) -fp $(HOST_OUT)/bin/cts-usb-accessory $(verifier-dir)/cts-usb-accessory - $(hide) cd $(cts-dir) && zip -rq $(verifier-dir-name) $(verifier-dir-name) - -ifneq ($(filter cts, $(MAKECMDGOALS)),) - $(call dist-for-goals, cts, $(verifier-zip):$(verifier-zip-name)) -endif - include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml index 1da4cb9..9bdb37a 100644 --- a/apps/CtsVerifier/AndroidManifest.xml +++ b/apps/CtsVerifier/AndroidManifest.xml @@ -18,26 +18,19 @@ - + android:versionName="1.0"> + - - + - - - + @@ -46,64 +39,11 @@ - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -112,90 +52,19 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + android:configChanges="keyboardHidden|orientation" /> + + @@ -206,21 +75,6 @@ - - - - - - - - - - @@ -236,17 +90,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/CtsVerifier/include/colorchecker/colorchecker.h b/apps/CtsVerifier/include/colorchecker/colorchecker.h deleted file mode 100644 index 5409b04..0000000 --- a/apps/CtsVerifier/include/colorchecker/colorchecker.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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. - */ - -#ifndef COLORCHECKER_H -#define COLORCHECKER_H - -/** Detects the 6x4 Xrite ColorChecker Classic pattern in the input image, - * and calculates the average color value per patch. - * - * All squares in the colorchecker pattern have to be fully visible, - * and the whole pattern should fill at least 1/3 of the image - * width. The pattern cannot be facing away from the camera at a very - * large angle (>45 degrees). If multiple 6x4 grids can be found, the - * one that is most front-facing will be returned. - * - * The average color is returned as a floating-point value per - * channel, linearized by an inverse gamma transform and normalized - * to 0-1 (255 = 1). The linearization is only approximate. - * - * @param inputImage Source image to detect the pattern in. Assumed - * to be a 3-channel interleaved image. Row-major - * @param width Width of input image - * @param height Height of input image - * @param patchColors Output 6x4 3-channel image of average patch - * values. Allocated by caller. Pass in NULL if - * the average values aren't needed. - * @param outputImage Resized inputImage with overlaid grid detection - * diagnostics. Image width is approximately 160 - * pixels. Pass in NULL if the diagnostic image - * isn't needed. - * @param outputWidth Actual width of outputImage. - * @param outputHeight Actual height of outputImage. - * - * @return true if a grid was found, false otherwise. If false, the - * input variables are unchanged. - */ -bool findColorChecker(const unsigned char *image, - int width, - int rowSpan, - int height, - float *patchColors, - unsigned char **outputImage, - int *outputWidth, - int *outputHeight); - - -#endif diff --git a/apps/CtsVerifier/jni/audioquality/Android.mk b/apps/CtsVerifier/jni/audioquality/Android.mk index 8e827f7..565cec2 100644 --- a/apps/CtsVerifier/jni/audioquality/Android.mk +++ b/apps/CtsVerifier/jni/audioquality/Android.mk @@ -20,7 +20,7 @@ LOCAL_CPP_EXTENSION := .cpp LOCAL_MODULE_TAGS := optional - +LOCAL_PRELINK_MODULE := false LOCAL_MODULE := libaudioquality LOCAL_SRC_FILES := Fft.cpp Window.cpp GlitchTest.cpp MeasureRms.cpp \ diff --git a/apps/CtsVerifier/jni/cameraanalyzer/Android.mk b/apps/CtsVerifier/jni/cameraanalyzer/Android.mk deleted file mode 100644 index ccc0998..0000000 --- a/apps/CtsVerifier/jni/cameraanalyzer/Android.mk +++ /dev/null @@ -1,34 +0,0 @@ -# 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. -# - -LOCAL_PATH := $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := libcameraanalyzer - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := com_android_cts_verifier_camera_analyzer_ColorChecker.cpp - -LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../include/colorchecker $(JNI_H_INCLUDE) - -LOCAL_STATIC_LIBRARIES := libcolorchecker -LOCAL_SHARED_LIBRARIES := libjnigraphics \ - libstlport \ - libcutils \ - libutils - -include $(BUILD_SHARED_LIBRARY) diff --git a/apps/CtsVerifier/jni/cameraanalyzer/com_android_cts_verifier_camera_analyzer_ColorChecker.cpp b/apps/CtsVerifier/jni/cameraanalyzer/com_android_cts_verifier_camera_analyzer_ColorChecker.cpp deleted file mode 100644 index 4d247ab..0000000 --- a/apps/CtsVerifier/jni/cameraanalyzer/com_android_cts_verifier_camera_analyzer_ColorChecker.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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. - */ - -#include "com_android_cts_verifier_camera_analyzer_ColorChecker.h" - -#include "utils/Log.h" -#include "android/bitmap.h" -#include "colorchecker.h" - -jboolean Java_com_android_cts_verifier_camera_analyzer_ColorChecker_findNative( - JNIEnv* env, - jobject thiz, - jobject inputBitmap) { - - // Verify that we can handle the input bitmap - AndroidBitmapInfo inputInfo; - AndroidBitmap_getInfo(env, inputBitmap, &inputInfo); - if (inputInfo.format != ANDROID_BITMAP_FORMAT_RGBA_8888 && - inputInfo.format != ANDROID_BITMAP_FORMAT_RGB_565) { - LOGE("Only RGBA_8888 and RGB_565 bitmaps are supported, was given type %d.", inputInfo.format); - return JNI_FALSE; - } - - // Get some references to the fields and class type of ColorChecker - jclass thizCls = env->GetObjectClass(thiz); - jfieldID patchId = env->GetFieldID(thizCls, "mPatchValues", "[F"); - jfieldID outputId = env->GetFieldID(thizCls, "mDebugOutput", "Landroid/graphics/Bitmap;"); - jfloatArray patchValues = (jfloatArray)env->GetObjectField(thiz, patchId); - - // Get raw inputs and outputs ready - - uint8_t *inputBuffer; - int result = AndroidBitmap_lockPixels( - env, - inputBitmap, - reinterpret_cast(&inputBuffer) ); - - if (result != ANDROID_BITMAP_RESUT_SUCCESS) { - LOGE("Unable to lock input bitmap"); - return JNI_FALSE; - } - - float *patchRawArray = env->GetFloatArrayElements(patchValues, - NULL); - - uint8_t *outputImage = NULL; - int outputWidth, outputHeight; - - // Find the color checker - bool success; - uint8_t *inputBufferRGBA = NULL; - int inputStride; - bool freeInputRGBA = false; - switch (inputInfo.format) { - case ANDROID_BITMAP_FORMAT_RGB_565: { - // First convert to RGBA_8888 - inputBufferRGBA = new uint8_t[inputInfo.width * - inputInfo.height * - 4]; - inputStride = inputInfo.width * 4; - uint8_t *outP = inputBufferRGBA; - for (int y = 0; y < inputInfo.height; y++ ) { - uint16_t *inP = (uint16_t*)(&inputBuffer[y * inputInfo.stride]); - for (int x = 0; x < inputInfo.width; x++) { - *(outP++) = ( ((*inP) >> 0) & 0x001F) << 3; - *(outP++) = ( ((*inP) >> 5) & 0x003F) << 2; - *(outP++) = ( ((*inP) >> 11) & 0x001F) << 3; - outP++; - inP++; - } - } - freeInputRGBA = true; - break; - } - case ANDROID_BITMAP_FORMAT_RGBA_8888: - // Already in RGBA - inputBufferRGBA = inputBuffer; - inputStride = inputInfo.stride; - break; - } - - success = findColorChecker(inputBufferRGBA, - inputInfo.width, - inputStride, - inputInfo.height, - patchRawArray, - &outputImage, - &outputWidth, - &outputHeight); - - // Clean up raw inputs/outputs - env->ReleaseFloatArrayElements(patchValues, patchRawArray, 0); - result = AndroidBitmap_unlockPixels(env, inputBitmap); - if (result != ANDROID_BITMAP_RESUT_SUCCESS) { - LOGE("Unable to unlock input bitmap"); - return JNI_FALSE; - } - - if (freeInputRGBA) { - delete inputBufferRGBA; - } - - // Create debug bitmap from output image data - if (outputImage != NULL) { - // Get method handles, create inputs to createBitmap - jclass bitmapClass = - env->FindClass("android/graphics/Bitmap"); - jclass bitmapConfigClass = - env->FindClass("android/graphics/Bitmap$Config"); - - jmethodID createBitmap = env->GetStaticMethodID( - bitmapClass, "createBitmap", - "(IILandroid/graphics/Bitmap$Config;)Landroid/graphics/Bitmap;"); - - jmethodID getConfig = env->GetStaticMethodID( - bitmapConfigClass, "valueOf", - "(Ljava/lang/String;)Landroid/graphics/Bitmap$Config;"); - - // Create bitmap config and bitmap - jstring bitmapConfigValue = env->NewStringUTF("ARGB_8888"); - jobject rgbaConfig = env->CallStaticObjectMethod(bitmapConfigClass, - getConfig, - bitmapConfigValue); - jobject outputBitmap = env->CallStaticObjectMethod(bitmapClass, - createBitmap, - outputWidth, - outputHeight, - rgbaConfig); - // Copy output image into it - uint8_t *outputBuffer; - int result = AndroidBitmap_lockPixels( - env, - outputBitmap, - reinterpret_cast(&outputBuffer) ); - - if (result != ANDROID_BITMAP_RESUT_SUCCESS) { - LOGE("Unable to lock output bitmap"); - return JNI_FALSE; - } - - memcpy(outputBuffer, outputImage, outputWidth * outputHeight * 4); - - result = AndroidBitmap_unlockPixels(env, outputBitmap); - if (result != ANDROID_BITMAP_RESUT_SUCCESS) { - LOGE("Unable to unlock output bitmap"); - return JNI_FALSE; - } - - // Write new Bitmap reference into mDebugOutput class member - env->SetObjectField(thiz, outputId, outputBitmap); - - delete outputImage; - } - if (!success) return JNI_FALSE; - - return JNI_TRUE; -} diff --git a/apps/CtsVerifier/jni/cameraanalyzer/com_android_cts_verifier_camera_analyzer_ColorChecker.h b/apps/CtsVerifier/jni/cameraanalyzer/com_android_cts_verifier_camera_analyzer_ColorChecker.h deleted file mode 100644 index a9b4487..0000000 --- a/apps/CtsVerifier/jni/cameraanalyzer/com_android_cts_verifier_camera_analyzer_ColorChecker.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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. - */ - -#ifndef JNI_CAMERAANALYZER_COLORCHECKER_H -#define JNI_CAMERAANALYZER_COLORCHECKER_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -JNIEXPORT jboolean JNICALL -Java_com_android_cts_verifier_camera_analyzer_ColorChecker_findNative( - JNIEnv *env, - jobject thiz, - jobject inputBitmap); - -#ifdef __cplusplus -} -#endif - -#endif /* JNI_CAMERAANALYZER_COLORCHECKER_H */ diff --git a/apps/CtsVerifier/jni/verifier/Android.mk b/apps/CtsVerifier/jni/verifier/Android.mk index da4687d..98a4678 100644 --- a/apps/CtsVerifier/jni/verifier/Android.mk +++ b/apps/CtsVerifier/jni/verifier/Android.mk @@ -21,7 +21,7 @@ LOCAL_MODULE := libctsverifier_jni LOCAL_MODULE_TAGS := optional - +LOCAL_PRELINK_MODULE := false LOCAL_SRC_FILES := \ CtsVerifierJniOnLoad.cpp \ diff --git a/apps/CtsVerifier/jni/verifier/com_android_cts_verifier_os_FileUtils.cpp b/apps/CtsVerifier/jni/verifier/com_android_cts_verifier_os_FileUtils.cpp index 9c69f1a..14e58eb 100644 --- a/apps/CtsVerifier/jni/verifier/com_android_cts_verifier_os_FileUtils.cpp +++ b/apps/CtsVerifier/jni/verifier/com_android_cts_verifier_os_FileUtils.cpp @@ -21,6 +21,7 @@ #include #include +static jclass gFileStatusClass; static jfieldID gFileStatusDevFieldID; static jfieldID gFileStatusInoFieldID; static jfieldID gFileStatusModeFieldID; @@ -94,19 +95,19 @@ int register_com_android_cts_verifier_os_FileUtils(JNIEnv* env) { jclass clazz = env->FindClass("com/android/cts/verifier/os/FileUtils"); - jclass fileStatusClass = env->FindClass("com/android/cts/verifier/os/FileUtils$FileStatus"); - gFileStatusDevFieldID = env->GetFieldID(fileStatusClass, "dev", "I"); - gFileStatusInoFieldID = env->GetFieldID(fileStatusClass, "ino", "I"); - gFileStatusModeFieldID = env->GetFieldID(fileStatusClass, "mode", "I"); - gFileStatusNlinkFieldID = env->GetFieldID(fileStatusClass, "nlink", "I"); - gFileStatusUidFieldID = env->GetFieldID(fileStatusClass, "uid", "I"); - gFileStatusGidFieldID = env->GetFieldID(fileStatusClass, "gid", "I"); - gFileStatusSizeFieldID = env->GetFieldID(fileStatusClass, "size", "J"); - gFileStatusBlksizeFieldID = env->GetFieldID(fileStatusClass, "blksize", "I"); - gFileStatusBlocksFieldID = env->GetFieldID(fileStatusClass, "blocks", "J"); - gFileStatusAtimeFieldID = env->GetFieldID(fileStatusClass, "atime", "J"); - gFileStatusMtimeFieldID = env->GetFieldID(fileStatusClass, "mtime", "J"); - gFileStatusCtimeFieldID = env->GetFieldID(fileStatusClass, "ctime", "J"); + gFileStatusClass = env->FindClass("com/android/cts/verifier/os/FileUtils$FileStatus"); + gFileStatusDevFieldID = env->GetFieldID(gFileStatusClass, "dev", "I"); + gFileStatusInoFieldID = env->GetFieldID(gFileStatusClass, "ino", "I"); + gFileStatusModeFieldID = env->GetFieldID(gFileStatusClass, "mode", "I"); + gFileStatusNlinkFieldID = env->GetFieldID(gFileStatusClass, "nlink", "I"); + gFileStatusUidFieldID = env->GetFieldID(gFileStatusClass, "uid", "I"); + gFileStatusGidFieldID = env->GetFieldID(gFileStatusClass, "gid", "I"); + gFileStatusSizeFieldID = env->GetFieldID(gFileStatusClass, "size", "J"); + gFileStatusBlksizeFieldID = env->GetFieldID(gFileStatusClass, "blksize", "I"); + gFileStatusBlocksFieldID = env->GetFieldID(gFileStatusClass, "blocks", "J"); + gFileStatusAtimeFieldID = env->GetFieldID(gFileStatusClass, "atime", "J"); + gFileStatusMtimeFieldID = env->GetFieldID(gFileStatusClass, "mtime", "J"); + gFileStatusCtimeFieldID = env->GetFieldID(gFileStatusClass, "ctime", "J"); return env->RegisterNatives(clazz, gMethods, sizeof(gMethods) / sizeof(JNINativeMethod)); diff --git a/apps/CtsVerifier/lib/Android.mk b/apps/CtsVerifier/lib/Android.mk deleted file mode 100644 index 56a3fa8..0000000 --- a/apps/CtsVerifier/lib/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -# -# 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. -# - -include $(call all-subdir-makefiles) diff --git a/apps/CtsVerifier/lib/colorchecker/Android.mk b/apps/CtsVerifier/lib/colorchecker/Android.mk deleted file mode 100644 index 97f0089..0000000 --- a/apps/CtsVerifier/lib/colorchecker/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -# 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. -# - -LOCAL_PATH := $(call my-dir) - -##################### -# Build image analysis library - -include $(CLEAR_VARS) -include external/stlport/libstlport.mk - -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE := libcolorchecker - -LOCAL_SRC_FILES += colorchecker.cpp -LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../include/colorchecker -LOCAL_SHARED_LIBRARIES := libstlport \ - libcutils \ - libutils - -include $(BUILD_STATIC_LIBRARY) diff --git a/apps/CtsVerifier/lib/colorchecker/colorchecker.cpp b/apps/CtsVerifier/lib/colorchecker/colorchecker.cpp deleted file mode 100644 index 1e0ae97..0000000 --- a/apps/CtsVerifier/lib/colorchecker/colorchecker.cpp +++ /dev/null @@ -1,714 +0,0 @@ -/* - * 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. - */ - -//#define LOG_NDEBUG 0 -#include -#include - -#include "colorchecker.h" -#include "grouping.h" -#include -#include -#include -#include -#include - -const int totalChannels = 4; // Input image channel count -const int colorChannels = 3; // Input image color channel count -const float gammaCorrection = 2.2; // Assumed gamma curve on input -const int thresholdSq = 675; // Threshold on pixel difference to be considered - // part of the same patch - -class PixelId { - public: - int id; - const unsigned char *p; - - PixelId(): id(0), p(NULL) {} - - bool operator!=(const PixelId &other) const { - int dR = ((int)p[0] - other.p[0]) * ((int)p[0] - other.p[0]); - int dG = ((int)p[1] - other.p[1]) * ((int)p[1] - other.p[1]); - int dB = ((int)p[2] - other.p[2]) * ((int)p[2] - other.p[2]); - int distSq = dR + dG + dB; - if (distSq > thresholdSq) return true; - else return false; - } -}; - -class ImageField: public Field { - public: - ImageField(int width, int height, const unsigned char *data): - mWidth(width), mHeight(height), pData(data) { - } - - PixelId operator() (int y, int x) const { - PixelId pId; - pId.p = pData + (y * mWidth + x ) * totalChannels; - if (mask.size() != 0) { - pId.id = mask[y][x]; - } - return pId; - } - - int getWidth() const { return mWidth; } - int getHeight() const { return mHeight; } - private: - int mWidth; - int mHeight; - const unsigned char *pData; -}; - -class PixelGroup { - public: - PixelGroup(int id, const ImageField *src): - mId(id), - mMinX(1e7), - mMinY(1e7), - mMaxX(0), - mMaxY(0), - mArea(0), - mSrc(src), - mRNeighbor(NULL), - mDNeighbor(NULL), - mLNeighbor(NULL), - mUNeighbor(NULL) { - mSum[0] = 0; - mSum[1] = 0; - mSum[2] = 0; - } - - struct IdCompare { - bool operator() (const PixelGroup* l, const PixelGroup* r) const { - return l->getId() < r->getId(); - } - }; - - void growGroup(int x, int y) { - if (x < mMinX) mMinX = x; - if (x > mMaxX) mMaxX = x; - if (y < mMinY) mMinY = y; - if (y > mMaxY) mMaxY = y; - mArea++; - const unsigned char *p = (*mSrc)(y,x).p; - mSum[0] += p[0]; - mSum[1] += p[1]; - mSum[2] += p[2]; - } - - int getId() const { - return mId; - } - - int getArea() const { - return mArea; - } - - int getBoundArea() const { - return (mMaxX - mMinX) * (mMaxY - mMinY); - } - - float getApproxAspectRatio() const { - return ((float)(mMaxY - mMinY)) / (mMaxX - mMinX); - } - - void getApproxCenter(int *x, int *y) const { - *x = (mMaxX + mMinX)/2; - *y = (mMaxY + mMinY)/2; - } - - void getBoundingBox(int *x1, int *y1, int *x2, int *y2) const { - *x1 = mMinX; - *x2 = mMaxX; - *y1 = mMinY; - *y2 = mMaxY; - } - - void getAvgValue(unsigned char *p) const { - p[0] = mSum[0] / mArea; - p[1] = mSum[1] / mArea; - p[2] = mSum[2] / mArea; - } - - bool operator<(const PixelGroup &other) const { - return mArea < other.getArea(); - } - - typedef std::set IdSet; - typedef std::set::iterator IdSetIter; - - void findNeighbors(IdSet &candidates) { - int cX, cY; - getApproxCenter(&cX, &cY); - int rDistSq = 1e9; // Larger than any reasonable image distance - int dDistSq = rDistSq; - - for (IdSetIter neighbor = candidates.begin(); - neighbor != candidates.end(); - neighbor++) { - if (*neighbor == this) continue; - int nX, nY; - (*neighbor)->getApproxCenter(&nX, &nY); - // 'right' means slope between (-1/3, 1/3), positive X change - if ( (nX - cX) > 0 ) { - float slope = ((float)(nY - cY)) / (nX - cX); - if (slope > -0.33 && slope < 0.33) { - int distSq = (nX - cX) * (nX - cX) + (nY - cY) * (nY - cY); - if (distSq < rDistSq) { - setRNeighbor(*neighbor); - rDistSq = distSq; - } - } - } - // 'down' means inv slope between (-1/3, 1/3), positive Y change - if ( (nY - cY) > 0) { - float invSlope = ((float)(nX - cX)) / (nY - cY); - if (invSlope > -0.33 && invSlope < 0.33) { - int distSq = (nX - cX) * (nX - cX) + (nY - cY) * (nY - cY); - if (distSq < dDistSq) { - setDNeighbor(*neighbor); - dDistSq = distSq; - } - } - } - } - // Do reverse links if possible - if (getRNeighbor() != NULL) { - getRNeighbor()->setLNeighbor(this); - } - if (getDNeighbor() != NULL) { - getDNeighbor()->setUNeighbor(this); - } - - } - - void setRNeighbor(PixelGroup *rNeighbor) { - mRNeighbor = rNeighbor; - } - - PixelGroup* getRNeighbor(int distance = 1) { - PixelGroup *current = this; - for (int i=0; i < distance; i++) { - if (current != NULL) { - current = current->mRNeighbor; - } else break; - } - return current; - } - - void setDNeighbor(PixelGroup *dNeighbor) { - mDNeighbor = dNeighbor; - } - - PixelGroup* getDNeighbor(int distance = 1) { - PixelGroup *current = this; - for (int i=0; i < distance; i++) { - if (current != NULL) { - current = current->mDNeighbor; - } else break; - } - return current; - } - - void setLNeighbor(PixelGroup *lNeighbor) { - mLNeighbor = lNeighbor; - } - - PixelGroup* getLNeighbor(int distance = 1) { - PixelGroup *current = this; - for (int i=0; i < distance; i++) { - if (current != NULL) { - current = current->mLNeighbor; - } else break; - } - return current; - } - - void setUNeighbor(PixelGroup *uNeighbor) { - mUNeighbor = uNeighbor; - } - - PixelGroup* getUNeighbor(int distance = 1) { - PixelGroup *current = this; - for (int i=0; i < distance; i++) { - if (current != NULL) { - current = current->mUNeighbor; - } else break; - } - return current; - } - - float distanceSqTo(const PixelGroup* other) { - int mX, mY; - getApproxCenter(&mX, &mY); - int oX, oY; - other->getApproxCenter(&oX, &oY); - int dx = (oX - mX); - int dy = (oY - mY); - return dx * dx + dy * dy; - } - - float distanceTo(const PixelGroup* other) { - return sqrt( distanceSqTo(other) ); - } - - private: - int mId; - int mMinX, mMinY; - int mMaxX, mMaxY; - int mArea; - int mSum[3]; - const ImageField *mSrc; - - PixelGroup *mRNeighbor; - PixelGroup *mDNeighbor; - PixelGroup *mLNeighbor; - PixelGroup *mUNeighbor; -}; - -/* Scales input down by factor of outScale to output. Assumes input size is - * exactly output size times scale */ -void downsample(const unsigned char *input, - unsigned char *output, - int rowSpan, - int outWidth, - int outHeight, - int outScale) { - for (int oY = 0, iY = 0; oY < outHeight; oY++, iY += outScale) { - for (int oX = 0, iX = 0; oX < outWidth; oX++, iX += outScale) { - short out[3] = {0,0,0}; - const unsigned char *in = input + iY * rowSpan + iX * totalChannels; - for (int j = 0; j < outScale; j++) { - for (int k = 0; k < outScale; k++) { - for (int i = 0; i < colorChannels; i++) { - out[i] += in[i]; - } - in += totalChannels; - } - in += rowSpan - outScale * totalChannels; - } - output[0] = out[0] / (outScale * outScale); - output[1] = out[1] / (outScale * outScale); - output[2] = out[2] / (outScale * outScale); - output += totalChannels; - } - } -} - -void drawLine(unsigned char *image, - int rowSpan, - int x0, int y0, - int x1, int y1, - int r, int g, int b) { - if ((x0 == x1) && (y0 == y1)) { - unsigned char *p = &image[(y0 * rowSpan + x0) * totalChannels]; - if (r != -1) p[0] = r; - if (g != -1) p[1] = g; - if (b != -1) p[2] = b; - return; - } - if ( std::abs(x1-x0) > std::abs(y1-y0) ) { - if (x0 > x1) { - std::swap(x0, x1); - std::swap(y0, y1); - } - float slope = (float)(y1 - y0) / (x1 - x0); - for (int x = x0; x <= x1; x++) { - int y = y0 + slope * (x - x0); - unsigned char *p = &image[(y * rowSpan + x) * totalChannels]; - if (r != -1) p[0] = r; - if (g != -1) p[1] = g; - if (b != -1) p[2] = b; - } - } else { - if (y0 > y1) { - std::swap(x0, x1); - std::swap(y0, y1); - } - float invSlope = (float)(x1 - x0) / (y1 - y0); - for (int y = y0; y <= y1; y++) { - int x = x0 + invSlope * (y - y0); - unsigned char *p = &image[(y*rowSpan + x) * totalChannels]; - if (r != -1) p[0] = r; - if (g != -1) p[1] = g; - if (b != -1) p[2] = b; - } - } - -} -bool findColorChecker(const unsigned char *image, - int width, - int rowSpan, - int height, - float *patchColors, - unsigned char **outputImage, - int *outputWidth, - int *outputHeight) { - int64_t startTime = systemTime(); - - const int outTargetWidth = 160; - const int outScale = width / outTargetWidth; - const int outWidth = width / outScale; - const int outHeight = height / outScale; - LOGV("Debug image dimensions: %d, %d", outWidth, outHeight); - - unsigned char *output = new unsigned char[outWidth * outHeight * totalChannels]; - - unsigned char *outP; - unsigned char *inP; - - // First step, downsample for speed/noise reduction - downsample(image, output, rowSpan, outWidth, outHeight, outScale); - - // Find connected components (groups) - ImageField outField(outWidth, outHeight, output); - Grouping(&outField); - - // Calculate component bounds and areas - std::vector groups; - groups.reserve(outField.id_no); - for (int i = 0; i < outField.id_no; i++) { - groups.push_back(PixelGroup(i + 1, &outField)); - } - - inP = output; - for (int y = 0; y < outHeight; y++) { - for (int x = 0; x < outWidth; x++) { - groups[ outField(y, x).id - 1].growGroup(x, y); - } - } - - // Filter out groups that are too small, too large, or have too - // non-square aspect ratio - PixelGroup::IdSet candidateGroups; - - // Maximum/minimum width assuming pattern is fully visible and > - // 1/3 the image in width - const int maxPatchWidth = outWidth / 6; - const int minPatchWidth = outWidth / 3 / 7; - const int maxPatchArea = maxPatchWidth * maxPatchWidth; - const int minPatchArea = minPatchWidth * minPatchWidth; - // Assuming nearly front-on view of target, so aspect ratio should - // be quite close to square - const float maxAspectRatio = 5.f / 4.f; - const float minAspectRatio = 4.f / 5.f; - for (int i = 0; i < (int)groups.size(); i++) { - float aspect = groups[i].getApproxAspectRatio(); - if (aspect < minAspectRatio || aspect > maxAspectRatio) continue; - // Check both boundary box area, and actual pixel count - they - // should both be within bounds for a roughly square patch. - int boundArea = groups[i].getBoundArea(); - if (boundArea < minPatchArea || boundArea > maxPatchArea) continue; - int area = groups[i].getArea(); - if (area < minPatchArea || area > maxPatchArea) continue; - candidateGroups.insert(&groups[i]); - } - - // Find neighbors for candidate groups. O(n^2), but not many - // candidates to go through - for (PixelGroup::IdSetIter group = candidateGroups.begin(); - group != candidateGroups.end(); - group++) { - (*group)->findNeighbors(candidateGroups); - } - - // Try to find a plausible 6x4 grid by taking each pixel group as - // the candidate top-left corner and try to build a grid from - // it. Assumes no missing patches. - float bestError = -1; - std::vector bestGrid(6 * 4,0); - for (PixelGroup::IdSetIter group = candidateGroups.begin(); - group != candidateGroups.end(); - group++) { - int dex, dey; (*group)->getApproxCenter(&dex, &dey); - std::vector grid(6 * 4, 0); - PixelGroup *tl = *group; - PixelGroup *bl, *tr, *br; - - // Find the bottom-left and top-right corners - if ( (bl = tl->getDNeighbor(3)) == NULL || - (tr = tl->getRNeighbor(5)) == NULL ) continue; - LOGV("Candidate at %d, %d", dex, dey); - LOGV(" Got BL and TR"); - - // Find the bottom-right corner - if ( tr->getDNeighbor(3) == NULL ) { - LOGV(" No BR from TR"); - continue; - } - br = tr->getDNeighbor(3); - if ( br != bl->getRNeighbor(5) ) { - LOGV(" BR from TR and from BL don't agree"); - continue; - } - br->getApproxCenter(&dex, &dey); - LOGV(" Got BR corner at %d, %d", dex, dey); - - // Check that matching grid edge lengths are about the same - float gridTopWidth = tl->distanceTo(tr); - float gridBotWidth = bl->distanceTo(br); - - if (gridTopWidth / gridBotWidth < minAspectRatio || - gridTopWidth / gridBotWidth > maxAspectRatio) continue; - LOGV(" Got reasonable widths: %f %f", gridTopWidth, gridBotWidth); - - float gridLeftWidth = tl->distanceTo(bl); - float gridRightWidth = tr->distanceTo(br); - - if (gridLeftWidth / gridRightWidth < minAspectRatio || - gridLeftWidth / gridRightWidth > maxAspectRatio) continue; - LOGV(" Got reasonable heights: %f %f", gridLeftWidth, gridRightWidth); - - // Calculate average grid spacing - float gridAvgXGap = (gridTopWidth + gridBotWidth) / 2 / 5; - float gridAvgYGap = (gridLeftWidth + gridRightWidth) / 2 / 3; - - // Calculate total error between average grid spacing and - // actual spacing Uses difference in expected squared distance - // and actual squared distance - float error = 0; - for (int x = 0; x < 6; x++) { - for (int y = 0; y < 4; y++) { - PixelGroup *node; - node = tl->getRNeighbor(x)->getDNeighbor(y); - if (node == NULL) { - error += outWidth * outWidth; - grid[y * 6 + x] = 0; - } else { - grid[y * 6 + x] = node->getId(); - if (node == tl) continue; - float dist = tl->distanceSqTo(node); - float expXDist = (gridAvgXGap * x); - float expYDist = (gridAvgYGap * y); - float expDist = expXDist * expXDist + expYDist * expYDist; - error += fabs(dist - expDist); - } - } - } - if (bestError == -1 || - bestError > error) { - bestGrid = grid; - bestError = error; - LOGV(" Best candidate, error %f", error); - } - } - - // Check if a grid wasn't found - if (bestError == -1) { - LOGV("No color checker found!"); - } - - // Make sure black square is in bottom-right corner - if (bestError != -1) { - unsigned char tlValues[3]; - unsigned char brValues[3]; - int tlId = bestGrid[0]; - int brId = bestGrid[23]; - - groups[tlId - 1].getAvgValue(tlValues); - groups[brId - 1].getAvgValue(brValues); - - int tlSum = tlValues[0] + tlValues[1] + tlValues[2]; - int brSum = brValues[0] + brValues[1] + brValues[2]; - if (brSum > tlSum) { - // Grid is upside down, need to flip! - LOGV("Flipping grid to put grayscale ramp at bottom"); - bestGrid = std::vector(bestGrid.rbegin(), bestGrid.rend()); - } - } - - // Output average patch colors if requested - if (bestError != -1 && patchColors != NULL) { - for (int n = 0; n < 6 * 4 * colorChannels; n++) patchColors[n] = -1.f; - - // Scan over original input image for grid regions, degamma, average - for (int px = 0; px < 6; px++) { - for (int py = 0; py < 4; py++) { - int id = bestGrid[py * 6 + px]; - if (id == 0) continue; - - PixelGroup &patch = groups[id - 1]; - int startX, startY; - int endX, endY; - patch.getBoundingBox(&startX, &startY, &endX, &endY); - - float sum[colorChannels] = {0.f}; - int count = 0; - for (int y = startY; y <= endY; y++) { - for (int x = startX; x < endX; x++) { - if (outField(y,x).id != id) continue; - for (int iY = y * outScale; - iY < (y + 1) * outScale; - iY++) { - const unsigned char *inP = image + - (iY * rowSpan) - + (x * outScale * totalChannels); - for (int iX = 0; iX < outScale; iX++) { - for (int c = 0; c < colorChannels; c++) { - // Convert to float and normalize - float v = inP[c] / 255.f; - // Gamma correct to get back to - // roughly linear data - v = pow(v, gammaCorrection); - // Sum it up - sum[c] += v; - } - count++; - inP += totalChannels; - } - } - } - } - for (int c = 0 ; c < colorChannels; c++) { - patchColors[ (py * 6 + px) * colorChannels + c ] = - sum[c] / count; - } - } - } - // Print out patch colors - IF_LOGV() { - for (int y = 0; y < 4; y++) { - char tmpMsg[256]; - int cnt = 0; - cnt = snprintf(tmpMsg, 256, "%02d:", y + 1); - for (int x = 0; x < 6; x++) { - int id = bestGrid[y * 6 + x]; - if (id != 0) { - float *p = &patchColors[ (y * 6 + x) * colorChannels]; - cnt += snprintf(tmpMsg + cnt, 256 - cnt, - "\t(%.3f,%.3f,%.3f)", p[0], p[1], p[2]); - } else { - cnt += snprintf(tmpMsg + cnt, 256 - cnt, - "\t(xxx,xxx,xxx)"); - } - } - LOGV("%s", tmpMsg); - } - } - } - - // Draw output if requested - if (outputImage != NULL) { - *outputImage = output; - *outputWidth = outWidth; - *outputHeight = outHeight; - - // Draw all candidate group bounds - for (PixelGroup::IdSetIter group = candidateGroups.begin(); - group != candidateGroups.end(); - group++) { - - int x,y; - (*group)->getApproxCenter(&x, &y); - - // Draw candidate bounding box - int x0, y0, x1, y1; - (*group)->getBoundingBox(&x0, &y0, &x1, &y1); - drawLine(output, outWidth, - x0, y0, x1, y0, - 255, 0, 0); - drawLine(output, outWidth, - x1, y0, x1, y1, - 255, 0, 0); - drawLine(output, outWidth, - x1, y1, x0, y1, - 255, 0, 0); - drawLine(output, outWidth, - x0, y1, x0, y0, - 255, 0, 0); - - // Draw lines between neighbors - // Red for to-right and to-below of me connections - const PixelGroup *neighbor; - if ( (neighbor = (*group)->getRNeighbor()) != NULL) { - int nX, nY; - neighbor->getApproxCenter(&nX, &nY); - drawLine(output, - outWidth, - x, y, nX, nY, - 255, -1, -1); - } - if ( (neighbor = (*group)->getDNeighbor()) != NULL) { - int nX, nY; - neighbor->getApproxCenter(&nX, &nY); - drawLine(output, - outWidth, - x, y, nX, nY, - 255, -1, -1); - } - // Blue for to-left or to-above of me connections - if ( (neighbor = (*group)->getLNeighbor()) != NULL) { - int nX, nY; - neighbor->getApproxCenter(&nX, &nY); - drawLine(output, - outWidth, - x, y, nX, nY, - -1, -1, 255); - } - if ( (neighbor = (*group)->getUNeighbor()) != NULL) { - int nX, nY; - neighbor->getApproxCenter(&nX, &nY); - drawLine(output, - outWidth, - x, y, nX, nY, - -1, -1, 255); - } - } - - // Mark found grid patch pixels - if (bestError != -1) { - for (int x=0; x < 6; x++) { - for (int y =0; y < 4; y++) { - int id = bestGrid[y * 6 + x]; - if (id != 0) { - int x0, y0, x1, y1; - groups[id - 1].getBoundingBox(&x0, &y0, &x1, &y1); - // Fill patch pixels with blue - for (int px = x0; px < x1; px++) { - for (int py = y0; py < y1; py++) { - if (outField(py,px).id != id) continue; - unsigned char *p = - &output[(py * outWidth + px) - * totalChannels]; - p[0] = 0; - p[1] = 0; - p[2] = 255; - - } - } - drawLine(output, outWidth, - x0, y0, x1, y1, - 0, 255, 0); - drawLine(output, outWidth, - x0, y1, x0, y1, - 0, 255, 0); - } - } - } - } - - } else { - delete output; - } - - int64_t endTime = systemTime(); - LOGV("Process time: %f ms", - (endTime - startTime) / 1000000.); - - if (bestError == -1) return false; - - return true; -} diff --git a/apps/CtsVerifier/lib/colorchecker/grouping.h b/apps/CtsVerifier/lib/colorchecker/grouping.h deleted file mode 100755 index 3125f55..0000000 --- a/apps/CtsVerifier/lib/colorchecker/grouping.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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. - */ - -#include -#include - -#ifndef FILTERPACK_CALIBRATION_GROUPING_H -#define FILTERPACK_CALIBRATION_GROUPING_H - -// To use the Grouping function, derive one class from Field. -// Field class provides the interface for the Grouping function. -// FF_ID is the pixel class used to compare values, -// != operator must be defined in this class -// region number of the pixel - -typedef std::vector > MASK; -typedef std::pair POS; -// FF_ID needs to implement the operator != -// bool operator != (const FF_ID &id) -template -class Field { - public: - int id_no; - MASK mask; - virtual FF_ID operator () (int y, int x) const =0 ; - virtual int getWidth() const = 0; - virtual int getHeight() const= 0; - virtual ~Field() {} -}; - -template < class FF_ID> -void FloodFill(int sx, - int sy, - int id_no, - const FF_ID &id, - Field *pField, - POS *new_pos) { - std::vector stack; - stack.push_back(POS(sx,sy)); - while (stack.size() > 0) { - sx = stack.back().first; - sy = stack.back().second; - stack.pop_back(); - - // fill the current line - int x; - for (x = sx-1; x >= 0; x--) - { - if (pField->mask[sy][x]!=0) break; - if (id != (*pField)(sy,x)) { - new_pos->first = x; - new_pos->second =sy; - break; - } - pField->mask[sy][x] = id_no; - } - int startx = x; - for (x = sx;x < pField->getWidth(); x++) { - if (pField->mask[sy][x]!=0) break; - if (id != (*pField)(sy,x)) { - new_pos->first = x; - new_pos->second =sy; - break; - } - pField->mask[sy][x] = id_no; - } - int endx = x; - if (endx >= pField->getWidth()) endx = pField->getWidth() - 1; - if (startx < 0) startx = 0; - // push the adjacent spans to the stack - if (sy>0) { - int bNew = true; - for (x = endx; x >= startx; x--) { - if (pField->mask[sy-1][x] != 0 || id != (*pField)(sy-1,x) ) { - bNew = true; - continue; - } - if (bNew) { - stack.push_back( POS(x, sy-1)); - bNew = false; - } - } - } - if (sy < (pField->getHeight() - 1)) { - int bNew = true; - for (x = endx; x >= startx; x--) { - if (pField->mask[sy+1][x]!=0 || id != (*pField)(sy+1,x)) { - bNew = true; - continue; - } - if (bNew) { - stack.push_back( POS(x, sy+1)); - bNew = false; - } - } - } - } -} - -// Group the pixels in Field based on the FF_ID != operator. -// All pixels will be labeled from 1. The total number of unique groups(regions) -// is (pField->id_no - 1) after the call -// The labeasl of the pixels are stored in the mask member of Field. - -template -void Grouping(Field *pField) { - int width = pField->getWidth(); - int height = pField->getHeight(); - pField->mask = MASK(height, std::vector (width, 0) ); - - FF_ID id; - pField->id_no = 1; - int sx = width / 2, sy = height / 2; - POS new_pos(-1,-1); - while (1) { - id = (*pField)(sy,sx); - int id_no = pField->id_no; - new_pos.first = -1; - new_pos.second = -1; - FloodFill(sx, sy, id_no, id, pField, &new_pos); - if (new_pos.first < 0) // no new position found, during the flood fill - { - const int kNumOfRetries = 10; - // try 10 times for the new unfilled position - for (int i = 0; i < kNumOfRetries; i++) { - sx = rand() % width; - sy = rand() % height; - if (pField->mask[sy][sx] == 0) { - new_pos.first = sx; - new_pos.second = sy; - break; - } - } - if (new_pos.first < 0) { // still failed, search the whole image - for (int y = 0; y < height && new_pos.first < 0; y++) - for (int x = 0; x < width; x++) { - if (pField->mask[y][x] == 0) { - new_pos.first = x; - new_pos.second = y; - break; - } - } - } - if (new_pos.first < 0) break; // finished - } - sx = new_pos.first; - sy = new_pos.second; - pField->id_no++; - } -} - -#endif diff --git a/apps/CtsVerifier/proguard.flags b/apps/CtsVerifier/proguard.flags deleted file mode 100644 index ddaf962..0000000 --- a/apps/CtsVerifier/proguard.flags +++ /dev/null @@ -1,8 +0,0 @@ --keepclasseswithmembernames class * { - native ; -} - --keepclassmembers class com.android.cts.verifier.os.FileUtils$FileStatus { - private ; -} - diff --git a/apps/CtsVerifier/res/drawable/gray_bubble.xml b/apps/CtsVerifier/res/drawable/gray_bubble.xml deleted file mode 100644 index 66eda76..0000000 --- a/apps/CtsVerifier/res/drawable/gray_bubble.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/apps/CtsVerifier/res/layout-land/usb_main.xml b/apps/CtsVerifier/res/layout-land/usb_main.xml deleted file mode 100644 index 139b54b..0000000 --- a/apps/CtsVerifier/res/layout-land/usb_main.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/apps/CtsVerifier/res/layout/bt_connection_access.xml b/apps/CtsVerifier/res/layout/bt_connection_access.xml deleted file mode 100644 index ae373f4..0000000 --- a/apps/CtsVerifier/res/layout/bt_connection_access.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - diff --git a/tests/res/layout/calendarview.xml b/tests/res/layout/calendarview.xml deleted file mode 100644 index 2a2303e..0000000 --- a/tests/res/layout/calendarview.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/tests/res/layout/checkbox.xml b/tests/res/layout/checkbox.xml deleted file mode 100644 index 3fc6b17..0000000 --- a/tests/res/layout/checkbox.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/checkbox_checked.xml b/tests/res/layout/checkbox_checked.xml deleted file mode 100644 index e1d8c02..0000000 --- a/tests/res/layout/checkbox_checked.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/tests/res/layout/checkedtextview_layout.xml b/tests/res/layout/checkedtextview_layout.xml index d5b9c1f..f8085a3 100644 --- a/tests/res/layout/checkedtextview_layout.xml +++ b/tests/res/layout/checkedtextview_layout.xml @@ -16,7 +16,7 @@ + android:layout_height="wrap_content"> - - - diff --git a/tests/res/layout/dialog_stub_layout.xml b/tests/res/layout/dialog_stub_layout.xml index b0a8861..11b502f 100644 --- a/tests/res/layout/dialog_stub_layout.xml +++ b/tests/res/layout/dialog_stub_layout.xml @@ -14,8 +14,65 @@ limitations under the License. --> - - + + + - - - - diff --git a/tests/res/layout/mediaplayer.xml b/tests/res/layout/mediaplayer.xml index aa66e64..31ef492 100644 --- a/tests/res/layout/mediaplayer.xml +++ b/tests/res/layout/mediaplayer.xml @@ -25,16 +25,4 @@ android:layout_gravity="center"> - - - - - - diff --git a/tests/res/layout/orange_dark.xml b/tests/res/layout/orange_dark.xml deleted file mode 100644 index 3bed6ce..0000000 --- a/tests/res/layout/orange_dark.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/orange_light.xml b/tests/res/layout/orange_light.xml deleted file mode 100644 index f4e4724..0000000 --- a/tests/res/layout/orange_light.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/progressbar.xml b/tests/res/layout/progressbar.xml deleted file mode 100644 index e54b4b0..0000000 --- a/tests/res/layout/progressbar.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/tests/res/layout/progressbar_horizontal0.xml b/tests/res/layout/progressbar_horizontal0.xml deleted file mode 100644 index f946b7a..0000000 --- a/tests/res/layout/progressbar_horizontal0.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/tests/res/layout/progressbar_horizontal100.xml b/tests/res/layout/progressbar_horizontal100.xml deleted file mode 100644 index 034cc83..0000000 --- a/tests/res/layout/progressbar_horizontal100.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/tests/res/layout/progressbar_horizontal50.xml b/tests/res/layout/progressbar_horizontal50.xml deleted file mode 100644 index 0c093ae..0000000 --- a/tests/res/layout/progressbar_horizontal50.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/tests/res/layout/progressbar_large.xml b/tests/res/layout/progressbar_large.xml deleted file mode 100644 index 9eb26ad..0000000 --- a/tests/res/layout/progressbar_large.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/progressbar_small.xml b/tests/res/layout/progressbar_small.xml deleted file mode 100644 index ae2b561..0000000 --- a/tests/res/layout/progressbar_small.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/purple.xml b/tests/res/layout/purple.xml deleted file mode 100644 index 507c485..0000000 --- a/tests/res/layout/purple.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/radiobutton.xml b/tests/res/layout/radiobutton.xml deleted file mode 100644 index 6b832bf..0000000 --- a/tests/res/layout/radiobutton.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/radiobutton_checked.xml b/tests/res/layout/radiobutton_checked.xml deleted file mode 100644 index 8f76f6a..0000000 --- a/tests/res/layout/radiobutton_checked.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/tests/res/layout/radiogroup_horizontal.xml b/tests/res/layout/radiogroup_horizontal.xml deleted file mode 100644 index 32cfc8a..0000000 --- a/tests/res/layout/radiogroup_horizontal.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - diff --git a/tests/res/layout/radiogroup_vertical.xml b/tests/res/layout/radiogroup_vertical.xml deleted file mode 100644 index 71987d7..0000000 --- a/tests/res/layout/radiogroup_vertical.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - diff --git a/tests/res/layout/ratingbar_0.xml b/tests/res/layout/ratingbar_0.xml deleted file mode 100644 index 232a573..0000000 --- a/tests/res/layout/ratingbar_0.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/ratingbar_2point5.xml b/tests/res/layout/ratingbar_2point5.xml deleted file mode 100644 index e5e9dbe..0000000 --- a/tests/res/layout/ratingbar_2point5.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/ratingbar_5.xml b/tests/res/layout/ratingbar_5.xml deleted file mode 100644 index 4169a53..0000000 --- a/tests/res/layout/ratingbar_5.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/red_dark.xml b/tests/res/layout/red_dark.xml deleted file mode 100644 index 9a7b0bc..0000000 --- a/tests/res/layout/red_dark.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/red_light.xml b/tests/res/layout/red_light.xml deleted file mode 100644 index 469751d..0000000 --- a/tests/res/layout/red_light.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/searchview.xml b/tests/res/layout/searchview.xml deleted file mode 100644 index dba105a..0000000 --- a/tests/res/layout/searchview.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/tests/res/layout/seekbar_0.xml b/tests/res/layout/seekbar_0.xml deleted file mode 100644 index bac53e2..0000000 --- a/tests/res/layout/seekbar_0.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/tests/res/layout/seekbar_100.xml b/tests/res/layout/seekbar_100.xml deleted file mode 100644 index 9114ac0..0000000 --- a/tests/res/layout/seekbar_100.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/tests/res/layout/seekbar_50.xml b/tests/res/layout/seekbar_50.xml deleted file mode 100644 index f10d4ee..0000000 --- a/tests/res/layout/seekbar_50.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/tests/res/layout/spinner.xml b/tests/res/layout/spinner.xml deleted file mode 100644 index d0b453f..0000000 --- a/tests/res/layout/spinner.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/tests/res/layout/tabhost.xml b/tests/res/layout/tabhost.xml deleted file mode 100644 index ab3a55c..0000000 --- a/tests/res/layout/tabhost.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - diff --git a/tests/res/layout/testing_activity.xml b/tests/res/layout/testing_activity.xml deleted file mode 100644 index 8b9a47a..0000000 --- a/tests/res/layout/testing_activity.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - diff --git a/tests/res/layout/textview.xml b/tests/res/layout/textview.xml deleted file mode 100644 index 41fd0df..0000000 --- a/tests/res/layout/textview.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/tests/res/layout/textview_layout.xml b/tests/res/layout/textview_layout.xml index 0c6796b..d0ed1e0 100644 --- a/tests/res/layout/textview_layout.xml +++ b/tests/res/layout/textview_layout.xml @@ -48,41 +48,6 @@ android:text="@string/text_view_hello" android:layout_width="wrap_content" android:layout_height="wrap_content"/> - - - - - - - - diff --git a/tests/res/layout/themetestlistactivity.xml b/tests/res/layout/themetestlistactivity.xml deleted file mode 100644 index beb7f8c..0000000 --- a/tests/res/layout/themetestlistactivity.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/tests/res/layout/toggle_button.xml b/tests/res/layout/toggle_button.xml deleted file mode 100644 index 87104f2..0000000 --- a/tests/res/layout/toggle_button.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - diff --git a/tests/res/layout/toggle_button_checked.xml b/tests/res/layout/toggle_button_checked.xml deleted file mode 100644 index 5832f4c..0000000 --- a/tests/res/layout/toggle_button_checked.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - diff --git a/tests/res/layout/view_layout.xml b/tests/res/layout/view_layout.xml index 4443ba8..3cc1d64 100644 --- a/tests/res/layout/view_layout.xml +++ b/tests/res/layout/view_layout.xml @@ -36,14 +36,6 @@ android:fadingEdge="horizontal|vertical" android:fadingEdgeLength="20px"/> - - + android:layout_height="wrap_content"> + android:layout_width="wrap_content" + android:layout_height="wrap_content" /> diff --git a/tests/res/layout/zoomcontrols.xml b/tests/res/layout/zoomcontrols.xml deleted file mode 100644 index f4acc6e..0000000 --- a/tests/res/layout/zoomcontrols.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - diff --git a/tests/res/menu/menu_searchview.xml b/tests/res/menu/menu_searchview.xml deleted file mode 100644 index d9f6475..0000000 --- a/tests/res/menu/menu_searchview.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/tests/res/raw/samplefont.ttf b/tests/res/raw/samplefont.ttf deleted file mode 100644 index 49f1c62..0000000 Binary files a/tests/res/raw/samplefont.ttf and /dev/null differ diff --git a/tests/res/raw/sphere.a3d b/tests/res/raw/sphere.a3d deleted file mode 100644 index 3d78b01..0000000 Binary files a/tests/res/raw/sphere.a3d and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp deleted file mode 100644 index e6dfdcd..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp deleted file mode 100644 index 0d73ba2..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_mono_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp deleted file mode 100644 index 4d63192..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp deleted file mode 100644 index fc007d9..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_128kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz.3gp deleted file mode 100644 index c7a04f0..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_22050hz.3gp deleted file mode 100644 index ad7eca1..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_12fps_aac_stereo_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_11025hz.3gp deleted file mode 100644 index 63add5e..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_22050hz.3gp deleted file mode 100644 index 25103ee..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_mono_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz.3gp deleted file mode 100644 index d38a8b6..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp deleted file mode 100644 index c0bef56..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_128kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz.3gp deleted file mode 100644 index aee6c61..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_22050hz.3gp deleted file mode 100644 index 95a6e25..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_300kbps_25fps_aac_stereo_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp deleted file mode 100644 index d2a6ddf..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp deleted file mode 100644 index b7c2bed..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_mono_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp deleted file mode 100644 index 4b10c21..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp deleted file mode 100644 index 61e90a6..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_128kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp deleted file mode 100644 index 9ce8a32..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp deleted file mode 100644 index eec1e10..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_12fps_aac_stereo_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp deleted file mode 100644 index b39c665..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp deleted file mode 100644 index e50f329..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_mono_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp deleted file mode 100644 index cc50019..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_22050hz.3gp deleted file mode 100644 index 64be17e..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_128kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp deleted file mode 100644 index 22a7b8b..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_11025hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp b/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp deleted file mode 100644 index 55a73ec..0000000 Binary files a/tests/res/raw/video_176x144_3gp_h263_56kbps_25fps_aac_stereo_24kbps_22050hz.3gp and /dev/null differ diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4 deleted file mode 100644 index 601dda1..0000000 Binary files a/tests/res/raw/video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4 and /dev/null differ diff --git a/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4 deleted file mode 100644 index 571ff44..0000000 Binary files a/tests/res/raw/video_480x360_mp4_h264_1000kbps_30fps_aac_stereo_128kbps_44100hz.mp4 and /dev/null differ diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4 deleted file mode 100644 index 5772810..0000000 Binary files a/tests/res/raw/video_480x360_mp4_h264_1350kbps_25fps_aac_stereo_128kbps_44100hz.mp4 and /dev/null differ diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4 deleted file mode 100644 index 36cd1b1..0000000 Binary files a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_128kbps_44100hz.mp4 and /dev/null differ diff --git a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4 deleted file mode 100644 index 63e25b8..0000000 Binary files a/tests/res/raw/video_480x360_mp4_h264_1350kbps_30fps_aac_stereo_192kbps_44100hz.mp4 and /dev/null differ diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4 deleted file mode 100644 index c5bae27..0000000 Binary files a/tests/res/raw/video_480x360_mp4_h264_500kbps_25fps_aac_stereo_128kbps_44100hz.mp4 and /dev/null differ diff --git a/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4 b/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4 deleted file mode 100644 index 5f7c928..0000000 Binary files a/tests/res/raw/video_480x360_mp4_h264_500kbps_30fps_aac_stereo_128kbps_44100hz.mp4 and /dev/null differ diff --git a/tests/res/values-h550dp/configVarying.xml b/tests/res/values-h550dp/configVarying.xml deleted file mode 100755 index 2faab0e..0000000 --- a/tests/res/values-h550dp/configVarying.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - simple h550 - - bag h550 - - 550 - 550 - diff --git a/tests/res/values-h670dp/configVarying.xml b/tests/res/values-h670dp/configVarying.xml deleted file mode 100755 index 21ade5b..0000000 --- a/tests/res/values-h670dp/configVarying.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - simple h670 - - bag h670 - - 670 - 670 - diff --git a/tests/res/values-land/dimens.xml b/tests/res/values-land/dimens.xml deleted file mode 100644 index 88220fa..0000000 --- a/tests/res/values-land/dimens.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - 480dp - 320dp - diff --git a/tests/res/values-sw600dp-land/configVarying.xml b/tests/res/values-sw600dp-land/configVarying.xml deleted file mode 100755 index c18dda6..0000000 --- a/tests/res/values-sw600dp-land/configVarying.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - simple sw600 land - - bag sw600 land - - 600 land - diff --git a/tests/res/values-sw600dp-land/dimens.xml b/tests/res/values-sw600dp-land/dimens.xml deleted file mode 100644 index 1b1c95e..0000000 --- a/tests/res/values-sw600dp-land/dimens.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - 1024dip - 600dip - diff --git a/tests/res/values-sw600dp/configVarying.xml b/tests/res/values-sw600dp/configVarying.xml deleted file mode 100755 index 5ecea45..0000000 --- a/tests/res/values-sw600dp/configVarying.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - simple sw600 - - bag sw600 - - 600 - diff --git a/tests/res/values-sw600dp/dimens.xml b/tests/res/values-sw600dp/dimens.xml deleted file mode 100644 index ab7b464..0000000 --- a/tests/res/values-sw600dp/dimens.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - 600dp - 1024dp - diff --git a/tests/res/values-sw720dp/configVarying.xml b/tests/res/values-sw720dp/configVarying.xml deleted file mode 100755 index 99af476..0000000 --- a/tests/res/values-sw720dp/configVarying.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - simple sw720 - - bag sw720 - - 720 - diff --git a/tests/res/values-v13/strings.xml b/tests/res/values-v13/strings.xml index c3f723c..d71936a 100644 --- a/tests/res/values-v13/strings.xml +++ b/tests/res/values-v13/strings.xml @@ -16,4 +16,5 @@ v13cur + v13old diff --git a/tests/res/values-v14/strings.xml b/tests/res/values-v14/strings.xml deleted file mode 100644 index 45f5fbe..0000000 --- a/tests/res/values-v14/strings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - v14cur - diff --git a/tests/res/values-v15/strings.xml b/tests/res/values-v15/strings.xml deleted file mode 100644 index c1d5e48..0000000 --- a/tests/res/values-v15/strings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - v15cur - diff --git a/tests/res/values-v16/strings.xml b/tests/res/values-v16/strings.xml deleted file mode 100644 index e7a3e8e..0000000 --- a/tests/res/values-v16/strings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - v16cur - diff --git a/tests/res/values-v17/strings.xml b/tests/res/values-v17/strings.xml deleted file mode 100644 index fcf9d91..0000000 --- a/tests/res/values-v17/strings.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - - - v17cur - diff --git a/tests/res/values-v18/strings.xml b/tests/res/values-v18/strings.xml deleted file mode 100644 index 0b84d5e..0000000 --- a/tests/res/values-v18/strings.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - v18cur - v18old - diff --git a/tests/res/values-w600dp-h550dp/configVarying.xml b/tests/res/values-w600dp-h550dp/configVarying.xml deleted file mode 100755 index d4361a8..0000000 --- a/tests/res/values-w600dp-h550dp/configVarying.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - simple sw600 - - bag sw600 - - 600-550 - diff --git a/tests/res/values-w600dp/configVarying.xml b/tests/res/values-w600dp/configVarying.xml deleted file mode 100755 index b8248a6..0000000 --- a/tests/res/values-w600dp/configVarying.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - simple w600 - - bag w600 - - 600 - 600 - diff --git a/tests/res/values-w720dp-h670dp/configVarying.xml b/tests/res/values-w720dp-h670dp/configVarying.xml deleted file mode 100755 index c205786..0000000 --- a/tests/res/values-w720dp-h670dp/configVarying.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - simple 720-670 - - bag 720-670 - - 720-670 - diff --git a/tests/res/values-w720dp/configVarying.xml b/tests/res/values-w720dp/configVarying.xml deleted file mode 100755 index 3211ad4..0000000 --- a/tests/res/values-w720dp/configVarying.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - simple w720 - - bag w720 - - 720 - diff --git a/tests/res/values/arrays.xml b/tests/res/values/arrays.xml index af4c129..71e0133 100644 --- a/tests/res/values/arrays.xml +++ b/tests/res/values/arrays.xml @@ -54,16 +54,4 @@ 9 10 - - - holo - holo_light - holo_solidactionbar - holo_light_solidactionbar - holo_light_solidactionbar_inverse - holo_solidactionbar_splitactionbarwhennarrow - holo_light_solidactionbar_splitactionbarwhennarrow - holo_noactionbar - holo_light_noactionbar - diff --git a/tests/res/values/configVarying.xml b/tests/res/values/configVarying.xml index 7b7d576..de1b09e 100755 --- a/tests/res/values/configVarying.xml +++ b/tests/res/values/configVarying.xml @@ -23,8 +23,4 @@ default default default - default - default - default - default diff --git a/tests/res/values/dimens.xml b/tests/res/values/dimens.xml index f0c57c2..2a8f76e 100755 --- a/tests/res/values/dimens.xml +++ b/tests/res/values/dimens.xml @@ -38,9 +38,6 @@ 25510%p 25610%p 6553510%p - 6553610%p - - 320dp - 480dp + 6553610%p diff --git a/tests/res/values/strings.xml b/tests/res/values/strings.xml index 753602e..a779b47 100644 --- a/tests/res/values/strings.xml +++ b/tests/res/values/strings.xml @@ -27,7 +27,6 @@ 1. click start. \n2. if above image shaked, then press pass button, else press failed button. Hello! Text view! - Hello! \nText view! This is a hint. This is a string for testing hint of textview. App/Forwarding @@ -41,6 +40,24 @@ DialogTest Country Name + Test Dialog without theme + Test Dialog with theme + Test AlertDialog + Test AlertDialog with theme + Test DatePickerDialog + Test DatePickerDialog with theme + Test TimePickerDialog + Test TimePickerDialog with theme + Test onStart() and onStop() + Test AlertDialog deprecated + Test AlertDialog callback + Test AlertDialog setview + Test AlertDialog deprecated with Message + Test AlertDialog with theme + Test AlertDialog cancelable + Test AlertDialog can\'n cancelable + Test Dialog cancelable + Test Dialog not cancelable Hello, World! Hello, Android! Name: @@ -152,19 +169,4 @@ base Android CTS Android CTS - - Button - Holo Test - Holo Generator - Holo Light Test - Holo Light Generator - Reference Image: - Generated Image: - Select a Theme: - Sample text goes here. I wanted something creative and whimsical -but then I just got bored... - This is a really long string which exceeds the width of the view. -New devices have a much larger screen which actually enables long strings to be displayed -with no fading. I have made this string longer to fix this case. If you are correcting this -text, I would love to see the kind of devices you guys now use! diff --git a/tests/src/android/app/cts/ActivityManagerMemoryClassLaunchActivity.java b/tests/src/android/app/cts/ActivityManagerMemoryClassLaunchActivity.java deleted file mode 100644 index f1f95b8..0000000 --- a/tests/src/android/app/cts/ActivityManagerMemoryClassLaunchActivity.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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 android.app.cts; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; - -import java.util.concurrent.CountDownLatch; -import java.util.concurrent.TimeUnit; - -/** - * {@link Activity} that just launches {@link ActivityManagerMemoryClassTestActivity} and - * returns the result of that activity. - */ -public class ActivityManagerMemoryClassLaunchActivity extends Activity { - - public static final String MEMORY_CLASS_EXTRA = "activityMemoryClass"; - - private static final int TEST_ACTIVITY_REQUEST_CODE = 1337; - - private final CountDownLatch mLatch = new CountDownLatch(1); - - private int mChildResult = RESULT_CANCELED; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - // Start the activity that runs in a separate process to do the actual testing, - // since the test itself cannot start an activity in a separate process. A separate - // process is used to avoid including the overhead of the test instrumentation process. - - Intent intent = getIntent(); - int memoryClass = intent.getIntExtra(MEMORY_CLASS_EXTRA, -1); - - Intent testIntent = new Intent(this, ActivityManagerMemoryClassTestActivity.class); - testIntent.putExtra(MEMORY_CLASS_EXTRA, memoryClass); - startActivityForResult(testIntent, TEST_ACTIVITY_REQUEST_CODE); - } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - super.onActivityResult(requestCode, resultCode, data); - if (requestCode == 1337) { - synchronized (this) { - mChildResult = resultCode; - } - } else { - throw new IllegalStateException("Request code: " + requestCode); - } - } - - public int getResult() throws InterruptedException { - mLatch.await(5, TimeUnit.SECONDS); - synchronized (this) { - return mChildResult; - } - } -} diff --git a/tests/src/android/app/cts/ActivityManagerMemoryClassTestActivity.java b/tests/src/android/app/cts/ActivityManagerMemoryClassTestActivity.java deleted file mode 100644 index e717b03..0000000 --- a/tests/src/android/app/cts/ActivityManagerMemoryClassTestActivity.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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 android.app.cts; - -import android.app.Activity; -import android.content.Intent; -import android.os.AsyncTask; -import android.os.Bundle; -import android.util.Log; - -/** - * {@link Activity} that allocates arrays of 256k until reaching 75% of the specified memory class. - */ -public class ActivityManagerMemoryClassTestActivity extends Activity { - - private static final String TAG = "ActivityManagerMemoryClassTest"; - - private static final double FREE_MEMORY_PERCENTAGE = 0.75; - - private static final int ARRAY_BYTES_SIZE = 256 * 1024; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - Intent intent = getIntent(); - int memoryClass = - intent.getIntExtra(ActivityManagerMemoryClassLaunchActivity.MEMORY_CLASS_EXTRA, -1); - new AllocateMemoryTask(memoryClass).execute(); - } - - private class AllocateMemoryTask extends AsyncTask { - - private final int mMemoryClass; - - AllocateMemoryTask(int memoryClass) { - this.mMemoryClass = memoryClass; - } - - @Override - protected Void doInBackground(Void... params) { - int targetMbs = (int) (mMemoryClass * FREE_MEMORY_PERCENTAGE); - int numArrays = targetMbs * 1024 * 1024 / ARRAY_BYTES_SIZE; - Log.i(TAG, "Memory class: " + mMemoryClass + "mb Target memory: " - + targetMbs + "mb Number of arrays: " + numArrays); - - byte[][] arrays = new byte[numArrays][]; - for (int i = 0; i < arrays.length; i++) { - Log.i(TAG, "Allocating array " + i + " of " + arrays.length - + " (" + (i * ARRAY_BYTES_SIZE / 1024 / 1024) + "mb)"); - arrays[i] = new byte[ARRAY_BYTES_SIZE]; - } - return null; - } - - @Override - protected void onPostExecute(Void result) { - super.onPostExecute(result); - setResult(RESULT_OK); - finish(); - } - } -} diff --git a/tests/src/android/app/cts/DialogStubActivity.java b/tests/src/android/app/cts/DialogStubActivity.java index 817e716..f715b51 100644 --- a/tests/src/android/app/cts/DialogStubActivity.java +++ b/tests/src/android/app/cts/DialogStubActivity.java @@ -16,8 +16,6 @@ package android.app.cts; -import com.android.cts.stub.R; - import android.app.Activity; import android.app.AlertDialog; import android.app.DatePickerDialog; @@ -27,19 +25,21 @@ import android.app.DatePickerDialog.OnDateSetListener; import android.app.TimePickerDialog.OnTimeSetListener; import android.content.Context; import android.content.DialogInterface; -import android.content.Intent; import android.content.DialogInterface.OnCancelListener; import android.os.Bundle; import android.os.Handler; import android.os.Message; -import android.test.ActivityInstrumentationTestCase2; import android.util.Log; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; +import android.view.View.OnClickListener; +import android.widget.Button; import android.widget.DatePicker; import android.widget.TimePicker; +import com.android.cts.stub.R; + /* * Stub class for Dialog, AlertDialog, DatePickerDialog, TimePickerDialog etc. */ @@ -289,27 +289,49 @@ public class DialogStubActivity extends Activity { return (String) mDialog.getWindow().getAttributes().getTitle(); } - private static final String TEST_DIALOG_NUMBER_EXTRA = "testDialogNumber"; - - public static T startDialogActivity( - ActivityInstrumentationTestCase2 testCase, int dialogNumber) { - Intent intent = new Intent(Intent.ACTION_MAIN); - intent.putExtra(TEST_DIALOG_NUMBER_EXTRA, dialogNumber); - testCase.setActivityIntent(intent); - return testCase.getActivity(); - } - @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.dialog_stub_layout); - Intent intent = getIntent(); - int dialogNum = intent.getIntExtra(TEST_DIALOG_NUMBER_EXTRA, -1); - if (dialogNum != -1) { - showDialog(dialogNum); - } + findViewById(R.id.dialog_test_button_1).setOnClickListener( + new MockClickListener(TEST_DIALOG_WITHOUT_THEME)); + findViewById(R.id.dialog_test_button_2).setOnClickListener( + new MockClickListener(TEST_DIALOG_WITH_THEME)); + findViewById(R.id.dialog_test_button_3).setOnClickListener( + new MockClickListener(TEST_ALERTDIALOG)); + findViewById(R.id.dialog_test_button_4).setOnClickListener( + new MockClickListener(TEST_CUSTOM_ALERTDIALOG)); + final Button dialogTestButton5 = (Button) findViewById(R.id.dialog_test_button_5); + dialogTestButton5.setOnClickListener(new MockClickListener(TEST_DATEPICKERDIALOG)); + findViewById(R.id.dialog_test_button_6).setOnClickListener( + new MockClickListener(TEST_DATEPICKERDIALOG_WITH_THEME)); + findViewById(R.id.dialog_test_button_7).setOnClickListener( + new MockClickListener(TEST_TIMEPICKERDIALOG)); + findViewById(R.id.dialog_test_button_8).setOnClickListener( + new MockClickListener(TEST_TIMEPICKERDIALOG_WITH_THEME)); + findViewById(R.id.dialog_test_button_9).setOnClickListener( + new MockClickListener(TEST_ONSTART_AND_ONSTOP)); + findViewById(R.id.dialog_test_button_10).setOnClickListener( + new MockClickListener(TEST_ALERTDIALOG_DEPRECATED)); + findViewById(R.id.dialog_test_button_11).setOnClickListener( + new MockClickListener(TEST_ALERTDIALOG_CALLBACK)); + findViewById(R.id.dialog_test_button_12).setOnClickListener( + new MockClickListener(TEST_CUSTOM_ALERTDIALOG_VIEW)); + findViewById(R.id.dialog_test_button_13).setOnClickListener( + new MockClickListener(TEST_ALERTDIALOG_DEPRECATED_WITH_MESSAGE)); + + findViewById(R.id.dialog_test_button_14).setOnClickListener( + new MockClickListener(TEST_ALERTDIALOG_THEME)); + findViewById(R.id.dialog_test_button_15).setOnClickListener( + new MockClickListener(TEST_ALERTDIALOG_CANCELABLE)); + findViewById(R.id.dialog_test_button_16).setOnClickListener( + new MockClickListener(TEST_ALERTDIALOG_NOT_CANCELABLE)); + findViewById(R.id.dialog_test_button_17).setOnClickListener( + new MockClickListener(TEST_PROTECTED_CANCELABLE)); + findViewById(R.id.dialog_test_button_18).setOnClickListener( + new MockClickListener(TEST_PROTECTED_NOT_CANCELABLE)); } public void setUpTitle(final String title) { @@ -361,6 +383,18 @@ public class DialogStubActivity extends Activity { } + private class MockClickListener implements OnClickListener { + private final int mId; + + public MockClickListener(final int id) { + mId = id; + } + + public void onClick(View v) { + showDialog(mId); + } + } + class MockOnClickListener implements DialogInterface.OnClickListener { private final int mId; diff --git a/tests/src/android/app/cts/LaunchpadActivity.java b/tests/src/android/app/cts/LaunchpadActivity.java index 7191e03..fa18ec5 100644 --- a/tests/src/android/app/cts/LaunchpadActivity.java +++ b/tests/src/android/app/cts/LaunchpadActivity.java @@ -184,20 +184,20 @@ public class LaunchpadActivity extends Activity { }); } else if (LIFECYCLE_SCREEN.equals(action)) { addPossibleLifecycle(LIFECYCLE_SCREEN + "_RESTART", new String[] { - ON_START, ON_RESUME, DO_LOCAL_SCREEN, ON_PAUSE, + ON_START, ON_RESUME, DO_LOCAL_SCREEN, ON_FREEZE, ON_PAUSE, ON_RESTART, ON_START, ON_RESUME, DO_FINISH, ON_PAUSE }); addPossibleLifecycle(LIFECYCLE_SCREEN + "_RESUME", new String[] { - ON_START, ON_RESUME, DO_LOCAL_SCREEN, ON_PAUSE, + ON_START, ON_RESUME, DO_LOCAL_SCREEN, ON_FREEZE, ON_PAUSE, ON_RESUME, DO_FINISH, ON_PAUSE }); } else if (LIFECYCLE_DIALOG.equals(action)) { addPossibleLifecycle(LIFECYCLE_DIALOG + "_RESTART", new String[] { - ON_START, ON_RESUME, DO_LOCAL_DIALOG, ON_PAUSE, + ON_START, ON_RESUME, DO_LOCAL_DIALOG, ON_FREEZE, ON_PAUSE, ON_RESTART, ON_START, ON_RESUME, DO_FINISH, ON_PAUSE }); addPossibleLifecycle(LIFECYCLE_DIALOG + "_RESUME", new String[] { - ON_START, ON_RESUME, DO_LOCAL_DIALOG, ON_PAUSE, + ON_START, ON_RESUME, DO_LOCAL_DIALOG, ON_FREEZE, ON_PAUSE, ON_RESUME, DO_FINISH, ON_PAUSE }); } @@ -399,6 +399,7 @@ public class LaunchpadActivity extends Activity { @Override protected void onSaveInstanceState(Bundle icicle) { super.onSaveInstanceState(icicle); + checkLifecycle(ON_FREEZE); if (mBadParcelable) { icicle.putParcelable("baddy", new MyBadParcelable()); } @@ -450,15 +451,13 @@ public class LaunchpadActivity extends Activity { do { if (mExpectedLifecycle[mNextLifecycle].equals(where)) { - Log.w(TAG, "Matched: " + where); break; - } else { - Log.w(TAG, "Expected " + mExpectedLifecycle[mNextLifecycle] + " but got " + where); } } while (switchToNextPossibleLifecycle()); if (mExpectedLifecycle == null) { finishBad("Activity lifecycle for " + action + " incorrect: received " + where + + " but expected " + mExpectedLifecycle[mNextLifecycle] + " at " + mNextLifecycle); return; } diff --git a/tests/src/android/app/cts/LocalActivityManagerTestHelper.java b/tests/src/android/app/cts/LocalActivityManagerTestHelper.java index 76af648..0d21a9c 100644 --- a/tests/src/android/app/cts/LocalActivityManagerTestHelper.java +++ b/tests/src/android/app/cts/LocalActivityManagerTestHelper.java @@ -28,7 +28,7 @@ import android.app.cts.CTSResult; public class LocalActivityManagerTestHelper extends ActivityGroup { public static final String ACTION_DISPATCH_RESUME = "dispatchResume"; - public static final String ACTION_START_ACTIVITY = "startActivity"; + public static final String ACTION_START_ACTIIVTY = "startActivity"; public static final String ACTION_DISPATCH_CREATE = "dispatchCreate"; public static final String ACTION_DISPATCH_STOP = "dispatchStop"; public static final String ACTION_DISPATCH_PAUSE_TRUE = "dispatchPauseTrue"; @@ -66,7 +66,7 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { super.onResume(); if (mCurrentAction.equals(ACTION_DISPATCH_RESUME)) { testDispatchResume(); - } else if (mCurrentAction.equals(ACTION_START_ACTIVITY)) { + } else if (mCurrentAction.equals(ACTION_START_ACTIIVTY)) { testStartActivity(); } else if (mCurrentAction.equals(ACTION_DISPATCH_CREATE)) { testDispatchCreate(); @@ -109,7 +109,9 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { fail(); return; } - pass(); + + sResult.setResult(CTSResult.RESULT_OK); + finish(); } private void testDispatchDestroy() { @@ -144,7 +146,9 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { fail(); return; } - pass(); + + sResult.setResult(CTSResult.RESULT_OK); + finish(); } private void testSaveInstanceState() { @@ -171,7 +175,9 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { fail(); return; } - pass(); + + sResult.setResult(CTSResult.RESULT_OK); + finish(); } private void testDispatchPauseFalse() { @@ -185,7 +191,9 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { fail(); return; } - pass(); + + sResult.setResult(CTSResult.RESULT_OK); + finish(); } private void testDispatchPauseTrue() { @@ -199,7 +207,9 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { fail(); return; } - pass(); + + sResult.setResult(CTSResult.RESULT_OK); + finish(); } private void testDispatchStop() { @@ -219,7 +229,9 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { fail(); return; } - pass(); + + sResult.setResult(CTSResult.RESULT_OK); + finish(); } private void testDispatchCreate() { @@ -257,7 +269,8 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { fail(); return; } - pass(); + sResult.setResult(CTSResult.RESULT_OK); + finish(); } private void testStartActivity() { @@ -311,7 +324,13 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { return; } catch (NullPointerException e) { } - pass(); + sResult.setResult(CTSResult.RESULT_OK); + finish(); + } + + private void fail() { + sResult.setResult(CTSResult.RESULT_FAIL); + finish(); } private void testDispatchResume() { @@ -322,19 +341,11 @@ public class LocalActivityManagerTestHelper extends ActivityGroup { LocalActivityManagerStubActivity.sIsOnResumeCalled = false; mLocalActivityManager.dispatchResume(); if (LocalActivityManagerStubActivity.sIsOnResumeCalled) { - pass(); + sResult.setResult(CTSResult.RESULT_OK); } else { - fail(); + sResult.setResult(CTSResult.RESULT_FAIL); } - } - - private void fail() { - sResult.setResult(CTSResult.RESULT_FAIL); finish(); } - private void pass() { - sResult.setResult(CTSResult.RESULT_OK); - finish(); - } } diff --git a/tests/src/android/app/cts/SearchManagerStubActivity.java b/tests/src/android/app/cts/SearchManagerStubActivity.java index 6385fef..0b64382 100644 --- a/tests/src/android/app/cts/SearchManagerStubActivity.java +++ b/tests/src/android/app/cts/SearchManagerStubActivity.java @@ -49,6 +49,11 @@ public class SearchManagerStubActivity extends Activity { super.onCreate(icicle); mSearchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE); mComponentName = getComponentName(); + } + + @Override + protected void onResume() { + super.onResume(); String action = getIntent().getAction(); if (action.equals(TEST_STOP_SEARCH)) { testStopSearch(); @@ -62,7 +67,6 @@ public class SearchManagerStubActivity extends Activity { private void testOnCancelListener() { mCancelCalled = false; mSearchManager.setOnCancelListener(new SearchManager.OnCancelListener() { - @Override public void onCancel() { mCancelCalled = true; } @@ -81,7 +85,6 @@ public class SearchManagerStubActivity extends Activity { return false; case 3: assertTrue("cancel not called", mCancelCalled); - pass(); return true; default: throw new IllegalArgumentException("Bad step " + step); @@ -206,7 +209,9 @@ public class SearchManagerStubActivity extends Activity { @Override public void handleMessage(Message msg) { try { - if (!doStep(msg.what)) { + if (doStep(msg.what)) { + pass(); + } else { sendEmptyMessage(msg.what + 1); } } catch (FailException ex) { @@ -231,8 +236,16 @@ public class SearchManagerStubActivity extends Activity { super(); } + public FailException(String detailMessage, Throwable throwable) { + super(detailMessage, throwable); + } + public FailException(String detailMessage) { super(detailMessage); } + + public FailException(Throwable throwable) { + super(throwable); + } } } diff --git a/tests/src/android/content/cts/ClipboardManagerListenerActivity.java b/tests/src/android/content/cts/ClipboardManagerListenerActivity.java deleted file mode 100644 index baa38ed..0000000 --- a/tests/src/android/content/cts/ClipboardManagerListenerActivity.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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 android.content.cts; - -import android.app.Activity; -import android.content.ClipData; -import android.content.ClipboardManager; -import android.content.Context; -import android.content.ClipboardManager.OnPrimaryClipChangedListener; -import android.os.Bundle; - -public class ClipboardManagerListenerActivity extends Activity { - - private ClipboardManager mClipboardManager; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - synchronized(this) { - mClipboardManager = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE); - } - } - - public synchronized void addPrimaryClipChangedListener(OnPrimaryClipChangedListener listener) { - mClipboardManager.addPrimaryClipChangedListener(listener); - } - - public synchronized void removePrimaryClipChangedListener(OnPrimaryClipChangedListener listener) { - mClipboardManager.removePrimaryClipChangedListener(listener); - } - - public synchronized void setPrimaryClip(ClipData clip) { - mClipboardManager.setPrimaryClip(clip); - } -} diff --git a/tests/src/android/content/cts/MockSyncAdapter.java b/tests/src/android/content/cts/MockSyncAdapter.java index df24749..32b3a8d 100644 --- a/tests/src/android/content/cts/MockSyncAdapter.java +++ b/tests/src/android/content/cts/MockSyncAdapter.java @@ -23,14 +23,13 @@ import android.content.ISyncContext; import android.os.Bundle; import android.os.RemoteException; -import java.util.ArrayList; import java.util.concurrent.CountDownLatch; public class MockSyncAdapter extends ISyncAdapter.Stub { private static MockSyncAdapter sSyncAdapter = null; - private ArrayList mAccounts = new ArrayList(); + private Account mAccount; private String mAuthority; private Bundle mExtras; private boolean mInitialized; @@ -38,8 +37,8 @@ public class MockSyncAdapter extends ISyncAdapter.Stub { private boolean mCancelSync; private CountDownLatch mLatch; - public ArrayList getAccounts() { - return mAccounts; + public Account getAccount() { + return mAccount; } public String getAuthority() { @@ -63,7 +62,7 @@ public class MockSyncAdapter extends ISyncAdapter.Stub { } public void clearData() { - mAccounts.clear(); + mAccount = null; mAuthority = null; mExtras = null; mInitialized = false; @@ -79,7 +78,7 @@ public class MockSyncAdapter extends ISyncAdapter.Stub { public void startSync(ISyncContext syncContext, String authority, Account account, Bundle extras) throws RemoteException { - mAccounts.add(account); + mAccount = account; mAuthority = authority; mExtras = extras; @@ -99,7 +98,7 @@ public class MockSyncAdapter extends ISyncAdapter.Stub { } public void cancelSync(ISyncContext syncContext) throws RemoteException { - mAccounts.clear(); + mAccount = null; mAuthority = null; mExtras = null; @@ -115,7 +114,7 @@ public class MockSyncAdapter extends ISyncAdapter.Stub { public void initialize(android.accounts.Account account, java.lang.String authority) throws android.os.RemoteException { - mAccounts.add(account); + mAccount = account; mAuthority = authority; mInitialized = true; diff --git a/tests/src/android/media/cts/MediaPlayerSurfaceStubActivity.java b/tests/src/android/media/cts/MediaPlayerSurfaceStubActivity.java deleted file mode 100644 index 3cd6fc8..0000000 --- a/tests/src/android/media/cts/MediaPlayerSurfaceStubActivity.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 android.media.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.res.AssetFileDescriptor; -import android.content.res.Resources; -import android.media.MediaPlayer; -import android.os.Bundle; -import android.util.Log; - -public class MediaPlayerSurfaceStubActivity extends Activity { - - private static final String TAG = "MediaPlayerSurfaceStubActivity"; - - protected Resources mResources; - - private VideoSurfaceView mVideoView = null; - private MediaPlayer mMediaPlayer = null; - - @Override - protected void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mResources = getResources(); - mMediaPlayer = new MediaPlayer(); - - try { - AssetFileDescriptor afd = mResources.openRawResourceFd(R.raw.testvideo); - mMediaPlayer.setDataSource( - afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength()); - afd.close(); - } catch (Exception e) { - Log.e(TAG, e.getMessage(), e); - } - - mVideoView = new VideoSurfaceView(this, mMediaPlayer); - setContentView(mVideoView); - } - - @Override - protected void onResume() { - super.onResume(); - mVideoView.onResume(); - } - - public void playVideo() throws Exception { - mVideoView.startTest(); - } - -} diff --git a/tests/src/android/media/cts/MediaStubActivity.java b/tests/src/android/media/cts/MediaStubActivity.java index f0ca755..e10e6fa 100644 --- a/tests/src/android/media/cts/MediaStubActivity.java +++ b/tests/src/android/media/cts/MediaStubActivity.java @@ -26,7 +26,6 @@ public class MediaStubActivity extends Activity { public static final int WIDTH = 320; public static final int HEIGHT = 240; private SurfaceHolder mHolder; - private SurfaceHolder mHolder2; @Override protected void onCreate(Bundle savedInstanceState) { @@ -41,28 +40,9 @@ public class MediaStubActivity extends Activity { mHolder = surfaceV.getHolder(); mHolder.setFixedSize(WIDTH, HEIGHT); mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - - SurfaceView surfaceV2 = (SurfaceView)findViewById(R.id.surface2); - ViewGroup.LayoutParams lp2 = surfaceV2.getLayoutParams(); - lp2.width = WIDTH; - lp2.height = HEIGHT; - surfaceV2.setLayoutParams(lp2); - mHolder2 = surfaceV2.getHolder(); - mHolder2.setFixedSize(WIDTH, HEIGHT); - mHolder2.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); - } public SurfaceHolder getSurfaceHolder() { return mHolder; } - - public SurfaceHolder getSurfaceHolder2() { - return mHolder2; - } - - public SurfaceHolder generateSurfaceHolder() { - SurfaceView surface = (SurfaceView)findViewById(R.id.surface3); - return surface.getHolder(); - } } diff --git a/tests/src/android/media/cts/VideoSurfaceView.java b/tests/src/android/media/cts/VideoSurfaceView.java deleted file mode 100644 index 0f23a2d..0000000 --- a/tests/src/android/media/cts/VideoSurfaceView.java +++ /dev/null @@ -1,324 +0,0 @@ -/* - * 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 android.media.cts; - -import com.android.cts.stub.R; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.nio.ByteOrder; -import java.nio.FloatBuffer; - -import javax.microedition.khronos.egl.EGLConfig; -import javax.microedition.khronos.opengles.GL10; - -import android.content.Context; -import android.graphics.SurfaceTexture; -import android.media.MediaPlayer; -import android.opengl.GLES20; -import android.opengl.GLSurfaceView; -import android.opengl.Matrix; -import android.util.Log; -import android.view.Surface; - -class VideoSurfaceView extends GLSurfaceView { - private static final String TAG = "VideoSurfaceView"; - private static final int SLEEP_TIME = 1000; - - VideoRender mRenderer; - private MediaPlayer mMediaPlayer = null; - - public VideoSurfaceView(Context context, MediaPlayer mp) { - super(context); - - setEGLContextClientVersion(2); - mMediaPlayer = mp; - mRenderer = new VideoRender(context); - setRenderer(mRenderer); - } - - @Override - public void onResume() { - queueEvent(new Runnable(){ - public void run() { - mRenderer.setMediaPlayer(mMediaPlayer); - }}); - - super.onResume(); - } - - public void startTest() throws Exception { - Thread.sleep(SLEEP_TIME); - mMediaPlayer.start(); - - Thread.sleep(SLEEP_TIME * 5); - mMediaPlayer.setSurface(null); - - Thread.sleep(SLEEP_TIME * 1); - SurfaceTexture surfaceTexture = new SurfaceTexture(0); - Surface surface = new Surface(surfaceTexture); - surface.release(); - try { - mMediaPlayer.setSurface(surface); - throw new RuntimeException("setSurface with released Surface object didn't throw " + - "IllegalArgumentException"); - } catch (IllegalArgumentException e) { - // Expected - } - - while (mMediaPlayer.isPlaying()) { - Thread.sleep(SLEEP_TIME); - } - } - - private static class VideoRender - implements GLSurfaceView.Renderer, SurfaceTexture.OnFrameAvailableListener { - private static String TAG = "VideoRender"; - - private static final int FLOAT_SIZE_BYTES = 4; - private static final int TRIANGLE_VERTICES_DATA_STRIDE_BYTES = 5 * FLOAT_SIZE_BYTES; - private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0; - private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3; - private final float[] mTriangleVerticesData = { - // X, Y, Z, U, V - -1.0f, -1.0f, 0, 0.f, 0.f, - 1.0f, -1.0f, 0, 1.f, 0.f, - -1.0f, 1.0f, 0, 0.f, 1.f, - 1.0f, 1.0f, 0, 1.f, 1.f, - }; - - private FloatBuffer mTriangleVertices; - - private final String mVertexShader = - "uniform mat4 uMVPMatrix;\n" + - "uniform mat4 uSTMatrix;\n" + - "attribute vec4 aPosition;\n" + - "attribute vec4 aTextureCoord;\n" + - "varying vec2 vTextureCoord;\n" + - "void main() {\n" + - " gl_Position = uMVPMatrix * aPosition;\n" + - " vTextureCoord = (uSTMatrix * aTextureCoord).xy;\n" + - "}\n"; - - private final String mFragmentShader = - "#extension GL_OES_EGL_image_external : require\n" + - "precision mediump float;\n" + - "varying vec2 vTextureCoord;\n" + - "uniform samplerExternalOES sTexture;\n" + - "void main() {\n" + - " gl_FragColor = texture2D(sTexture, vTextureCoord);\n" + - "}\n"; - - private float[] mMVPMatrix = new float[16]; - private float[] mSTMatrix = new float[16]; - - private int mProgram; - private int mTextureID; - private int muMVPMatrixHandle; - private int muSTMatrixHandle; - private int maPositionHandle; - private int maTextureHandle; - - private SurfaceTexture mSurface; - private boolean updateSurface = false; - - private static int GL_TEXTURE_EXTERNAL_OES = 0x8D65; - - private MediaPlayer mMediaPlayer; - - public VideoRender(Context context) { - mTriangleVertices = ByteBuffer.allocateDirect( - mTriangleVerticesData.length * FLOAT_SIZE_BYTES) - .order(ByteOrder.nativeOrder()).asFloatBuffer(); - mTriangleVertices.put(mTriangleVerticesData).position(0); - - Matrix.setIdentityM(mSTMatrix, 0); - } - - public void setMediaPlayer(MediaPlayer player) { - mMediaPlayer = player; - } - - public void onDrawFrame(GL10 glUnused) { - synchronized(this) { - if (updateSurface) { - mSurface.updateTexImage(); - mSurface.getTransformMatrix(mSTMatrix); - updateSurface = false; - } - } - - GLES20.glClearColor(0.0f, 1.0f, 0.0f, 1.0f); - GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT); - - GLES20.glUseProgram(mProgram); - checkGlError("glUseProgram"); - - GLES20.glActiveTexture(GLES20.GL_TEXTURE0); - GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureID); - - mTriangleVertices.position(TRIANGLE_VERTICES_DATA_POS_OFFSET); - GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, - TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices); - checkGlError("glVertexAttribPointer maPosition"); - GLES20.glEnableVertexAttribArray(maPositionHandle); - checkGlError("glEnableVertexAttribArray maPositionHandle"); - - mTriangleVertices.position(TRIANGLE_VERTICES_DATA_UV_OFFSET); - GLES20.glVertexAttribPointer(maTextureHandle, 3, GLES20.GL_FLOAT, false, - TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices); - checkGlError("glVertexAttribPointer maTextureHandle"); - GLES20.glEnableVertexAttribArray(maTextureHandle); - checkGlError("glEnableVertexAttribArray maTextureHandle"); - - Matrix.setIdentityM(mMVPMatrix, 0); - GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mMVPMatrix, 0); - GLES20.glUniformMatrix4fv(muSTMatrixHandle, 1, false, mSTMatrix, 0); - - GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4); - checkGlError("glDrawArrays"); - GLES20.glFinish(); - - } - - public void onSurfaceChanged(GL10 glUnused, int width, int height) { - } - - public void onSurfaceCreated(GL10 glUnused, EGLConfig config) { - mProgram = createProgram(mVertexShader, mFragmentShader); - if (mProgram == 0) { - return; - } - maPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition"); - checkGlError("glGetAttribLocation aPosition"); - if (maPositionHandle == -1) { - throw new RuntimeException("Could not get attrib location for aPosition"); - } - maTextureHandle = GLES20.glGetAttribLocation(mProgram, "aTextureCoord"); - checkGlError("glGetAttribLocation aTextureCoord"); - if (maTextureHandle == -1) { - throw new RuntimeException("Could not get attrib location for aTextureCoord"); - } - - muMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix"); - checkGlError("glGetUniformLocation uMVPMatrix"); - if (muMVPMatrixHandle == -1) { - throw new RuntimeException("Could not get attrib location for uMVPMatrix"); - } - - muSTMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uSTMatrix"); - checkGlError("glGetUniformLocation uSTMatrix"); - if (muSTMatrixHandle == -1) { - throw new RuntimeException("Could not get attrib location for uSTMatrix"); - } - - - int[] textures = new int[1]; - GLES20.glGenTextures(1, textures, 0); - - mTextureID = textures[0]; - GLES20.glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureID); - checkGlError("glBindTexture mTextureID"); - - GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MIN_FILTER, - GLES20.GL_NEAREST); - GLES20.glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GLES20.GL_TEXTURE_MAG_FILTER, - GLES20.GL_LINEAR); - - /* - * Create the SurfaceTexture that will feed this textureID, - * and pass it to the MediaPlayer - */ - mSurface = new SurfaceTexture(mTextureID); - mSurface.setOnFrameAvailableListener(this); - - Surface surface = new Surface(mSurface); - mMediaPlayer.setSurface(surface); - surface.release(); - - try { - mMediaPlayer.prepare(); - } catch (IOException t) { - Log.e(TAG, "media player prepare failed"); - } - - synchronized(this) { - updateSurface = false; - } - } - - synchronized public void onFrameAvailable(SurfaceTexture surface) { - updateSurface = true; - } - - private int loadShader(int shaderType, String source) { - int shader = GLES20.glCreateShader(shaderType); - if (shader != 0) { - GLES20.glShaderSource(shader, source); - GLES20.glCompileShader(shader); - int[] compiled = new int[1]; - GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0); - if (compiled[0] == 0) { - Log.e(TAG, "Could not compile shader " + shaderType + ":"); - Log.e(TAG, GLES20.glGetShaderInfoLog(shader)); - GLES20.glDeleteShader(shader); - shader = 0; - } - } - return shader; - } - - private int createProgram(String vertexSource, String fragmentSource) { - int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); - if (vertexShader == 0) { - return 0; - } - int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); - if (pixelShader == 0) { - return 0; - } - - int program = GLES20.glCreateProgram(); - if (program != 0) { - GLES20.glAttachShader(program, vertexShader); - checkGlError("glAttachShader"); - GLES20.glAttachShader(program, pixelShader); - checkGlError("glAttachShader"); - GLES20.glLinkProgram(program); - int[] linkStatus = new int[1]; - GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0); - if (linkStatus[0] != GLES20.GL_TRUE) { - Log.e(TAG, "Could not link program: "); - Log.e(TAG, GLES20.glGetProgramInfoLog(program)); - GLES20.glDeleteProgram(program); - program = 0; - } - } - return program; - } - - private void checkGlError(String op) { - int error; - while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { - Log.e(TAG, op + ": glError " + error); - throw new RuntimeException(op + ": glError " + error); - } - } - - } // End of class VideoRender. - -} // End of class VideoSurfaceView. diff --git a/tests/src/android/opengl/cts/GLSurfaceViewStubActivity.java b/tests/src/android/opengl/cts/GLSurfaceViewStubActivity.java index 79da413..5a8f310 100644 --- a/tests/src/android/opengl/cts/GLSurfaceViewStubActivity.java +++ b/tests/src/android/opengl/cts/GLSurfaceViewStubActivity.java @@ -25,7 +25,6 @@ import javax.microedition.khronos.opengles.GL10; /** * A minimal activity for testing {@link android.opengl.GLSurfaceView}. - * Also accepts non-blank renderers to allow its use for more complex tests. */ public class GLSurfaceViewStubActivity extends Activity { @@ -46,60 +45,11 @@ public class GLSurfaceViewStubActivity extends Activity { private GLSurfaceView mView; - /** To override the blank renderer, or other settings, these - * static set* methods must be called before onCreate() is called. - * If using ActivityInstrumentationTestCase2, that means the set - * methods need to be called before calling getActivity in the - * test setUp(). - */ - private static GLSurfaceView.Renderer mRenderer = null; - public static void setRenderer(GLSurfaceView.Renderer renderer) { - mRenderer = renderer; - } - public static void resetRenderer() { - mRenderer = null; - } - - private static int mRenderMode = 0; - private static boolean mRenderModeSet = false; - public static void setRenderMode(int renderMode) { - mRenderModeSet = true; - mRenderMode = renderMode; - } - public static void resetRenderMode() { - mRenderModeSet = false; - mRenderMode = 0; - } - - private static int mGlVersion = 0; - private static boolean mGlVersionSet = false; - public static void setGlVersion(int glVersion) { - mGlVersionSet = true; - mGlVersion = glVersion; - } - public static void resetGlVersion() { - mGlVersionSet = false; - mGlVersion = 0; - } - @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mView = new GLSurfaceView(this); - // Only set this if explicitly asked for - if (mGlVersionSet) { - mView.setEGLContextClientVersion(mGlVersion); - } - // Use no-op renderer by default - if (mRenderer == null) { - mView.setRenderer(new Renderer()); - } else { - mView.setRenderer(mRenderer); - } - // Only set this if explicitly asked for - if (mRenderModeSet) { - mView.setRenderMode(mRenderMode); - } + mView.setRenderer(new Renderer()); setContentView(mView); } diff --git a/tests/src/android/provider/cts/FileCopyHelper.java b/tests/src/android/provider/cts/FileCopyHelper.java index 4ee93ac..a9c53e5 100644 --- a/tests/src/android/provider/cts/FileCopyHelper.java +++ b/tests/src/android/provider/cts/FileCopyHelper.java @@ -18,8 +18,6 @@ package android.provider.cts; import android.content.Context; -import java.io.File; -import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; @@ -97,18 +95,4 @@ public class FileCopyHelper { mContext.deleteFile(path); } } - - public static void createFile(File file, int numBytes) throws IOException { - File parentFile = file.getParentFile(); - if (parentFile != null) { - parentFile.mkdirs(); - } - byte[] buffer = new byte[numBytes]; - FileOutputStream output = new FileOutputStream(file); - try { - output.write(buffer); - } finally { - output.close(); - } - } } diff --git a/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java b/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java index 7bcd0c7..3cc3bbe 100644 --- a/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java +++ b/tests/src/android/provider/cts/MediaStoreAudioTestHelper.java @@ -84,8 +84,6 @@ public class MediaStoreAudioTestHelper { public static final int IS_MUSIC = 1; - public static final int IS_DRM = 0; - public static final int YEAR = 1992; public static final int TRACK = 1; @@ -114,7 +112,7 @@ public class MediaStoreAudioTestHelper { public static final String EXTERNAL_DATA = Environment.getExternalStorageDirectory() + "/" + FILE_NAME; - public static final long DATE_MODIFIED = System.currentTimeMillis() / 1000; + public static final long DATE_MODIFIED = System.currentTimeMillis(); public static final String GENRE = "POP"; @Override @@ -136,7 +134,6 @@ public class MediaStoreAudioTestHelper { values.put(Media.IS_ALARM, IS_ALARM); values.put(Media.IS_NOTIFICATION, IS_NOTIFICATION); values.put(Media.IS_RINGTONE, IS_RINGTONE); - values.put(Media.IS_DRM, IS_DRM); return values; } @@ -160,8 +157,6 @@ public class MediaStoreAudioTestHelper { public static final int IS_MUSIC = 0; - public static final int IS_DRM = 0; - public static final int YEAR = 1992; public static final int TRACK = 1001; @@ -215,7 +210,6 @@ public class MediaStoreAudioTestHelper { values.put(Media.IS_ALARM, IS_ALARM); values.put(Media.IS_NOTIFICATION, IS_NOTIFICATION); values.put(Media.IS_RINGTONE, IS_RINGTONE); - values.put(Media.IS_DRM, IS_DRM); return values; } diff --git a/tests/src/android/provider/cts/TestSearchRecentSuggestionsProvider.java b/tests/src/android/provider/cts/TestSearchRecentSuggestionsProvider.java deleted file mode 100644 index d1cb1ef..0000000 --- a/tests/src/android/provider/cts/TestSearchRecentSuggestionsProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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. - */ - -package android.provider.cts; - -import android.content.SearchRecentSuggestionsProvider; - -public class TestSearchRecentSuggestionsProvider extends SearchRecentSuggestionsProvider { - final static String AUTHORITY = "android.provider.cts.TestSRSProvider"; - final static int MODE = DATABASE_MODE_QUERIES + DATABASE_MODE_2LINES; - - public TestSearchRecentSuggestionsProvider() { - super(); - setupSuggestions(AUTHORITY, MODE); - } -} diff --git a/tests/src/android/renderscript/cts/RenderscriptGLStubActivity.java b/tests/src/android/renderscript/cts/RenderscriptGLStubActivity.java deleted file mode 100644 index 3bb6212..0000000 --- a/tests/src/android/renderscript/cts/RenderscriptGLStubActivity.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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 android.renderscript.cts; - -import android.app.Activity; -import android.os.Bundle; -import android.content.Context; -import android.content.res.Resources; -import android.renderscript.*; - -import com.android.cts.stub.R; - -// Renderscript activity -public class RenderscriptGLStubActivity extends Activity { - class StubActivityRS { - private Resources mRes; - private RenderScriptGL mRS; - - private ScriptC mScript; - - public StubActivityRS() { - } - - // This provides us with the renderscript context and resources that - // allow us to create the script that does rendering - public void init(RenderScriptGL rs, Resources res) { - mRS = rs; - mRes = res; - initRS(); - } - - private void initRS() { - mScript = new ScriptC_stub_activity(mRS, mRes, R.raw.stub_activity); - mRS.bindRootScript(mScript); - } - } - - class HelloWorldView extends RSSurfaceView { - // Renderscipt context - private RenderScriptGL mRS; - // Script that does the rendering - private StubActivityRS mRender; - - public HelloWorldView(Context context) { - super(context); - ensureRenderScript(); - } - - private void ensureRenderScript() { - if (mRS == null) { - // Initialize renderscript with desired surface characteristics. - // In this case, just use the defaults - RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig(); - mRS = createRenderScriptGL(sc); - // Create an instance of the script that does the rendering - mRender = new StubActivityRS(); - mRender.init(mRS, getResources()); - } - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - ensureRenderScript(); - } - - @Override - protected void onDetachedFromWindow() { - // Handle the system event and clean up - mRender = null; - if (mRS != null) { - mRS = null; - destroyRenderScriptGL(); - } - } - } - - // Custom view to use with RenderScript - private HelloWorldView mView; - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - - // Create our view and set it as the content of our Activity - mView = new HelloWorldView(this); - setContentView(mView); - } - - public void recreateView() { - mView = new HelloWorldView(this); - setContentView(mView); - } - - public void recreateMultiView() { - HelloWorldView view1 = new HelloWorldView(this); - HelloWorldView view2 = new HelloWorldView(this); - setContentView(view1); - setContentView(view2); - mView = view2; - } - - @Override - protected void onResume() { - // Ideally an app should implement onResume() and onPause() - // to take appropriate action when the activity loses focus - super.onResume(); - mView.resume(); - } - - @Override - protected void onPause() { - // Ideally an app should implement onResume() and onPause() - // to take appropriate action when the activity loses focus - super.onPause(); - mView.pause(); - } - -} - diff --git a/tests/src/android/renderscript/cts/fe_bool.rs b/tests/src/android/renderscript/cts/fe_bool.rs deleted file mode 100644 index 727635a..0000000 --- a/tests/src/android/renderscript/cts/fe_bool.rs +++ /dev/null @@ -1,7 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const bool *ain, bool *aout) { - aout[0] = !ain[0]; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f32.rs b/tests/src/android/renderscript/cts/fe_f32.rs deleted file mode 100644 index 3c649e2..0000000 --- a/tests/src/android/renderscript/cts/fe_f32.rs +++ /dev/null @@ -1,7 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const float *ain, float *aout) { - aout[0] = ain[0] + 1.0f; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f32_2.rs b/tests/src/android/renderscript/cts/fe_f32_2.rs deleted file mode 100644 index 571100b..0000000 --- a/tests/src/android/renderscript/cts/fe_f32_2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const float2 *ain, float2 *aout) { - aout[0].x = ain[0].x + 1.0f; - aout[0].y = ain[0].y + 1.0f; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f32_3.rs b/tests/src/android/renderscript/cts/fe_f32_3.rs deleted file mode 100644 index 1df67a7..0000000 --- a/tests/src/android/renderscript/cts/fe_f32_3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const float3 *ain, float3 *aout) { - aout[0].x = ain[0].x + 1.0f; - aout[0].y = ain[0].y + 1.0f; - aout[0].z = ain[0].z + 1.0f; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f32_4.rs b/tests/src/android/renderscript/cts/fe_f32_4.rs deleted file mode 100644 index 50a50ec..0000000 --- a/tests/src/android/renderscript/cts/fe_f32_4.rs +++ /dev/null @@ -1,10 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const float4 *ain, float4 *aout) { - aout[0].x = ain[0].x + 1.0f; - aout[0].y = ain[0].y + 1.0f; - aout[0].z = ain[0].z + 1.0f; - aout[0].w = ain[0].w + 1.0f; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f64.rs b/tests/src/android/renderscript/cts/fe_f64.rs deleted file mode 100644 index b609a08..0000000 --- a/tests/src/android/renderscript/cts/fe_f64.rs +++ /dev/null @@ -1,7 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const double *ain, double *aout) { - aout[0] = ain[0] + 1.0; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f64_2.rs b/tests/src/android/renderscript/cts/fe_f64_2.rs deleted file mode 100644 index a97628b..0000000 --- a/tests/src/android/renderscript/cts/fe_f64_2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const double2 *ain, double2 *aout) { - aout[0].x = ain[0].x + 1.0; - aout[0].y = ain[0].y + 1.0; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f64_3.rs b/tests/src/android/renderscript/cts/fe_f64_3.rs deleted file mode 100644 index b6e97b8..0000000 --- a/tests/src/android/renderscript/cts/fe_f64_3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const double3 *ain, double3 *aout) { - aout[0].x = ain[0].x + 1.0; - aout[0].y = ain[0].y + 1.0; - aout[0].z = ain[0].z + 1.0; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_f64_4.rs b/tests/src/android/renderscript/cts/fe_f64_4.rs deleted file mode 100644 index 959c30b..0000000 --- a/tests/src/android/renderscript/cts/fe_f64_4.rs +++ /dev/null @@ -1,10 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const double4 *ain, double4 *aout) { - aout[0].x = ain[0].x + 1.0; - aout[0].y = ain[0].y + 1.0; - aout[0].z = ain[0].z + 1.0; - aout[0].w = ain[0].w + 1.0; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i16.rs b/tests/src/android/renderscript/cts/fe_i16.rs deleted file mode 100644 index e45a0a8..0000000 --- a/tests/src/android/renderscript/cts/fe_i16.rs +++ /dev/null @@ -1,7 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const short *ain, ushort *aout) { - aout[0] = ain[0] + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i16_2.rs b/tests/src/android/renderscript/cts/fe_i16_2.rs deleted file mode 100644 index 8eb8245..0000000 --- a/tests/src/android/renderscript/cts/fe_i16_2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const short2 *ain, ushort2 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i16_3.rs b/tests/src/android/renderscript/cts/fe_i16_3.rs deleted file mode 100644 index 09113a5..0000000 --- a/tests/src/android/renderscript/cts/fe_i16_3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const short3 *ain, ushort3 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i16_4.rs b/tests/src/android/renderscript/cts/fe_i16_4.rs deleted file mode 100644 index 4a5ca2c..0000000 --- a/tests/src/android/renderscript/cts/fe_i16_4.rs +++ /dev/null @@ -1,10 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const short4 *ain, ushort4 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - aout[0].w = ain[0].w + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i32.rs b/tests/src/android/renderscript/cts/fe_i32.rs deleted file mode 100644 index 402a1f7..0000000 --- a/tests/src/android/renderscript/cts/fe_i32.rs +++ /dev/null @@ -1,7 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const int *ain, uint *aout) { - aout[0] = ain[0] + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i32_2.rs b/tests/src/android/renderscript/cts/fe_i32_2.rs deleted file mode 100644 index bff5460..0000000 --- a/tests/src/android/renderscript/cts/fe_i32_2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const int2 *ain, uint2 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i32_3.rs b/tests/src/android/renderscript/cts/fe_i32_3.rs deleted file mode 100644 index ce666c0..0000000 --- a/tests/src/android/renderscript/cts/fe_i32_3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const int3 *ain, uint3 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i32_4.rs b/tests/src/android/renderscript/cts/fe_i32_4.rs deleted file mode 100644 index ab66082..0000000 --- a/tests/src/android/renderscript/cts/fe_i32_4.rs +++ /dev/null @@ -1,10 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const int4 *ain, uint4 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - aout[0].w = ain[0].w + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i64.rs b/tests/src/android/renderscript/cts/fe_i64.rs deleted file mode 100644 index 352a48e..0000000 --- a/tests/src/android/renderscript/cts/fe_i64.rs +++ /dev/null @@ -1,7 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const long *ain, ulong *aout) { - aout[0] = ain[0] + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i64_2.rs b/tests/src/android/renderscript/cts/fe_i64_2.rs deleted file mode 100644 index f39531d..0000000 --- a/tests/src/android/renderscript/cts/fe_i64_2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const long2 *ain, ulong2 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i64_3.rs b/tests/src/android/renderscript/cts/fe_i64_3.rs deleted file mode 100644 index 1229137..0000000 --- a/tests/src/android/renderscript/cts/fe_i64_3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const long3 *ain, ulong3 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i64_4.rs b/tests/src/android/renderscript/cts/fe_i64_4.rs deleted file mode 100644 index 5e2b2ae..0000000 --- a/tests/src/android/renderscript/cts/fe_i64_4.rs +++ /dev/null @@ -1,10 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const long4 *ain, ulong4 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - aout[0].w = ain[0].w + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i8.rs b/tests/src/android/renderscript/cts/fe_i8.rs deleted file mode 100644 index 067ef50..0000000 --- a/tests/src/android/renderscript/cts/fe_i8.rs +++ /dev/null @@ -1,7 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const char *ain, uchar *aout) { - aout[0] = ain[0] + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i8_2.rs b/tests/src/android/renderscript/cts/fe_i8_2.rs deleted file mode 100644 index cec1f57..0000000 --- a/tests/src/android/renderscript/cts/fe_i8_2.rs +++ /dev/null @@ -1,8 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const char2 *ain, uchar2 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i8_3.rs b/tests/src/android/renderscript/cts/fe_i8_3.rs deleted file mode 100644 index 9254ba5..0000000 --- a/tests/src/android/renderscript/cts/fe_i8_3.rs +++ /dev/null @@ -1,9 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const char3 *ain, uchar3 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_i8_4.rs b/tests/src/android/renderscript/cts/fe_i8_4.rs deleted file mode 100644 index 0c1fd1d..0000000 --- a/tests/src/android/renderscript/cts/fe_i8_4.rs +++ /dev/null @@ -1,10 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const char4 *ain, uchar4 *aout) { - aout[0].x = ain[0].x + 1; - aout[0].y = ain[0].y + 1; - aout[0].z = ain[0].z + 1; - aout[0].w = ain[0].w + 1; - return; -} diff --git a/tests/src/android/renderscript/cts/fe_struct.rs b/tests/src/android/renderscript/cts/fe_struct.rs deleted file mode 100644 index b22604d..0000000 --- a/tests/src/android/renderscript/cts/fe_struct.rs +++ /dev/null @@ -1,13 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -struct fe_test { - int i; - float f; -}; - -void root(const struct fe_test *ain, struct fe_test *aout) { - aout[0].i = ain[0].i + 1; - aout[0].f = ain[0].f + 1.0f; - return; -} diff --git a/tests/src/android/renderscript/cts/graphics_runner.rs b/tests/src/android/renderscript/cts/graphics_runner.rs deleted file mode 100644 index 18e1f76..0000000 --- a/tests/src/android/renderscript/cts/graphics_runner.rs +++ /dev/null @@ -1,45 +0,0 @@ -// 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. - -#include "shared.rsh" -#include "rs_graphics.rsh" - -#include "structs.rsh" - -static void drawQuad() { - float startX = 0, startY = 0; - float width = 4, height = 4; - rsgDrawQuadTexCoords(startX, startY, 0, 0, 0, - startX, startY + height, 0, 0, 1, - startX + width, startY + height, 0, 1, 1, - startX + width, startY, 0, 1, 0); -} - -void testProgramVertex(rs_program_vertex pv) { - rsDebug("Set Program Vertex, drew quad", 0); - rsgBindProgramVertex(pv); - drawQuad(); -} - -void testProgramFragment(rs_program_fragment pf) { - rsDebug("Set Program Fragment, drew quad", 0); - rsgBindProgramFragment(pf); - drawQuad(); -} - -// Just draw a quad with previously setup state -int root(void) { - rsDebug("Running script", 0); - return 0; -} diff --git a/tests/src/android/renderscript/cts/negate.rs b/tests/src/android/renderscript/cts/negate.rs deleted file mode 100644 index af76faa..0000000 --- a/tests/src/android/renderscript/cts/negate.rs +++ /dev/null @@ -1,22 +0,0 @@ -// 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. - -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void root(const int *ain, int *aout) { - aout[0] = -1 * ain[0]; - return; -} - diff --git a/tests/src/android/renderscript/cts/passthrough.rs b/tests/src/android/renderscript/cts/passthrough.rs deleted file mode 100644 index 008f7f2..0000000 --- a/tests/src/android/renderscript/cts/passthrough.rs +++ /dev/null @@ -1,8 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -void passthrough(int i) { - rsDebug("i: ", i); - return; -} - diff --git a/tests/src/android/renderscript/cts/primitives.rs b/tests/src/android/renderscript/cts/primitives.rs deleted file mode 100755 index c121ec4..0000000 --- a/tests/src/android/renderscript/cts/primitives.rs +++ /dev/null @@ -1,137 +0,0 @@ -/***************************************************************************** - ***** - ***** - ***** - ***** DANGER - ***** DO NOT ALTER THIS TEST WITHOUT VERIFYING ScriptTest.java STILL WORKS - ***** WE DEPEND ON VARIABLE ORDER FOR VERIFICATION - ***** - ***** - ***** - *****************************************************************************/ -#include "shared.rsh" -#include "structs.rsh" - -// Testing primitive types -float floatTest = 1.99f; -double doubleTest = 2.05; -char charTest = -8; -short shortTest = -16; -int intTest = -32; -long longTest = 17179869184l; // 1 << 34 -long long longlongTest = 68719476736l; // 1 << 36 -bool boolTest = false; - -struct myStruct { - int i; -} structTest; - -rs_allocation allocationTest; -int *intPtrTest; - -uchar ucharTest = 8; -ushort ushortTest = 16; -uint uintTest = 32; -ulong ulongTest = 4611686018427387904L; -int64_t int64_tTest = -17179869184l; // - 1 << 34 -uint64_t uint64_tTest = 117179869184l; - -static bool test_primitive_types() { - bool failed = false; - start(); - - _RS_ASSERT(floatTest == 2.99f); - _RS_ASSERT(doubleTest == 3.05); - _RS_ASSERT(charTest == -16); - _RS_ASSERT(shortTest == -32); - _RS_ASSERT(intTest == -64); - _RS_ASSERT(longTest == 17179869185l); - _RS_ASSERT(longlongTest == 68719476735l); - - _RS_ASSERT(ucharTest == 8); - _RS_ASSERT(ushortTest == 16); - _RS_ASSERT(uintTest == 32); - _RS_ASSERT(ulongTest == 4611686018427387903L); - _RS_ASSERT(int64_tTest == -17179869184l); - _RS_ASSERT(uint64_tTest == 117179869185l); - - float time = end(); - - if (failed) { - rsDebug("test_primitive_types FAILED", time); - } - else { - rsDebug("test_primitive_types PASSED", time); - } - - return failed; -} - -static bool test_vector_types() { - bool failed = false; - start(); - _RS_ASSERT(avt->b2.x == 1); - _RS_ASSERT(avt->b2.y == 2); - _RS_ASSERT(avt->b3.x == 1); - _RS_ASSERT(avt->b3.y == 2); - _RS_ASSERT(avt->b3.z == 3); - _RS_ASSERT(avt->b4.x == 1); - _RS_ASSERT(avt->b4.y == 2); - _RS_ASSERT(avt->b4.z == 3); - _RS_ASSERT(avt->b4.w == 4); - - _RS_ASSERT(avt->s2.x == 1); - _RS_ASSERT(avt->s2.y == 2); - _RS_ASSERT(avt->s3.x == 1); - _RS_ASSERT(avt->s3.y == 2); - _RS_ASSERT(avt->s3.z == 3); - _RS_ASSERT(avt->s4.x == 1); - _RS_ASSERT(avt->s4.y == 2); - _RS_ASSERT(avt->s4.z == 3); - _RS_ASSERT(avt->s4.w == 4); - - _RS_ASSERT(avt->i2.x == 1); - _RS_ASSERT(avt->i2.y == 2); - _RS_ASSERT(avt->i3.x == 1); - _RS_ASSERT(avt->i3.y == 2); - _RS_ASSERT(avt->i3.z == 3); - _RS_ASSERT(avt->i4.x == 1); - _RS_ASSERT(avt->i4.y == 2); - _RS_ASSERT(avt->i4.z == 3); - _RS_ASSERT(avt->i4.w == 4); - - _RS_ASSERT(avt->f2.x == 1.0f); - _RS_ASSERT(avt->f2.y == 2.0f); - _RS_ASSERT(avt->f3.x == 1.0f); - _RS_ASSERT(avt->f3.y == 2.0f); - _RS_ASSERT(avt->f3.z == 3.0f); - _RS_ASSERT(avt->f4.x == 1.0f); - _RS_ASSERT(avt->f4.y == 2.0f); - _RS_ASSERT(avt->f4.z == 3.0f); - _RS_ASSERT(avt->f4.w == 4.0f); - - float time = end(); - - if (failed) { - rsDebug("test_vector_types FAILED", time); - } - else { - rsDebug("test_vector_types PASSED", time); - } - - return failed; -} - -void test() { - bool failed = false; - failed |= test_primitive_types(); - failed |= test_vector_types(); - - if (failed) { - rsSendToClientBlocking(RS_MSG_TEST_FAILED); - } - else { - rsSendToClientBlocking(RS_MSG_TEST_PASSED); - } -} - diff --git a/tests/src/android/renderscript/cts/shared.rsh b/tests/src/android/renderscript/cts/shared.rsh deleted file mode 100644 index b91611d..0000000 --- a/tests/src/android/renderscript/cts/shared.rsh +++ /dev/null @@ -1,27 +0,0 @@ -#pragma version(1) -#pragma rs java_package_name(android.renderscript.cts) - -static int64_t g_time; - -static void start(void) { - g_time = rsUptimeMillis(); -} - -static float end(void) { - int64_t t = rsUptimeMillis() - g_time; - return ((float)t) / 1000.f; -} - -#define _RS_ASSERT(b) \ -do { \ - if (!(b)) { \ - failed = true; \ - rsDebug(#b " FAILED", 0); \ - } \ -\ -} while (0) - -/* These constants must match those in UnitTest.java */ -static const int RS_MSG_TEST_PASSED = 100; -static const int RS_MSG_TEST_FAILED = 101; - diff --git a/tests/src/android/renderscript/cts/struct_pad.rs b/tests/src/android/renderscript/cts/struct_pad.rs deleted file mode 100644 index 0c013a3..0000000 --- a/tests/src/android/renderscript/cts/struct_pad.rs +++ /dev/null @@ -1,8 +0,0 @@ -#include "shared.rsh" - -struct PadMe { - int i; - float4 f4; - int j; -} s; - diff --git a/tests/src/android/renderscript/cts/structs.rsh b/tests/src/android/renderscript/cts/structs.rsh deleted file mode 100755 index e7d2efd..0000000 --- a/tests/src/android/renderscript/cts/structs.rsh +++ /dev/null @@ -1,56 +0,0 @@ -// 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. - -typedef struct ConstMatrix { - rs_matrix4x4 MATRIX; -} ConstMatrix_s; -ConstMatrix_s *c1; - -typedef struct ConstComplex { - rs_matrix4x4 MATRIX; - rs_matrix4x4 EXTRA; - float extra1; - float2 extra2; - float3 extra3; - float4 extra4; -} ConstComplex_s; -ConstComplex_s *c2; - -typedef struct ConstExtra { - rs_matrix4x4 EXTRA; - float extra1; - float2 extra2; - float3 extra3; - float4 extra4; -} ConstExtra_s; -ConstExtra_s *c3; - -typedef struct AllVectorTypes { - char2 b2; - char3 b3; - char4 b4; - - short2 s2; - short3 s3; - short4 s4; - - int2 i2; - int3 i3; - int4 i4; - - float2 f2; - float3 f3; - float4 f4; -} AllVectorTypes_s; -AllVectorTypes_s *avt; diff --git a/tests/src/android/renderscript/cts/stub_activity.rs b/tests/src/android/renderscript/cts/stub_activity.rs deleted file mode 100644 index 7e149f7..0000000 --- a/tests/src/android/renderscript/cts/stub_activity.rs +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - -#pragma version(1) - -// Tell which java package name the reflected files should belong to -#pragma rs java_package_name(android.renderscript.cts) - -// Built-in header with graphics API's -#include "rs_graphics.rsh" - -int root(void) { - - // Clear the background color - rsgClearColor(0.0f, 0.0f, 0.0f, 0.0f); - // Tell the runtime what the font color should be - rsgFontColor(1.0f, 1.0f, 1.0f, 1.0f); - // Introuduce ourselves to the world - rsgDrawText("Hello World!", 50, 50); - - // Return value tells RS roughly how often to redraw - // in this case 20 ms - return 20; -} diff --git a/tests/src/android/speech/tts/cts/StubTextToSpeechService.java b/tests/src/android/speech/tts/cts/StubTextToSpeechService.java deleted file mode 100644 index 5e6bb41..0000000 --- a/tests/src/android/speech/tts/cts/StubTextToSpeechService.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 android.speech.tts.cts; - -import android.media.AudioFormat; -import android.speech.tts.SynthesisCallback; -import android.speech.tts.SynthesisRequest; -import android.speech.tts.TextToSpeech; -import android.speech.tts.TextToSpeechService; - -/** - * Stub implementation of {@link TextToSpeechService}. Used for testing the - * TTS engine API. - */ -public class StubTextToSpeechService extends TextToSpeechService { - - @Override - protected String[] onGetLanguage() { - return new String[] { "eng", "USA", "" }; - } - - @Override - protected int onIsLanguageAvailable(String lang, String country, String variant) { - return TextToSpeech.LANG_AVAILABLE; - } - - @Override - protected int onLoadLanguage(String lang, String country, String variant) { - return TextToSpeech.LANG_AVAILABLE; - } - - @Override - protected void onStop() { - } - - @Override - protected void onSynthesizeText(SynthesisRequest request, SynthesisCallback callback) { - if (callback.start(16000, AudioFormat.ENCODING_PCM_16BIT, 1) != TextToSpeech.SUCCESS) { - return; - } - byte[] data = { 0x01, 0x2 }; - if (callback.audioAvailable(data, 0, data.length) != TextToSpeech.SUCCESS) { - return; - } - if (callback.done() != TextToSpeech.SUCCESS) { - return; - } - } - -} diff --git a/tests/src/android/theme/cts/ActionBarModifier.java b/tests/src/android/theme/cts/ActionBarModifier.java deleted file mode 100644 index 2f33a79..0000000 --- a/tests/src/android/theme/cts/ActionBarModifier.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.ActionBar; -import android.app.ActionBar.Tab; -import android.app.FragmentTransaction; - -/** - * Implementation of the {@link ActivityTestInfo} interface for {@link ActionBar} tests. - */ -public class ActionBarModifier implements ActivityTestInfo { - /** - * Runs the basic test case that performs no modifications on the {@link ActionBar}. - */ - public static final int BASIC = 0; - - /** - * Runs the test that turns the icon on the {@link ActionBar} into the up icon version. - */ - public static final int DISPLAY_HOME_AS_UP = 1; - - /** - * Runs the test that displays tabs in the {@link ActionBar}. - */ - public static final int TABS = 2; - - /** - * Runs the test that displays a list ({@link Spinner}-style) in the {@link ActionBar}. - */ - public static final int LIST = 3; - - /** - * Runs the test that displays only the icon and not the title in the {@link ActionBar}. - */ - public static final int NO_TITLE = 4; - - /** - * Runs the test that displays only the icon in the {@link ActionBar}. - */ - public static final int NO_ICON = 5; - - /** - * Runs the test that displays action items in the {@link ActionBar}. - */ - public static final int ACTION_ITEMS = 6; - - /** - * Runs the test that displays a {@link SearchView} as an action view in the {@link ActionBar}. - */ - public static final int ACTION_VIEW = 7; - - /** - * Runs the test that displays a {@link SearchView} as a collapsable action view (opened) in - * the {@link ActionBar}. - */ - public static final int COLLAPSED_ACTION_VIEW = 8; - - private String mTestname; - private int mTestType; - - /** - * Creates an ActionBarModifier with the specified testname and test type. - * @param testname The unique name of hte test. - * @param testType The type of test to run based on the public constants of ActionBarModifier. - */ - public ActionBarModifier(String testname, int testType) { - mTestname = testname; - mTestType = testType; - } - - public String getTestName() { - return mTestname; - } - @Override - public void modifyActivity(SnapshotActivity activity) { - ActionBar actionBar = activity.getActionBar(); - - if (actionBar == null) { - return; - } - - // based on which test was asked, performs a different sequence of actions - switch (mTestType) { - case BASIC: - break; - case DISPLAY_HOME_AS_UP: - actionBar.setDisplayHomeAsUpEnabled(true); - break; - case TABS: - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); - actionBar.setDisplayShowTitleEnabled(false); - actionBar.addTab(actionBar.newTab().setText("First") - .setTabListener(new MyTabListener())); - actionBar.addTab(actionBar.newTab().setText("Second") - .setTabListener(new MyTabListener())); - actionBar.addTab(actionBar.newTab().setText("Third") - .setTabListener(new MyTabListener())); - break; - case LIST: - actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); - break; - case NO_TITLE: - actionBar.setDisplayShowTitleEnabled(false); - break; - case NO_ICON: - actionBar.setDisplayShowHomeEnabled(false); - break; - // for the last three test, a state is set because these ones must be set up - // in Activity.onCreateOptionsMenu. A flag is sent that is then checked later - // in the Activity lifecycle - case ACTION_ITEMS: - case ACTION_VIEW: - case COLLAPSED_ACTION_VIEW: - activity.setActionItemState(mTestType); - } - } - - /** - * Stub class that exists since tabs need to have a listener. Does nothing. - */ - private class MyTabListener implements ActionBar.TabListener { - public void onTabSelected(Tab tab, FragmentTransaction ft) { - // do nothing - } - - public void onTabUnselected(Tab tab, FragmentTransaction ft) { - // do nothing - } - - public void onTabReselected(Tab tab, FragmentTransaction ft) { - // do nothing - } - } - -} diff --git a/tests/src/android/theme/cts/ActivitySnapshotTester.java b/tests/src/android/theme/cts/ActivitySnapshotTester.java deleted file mode 100644 index 3040954..0000000 --- a/tests/src/android/theme/cts/ActivitySnapshotTester.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.Activity; -import android.app.Instrumentation; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.res.Configuration; -import android.graphics.Bitmap; -import android.os.Handler; -import android.test.ActivityInstrumentationTestCase2; -import android.view.View; -import android.view.View.MeasureSpec; - -/** - * This class serves as the main driver for the activity screenshot tests. - */ -public class ActivitySnapshotTester { - private ActivityInstrumentationTestCase2 mTestCases; - private boolean mSplitMode; - private boolean mShouldRetryTest; - - /** - * Creates an {@link ActivitySnapshotTester} to run all of the tests in the given - * configuration as determined by the parameters passed to it. - * @param testCases The ActivityInstrumentationTestCase2 that provides the activity - * to test. - * @param splitMode true if the test should use SplitActionBarWhenNarrow as a uiOption. - * Note that this flag does not actually enable that feature, it merely labels - * the tests appropriately. - */ - public ActivitySnapshotTester( - ActivityInstrumentationTestCase2 testCases, - boolean splitMode) { - mTestCases = testCases; - mSplitMode = splitMode; - } - - /** - * This function either generates the known-good versions of the activity screenshot tests - * or runs the tests in either portrait or landscape orientation - * mode based upon the parameters. - * @param generate true if the known good versions of the tests should be generated. - * @param portrait true if the tests should be run in portrait orientation. - */ - public void genOrTestActivityBitmaps(boolean generate, boolean portrait) { - ThemeInfo[] themes = ThemeTests.getThemes(); - ActivityTestInfo[] activityTests = ThemeTests.getActivityTests(); - - int numActivityTests = activityTests.length; - - // iterate through all of the themes - for (ThemeInfo theme : themes) { - // iterate through all of the tests - for (int i = 0; i < numActivityTests; i++) { - // run in portrait - if (portrait) { - genOrTestActivityBitmap( - theme, activityTests[i], i, - ActivityInfo.SCREEN_ORIENTATION_PORTRAIT, generate); - } else { // landscape - genOrTestActivityBitmap( - theme, activityTests[i], i, - ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE, generate); - } - } - } - } - - private void genOrTestActivityBitmap( - final ThemeInfo theme, final ActivityTestInfo test, final int testIndex, - final int orientation, final boolean generate) { - mShouldRetryTest = true; - while (mShouldRetryTest) { - mShouldRetryTest = false; - - Instrumentation instrumentation = mTestCases.getInstrumentation(); - - // build the intent to send to the activity - Intent intent = new Intent(); - intent.putExtra(ThemeTests.EXTRA_THEME_ID, theme.getResourceId()); - intent.putExtra(ThemeTests.EXTRA_THEME_NAME, theme.getThemeName()); - intent.putExtra(ThemeTests.EXTRA_ORIENTATION, orientation); - intent.putExtra(ThemeTests.EXTRA_ACTIVITY_TEST_INDEX, testIndex); - intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); - mTestCases.setActivityIntent(intent); - - SnapshotActivity activity = mTestCases.getActivity(); - - // run the test - activity.runOnUiThread( - new ActivitySnapshotRunnable(theme, test, orientation, generate)); - - instrumentation.waitForIdleSync(); - - ((TestReset) mTestCases).reset(); - } - - } - - /** - * This class exists so that we can delay testing until we are certain that our orientation - * and window size are correct. We check the values and then, if we're not in a stable state, - * just post another Runnable for the future. - */ - private class ActivitySnapshotRunnable implements Runnable { - private ThemeInfo mTheme; - private ActivityTestInfo mTest; - private int mOrientation; - private boolean mGenerate; - private boolean mShouldRequestLayout; - - /** - * Creates a new ActivitySnapshotRunnable. - * @param theme The {@link ThemeInfo} to test. - * @param test The {@link ActivityTestInfo} to test. - * @param orientation The orientation in which the test should be. - * @param generate Whether we should be generating a known-good version - * or comparing to the previously generated version. - */ - public ActivitySnapshotRunnable(ThemeInfo theme, ActivityTestInfo test, - int orientation, boolean generate) { - this(theme, test, orientation, generate, true); - } - - /** - * Creates a new ActivitySnapshotRunnable. - * @param theme The {@link ThemeInfo} to test. - * @param test The {@link ActivityTestInfo} to test. - * @param orientation The orientation in which the test should be. - * @param generate Whether we should be generating a known-good version - * or comparing to the previously generated version. - * @param shouldRequestLayout true if, before testing or saving the bitmap, - * another layout pass should occur. - */ - private ActivitySnapshotRunnable(ThemeInfo theme, ActivityTestInfo test, - int orientation, boolean generate, boolean shouldRequestLayout) { - mTheme = theme; - mTest = test; - mOrientation = orientation; - mGenerate = generate; - mShouldRequestLayout = shouldRequestLayout; - } - - public void run() { - SnapshotActivity activity = mTestCases.getActivity(); - - String orientationString = (mOrientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) - ? "port" : "land"; - String testName = mTheme.getThemeName() + "_" + orientationString + - "_" + mTest.getTestName(); - - Configuration config = activity.getResources().getConfiguration(); - - int realOrientation; - switch (config.orientation) { - case Configuration.ORIENTATION_LANDSCAPE: - realOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; - break; - case Configuration.ORIENTATION_PORTRAIT: - realOrientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT; - break; - default: - realOrientation = -1; - break; - } - - // seems more stable if we make sure to request the layout again - // can't hurt if it's just one more time - if (mShouldRequestLayout) { - delaySnapshot(activity, false); - return; - } - - BitmapProcessor processor; - - // whether we should generate the bitmap or compare it to the good version - if (mGenerate) { - processor = new BitmapSaver(activity, testName, mSplitMode); - } else { - processor = new BitmapComparer(activity, null, testName, true, mSplitMode); - } - - Bitmap bmp = activity.getBitmapOfWindow(); - processor.processBitmap(bmp); - bmp.recycle(); - } - - /** - * Delays taking a snapshot for a bit longer. - */ - private void delaySnapshot(Activity activity, final boolean shouldRequestLayout) { - View view = activity.getWindow().getDecorView(); - - view.measure(MeasureSpec.makeMeasureSpec(view.getWidth(), MeasureSpec.EXACTLY), - MeasureSpec.makeMeasureSpec(view.getHeight(), MeasureSpec.EXACTLY)); - view.layout(0, 0, view.getWidth(), view.getHeight()); - - new Handler().post(new ActivitySnapshotRunnable(mTheme, mTest, - mOrientation, mGenerate, shouldRequestLayout)); - } - } -} diff --git a/tests/src/android/theme/cts/ActivityTestInfo.java b/tests/src/android/theme/cts/ActivityTestInfo.java deleted file mode 100644 index 1eeaaec..0000000 --- a/tests/src/android/theme/cts/ActivityTestInfo.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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 android.theme.cts; - -/** - * Interface that exists so as to use one piece of code to run all of the - * activity snapshot tests. Note that each test must have a unique test name - * as returned by {@link #getTestName()}. If you wish to modify the activity, - * make sure to do any changes within {@link #modifyActivity(SnapshotActivity)}.

- * - * If absolutely necessary, you can edit the lifecycle methods of {@link SnapshotActivity}. - */ -public interface ActivityTestInfo { - /** - * Returns the unique name of the test. Note that this name must be unique - * among all of the activity tests and all of the theme tests. - * @return The unique name of the test. - */ - public String getTestName(); - - /** - * Performs some manipulations on the activity. Essentially, this function - * is the test's sandbox to do whatever is needed to change the look of the - * activity. - * @param activity The {@link SnapshotActivity} to modify. - */ - public void modifyActivity(SnapshotActivity activity); -} diff --git a/tests/src/android/theme/cts/AlertDialogBuilder.java b/tests/src/android/theme/cts/AlertDialogBuilder.java deleted file mode 100644 index 040d1b5..0000000 --- a/tests/src/android/theme/cts/AlertDialogBuilder.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.AlertDialog; -import android.app.Dialog; -import android.view.View; - -/** - * Implements the {@link DialogBuilder} interface to build and show - * {@link AlertDialog}s for the purposes of testing. In order to reuse - * as much as possible, the constructor takes a flag that describes the - * type of AlertDialog to build for the test. - * - * If you want to create another {@link AlertDialog} test, simply - * add another flag and add another case to the switch statement - * in {link buildDialog()} - */ -public class AlertDialogBuilder implements DialogBuilder { - /** - * Build an {@link AlertDialog} with one button. - */ - public static final int ONE_BUTTON = 0; - /** - * Build an {@link AlertDialog} with two buttons. - */ - public static final int TWO_BUTTONS = 1; - /** - * Build an {@link AlertDialog} with three buttons. - */ - public static final int THREE_BUTTONS = 2; - /** - * Build an {@link AlertDialog} with a list of items. - */ - public static final int LIST = 3; - /** - * Build an {@link AlertDialog} with a single-choice list of items. - */ - public static final int SINGLE_CHOICE = 4; - /** - * Build an {@link AlertDialog} with a multi-choice list of items. - */ - public static final int MULTI_CHOICE = 5; - - private int mDialogType; - - private static final CharSequence[] ITEMS = {"Red", "Green", "Blue"}; - - public AlertDialogBuilder(int dialogType) { - mDialogType = dialogType; - } - - @Override - public Dialog buildDialog(View view) { - AlertDialog.Builder builder = new AlertDialog.Builder(view.getContext()); - - switch (mDialogType) { - case ONE_BUTTON: - builder.setTitle("Exit Dialog") - .setMessage("Are you sure you want to exit?") - .setPositiveButton("Exit", null); - break; - case TWO_BUTTONS: - builder.setMessage("Are you sure you want to exit?") - .setPositiveButton("Exit", null) - .setNegativeButton("Cancel", null); - break; - case THREE_BUTTONS: - builder.setMessage("Are you sure you want to exit?") - .setPositiveButton("Exit", null) - .setNeutralButton("Neutral", null) - .setNegativeButton("Cancel", null); - break; - case LIST: - builder.setTitle("Pick a Color") - .setItems(ITEMS, null); - break; - case SINGLE_CHOICE: - builder.setTitle("Pick a Color") - .setSingleChoiceItems(ITEMS, 1, null); - break; - case MULTI_CHOICE: - builder.setTitle("Pick a Color") - .setMultiChoiceItems(ITEMS, new boolean[]{false, true, false}, null); - break; - } - - return builder.show(); - } -} \ No newline at end of file diff --git a/tests/src/android/theme/cts/BitmapComparer.java b/tests/src/android/theme/cts/BitmapComparer.java deleted file mode 100644 index 7171690..0000000 --- a/tests/src/android/theme/cts/BitmapComparer.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.res.Resources; -import android.content.res.Resources.NotFoundException; -import android.graphics.Bitmap; -import android.graphics.drawable.BitmapDrawable; -import android.widget.ImageView; -import android.widget.TextView; - -import junit.framework.Assert; - -/** - * Implementation of {@link BitmapProcessor} that compares the created bitmap - * to a known good version based on pixel-perfect matching - * (specifically {@link Bitmap#sameAs(Bitmap)}. Asserts if the bitmaps do not compare. - */ -public class BitmapComparer implements BitmapProcessor { - private String mBitmapIdName; - private boolean mShouldAssert; - private Activity mActivity; - private ImageView mReferenceImage; - - public BitmapComparer(Activity activity, ImageView referenceImage, - String filename, boolean shouldAssert, boolean splitMode) { - mActivity = activity; - mReferenceImage = referenceImage; - mShouldAssert = shouldAssert; - - if (splitMode) { - mBitmapIdName = filename + "_split"; - } else { - mBitmapIdName = filename; - } - } - - @Override - public void processBitmap(Bitmap bitmap) { - // get the bitmap from the resource system - // since we only have the name, not the resource ID, - // we need to look up the ID first - Resources r = mActivity.getResources(); - int resourceId = r.getIdentifier(mBitmapIdName, "drawable", mActivity.getPackageName()); - - BitmapDrawable drawable = null; - - try { - drawable = (BitmapDrawable) r.getDrawable(resourceId); - } catch (NotFoundException e) { - Assert.fail("Test Failed: Resource not found - " + mBitmapIdName); - } - - Bitmap bmp2 = drawable.getBitmap(); - - if (mReferenceImage != null) { - mReferenceImage.setImageBitmap(bmp2); - } - - // pixel-perfect matching - could easily re-write to use a fuzzy-matching algorithm - boolean identical = bmp2.sameAs(bitmap); - - // the second and third options are for the manual lookup version - if (mShouldAssert) { - if (!identical) { - BitmapSaver saver = new BitmapSaver(mActivity, "failed_image_" + mBitmapIdName, false); - saver.processBitmap(bitmap); - } - Assert.assertTrue("Test failed: " + mBitmapIdName, identical); - } else if (identical) { - ((TextView) mActivity.findViewById(R.id.text)).setText("Bitmaps identical"); - } else { - ((TextView) mActivity.findViewById(R.id.text)).setText("Bitmaps differ"); - } - } -} \ No newline at end of file diff --git a/tests/src/android/theme/cts/BitmapProcessor.java b/tests/src/android/theme/cts/BitmapProcessor.java deleted file mode 100644 index 4031471..0000000 --- a/tests/src/android/theme/cts/BitmapProcessor.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.graphics.Bitmap; - -/** - * Simple interface in order to share code between the bitmap comparison and bitmap generation - * steps. - */ -public interface BitmapProcessor { - /** - * Processes the bitmap that is passed into this function, either saving it or comparing - * it against a previously generated version. - * @param bitmap The bitmap to process. - */ - public void processBitmap(Bitmap bitmap); -} \ No newline at end of file diff --git a/tests/src/android/theme/cts/BitmapSaver.java b/tests/src/android/theme/cts/BitmapSaver.java deleted file mode 100644 index a28944d..0000000 --- a/tests/src/android/theme/cts/BitmapSaver.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.Activity; -import android.content.Context; -import android.graphics.Bitmap; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - -import junit.framework.Assert; - -/** - * Implementation of {@link BitmapProcessor} that saves a known-good version of a - * bitmap and saves it to the application's data folder. - */ -public class BitmapSaver implements BitmapProcessor { - private String mFilename; - private Activity mActivity; - - public BitmapSaver(Activity activity, String filename, boolean splitMode) { - mActivity = activity; - - if (splitMode) { - mFilename = filename + "_split.png"; - } else { - mFilename = filename + ".png"; - } - } - - @Override - public void processBitmap(Bitmap bitmap) { - try { - FileOutputStream fos = mActivity.openFileOutput(mFilename, Context.MODE_PRIVATE); - bitmap.compress(Bitmap.CompressFormat.PNG, 100, fos); - fos.close(); - } catch (FileNotFoundException e) { - Assert.fail("Test Failed: FileNotFoundException thrown"); - } catch (IOException e) { - Assert.fail("Test Failed: IOException thrown"); - } - } -} \ No newline at end of file diff --git a/tests/src/android/theme/cts/CalendarViewModifier.java b/tests/src/android/theme/cts/CalendarViewModifier.java deleted file mode 100644 index 0f3be46..0000000 --- a/tests/src/android/theme/cts/CalendarViewModifier.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.view.View; -import android.widget.CalendarView; - -/** - * Modifies the CalendarView widget in order to set a precise date. - */ -public class CalendarViewModifier implements ThemeTestModifier { - /** - * Long representation of a date that is 30 years in milliseconds from - * Unix epoch (January 1, 1970 00:00:00). - */ - private static final long DATE = 946707779241L; - - @Override - public View modifyView(View view) { - ((CalendarView) view).setDate(DATE); - return view; - } -} diff --git a/tests/src/android/theme/cts/DatePickerModifier.java b/tests/src/android/theme/cts/DatePickerModifier.java deleted file mode 100644 index b3d2002..0000000 --- a/tests/src/android/theme/cts/DatePickerModifier.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.view.View; -import android.widget.DatePicker; - -/** - * Modifies a DatePicker widget to set a precise date. - */ -public class DatePickerModifier implements ThemeTestModifier { - - @Override - public View modifyView(View view) { - DatePicker tp = (DatePicker) view; - tp.updateDate(2011, 6, 21); - return view; - } -} diff --git a/tests/src/android/theme/cts/DialogBuilder.java b/tests/src/android/theme/cts/DialogBuilder.java deleted file mode 100644 index a870895..0000000 --- a/tests/src/android/theme/cts/DialogBuilder.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.Dialog; -import android.view.View; - -/** - * Interface to implement should you want to write a test that uses - * a Dialog. Since a Dialog shows in a new window, implementation - * of this interface is required in order to appropriately save - * the Dialog for testing. - */ -public interface DialogBuilder { - /** - * Builds and shows a Dialog to be saved. - * @return The Dialog to save. - */ - public Dialog buildDialog(View view); -} \ No newline at end of file diff --git a/tests/src/android/theme/cts/DialogModifier.java b/tests/src/android/theme/cts/DialogModifier.java deleted file mode 100644 index bf37f4d..0000000 --- a/tests/src/android/theme/cts/DialogModifier.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.Dialog; -import android.view.View; -import android.view.ViewGroup; - -/** - * This class builds and modifies a Dialog (or its derived classes) - * in order to use in the Theme Testing framework. To create a new - * Dialog test, either create a new class that implements {@link DialogBuilder} - * or add another test to the existing implementations of {@link DialogBuilder}. - * - * See {@link AlertDialogBuilder} for an existing implementation. - */ -public class DialogModifier implements ThemeTestModifier { - private DialogBuilder mBuilder; - - public DialogModifier(DialogBuilder builder) { - mBuilder = builder; - } - - @Override - public View modifyView(View view) { - Dialog alert = mBuilder.buildDialog(view); - ViewGroup parent = (ViewGroup) view.getParent(); - parent.removeView(view); // remove the filler view - - // get the dialog as a view - View newView = alert.getWindow().getDecorView(); - - // remove it from the dialog - alert.getWindow().getWindowManager().removeView(newView); - - // so we can add it to our ViewGroup - parent.addView(newView); - - return newView; - } -} diff --git a/tests/src/android/theme/cts/OrientationSelectorActivity.java b/tests/src/android/theme/cts/OrientationSelectorActivity.java deleted file mode 100644 index 72aa425..0000000 --- a/tests/src/android/theme/cts/OrientationSelectorActivity.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.Intent; -import android.os.Bundle; -import android.view.View; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.ArrayAdapter; -import android.widget.ListView; - -/** - * This activity exists solely for debugging purposes. It is - * the first activity seen when launching the manual viewer of tests. - * It allows the user to select whether they want to see the tests - * in portrait or landscape mode. - */ -public class OrientationSelectorActivity extends Activity { - private static final String[] mOrientations = {"landscape", "portrait"}; - /** - * Called with the activity is first created. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.themetestlistactivity); - - ListView lv = (ListView) findViewById(R.id.tests_list); - - lv.setAdapter( - new ArrayAdapter(this, android.R.layout.simple_list_item_1, mOrientations)); - - lv.setOnItemClickListener(mTestClickedListener); - } - - private OnItemClickListener mTestClickedListener = new OnItemClickListener() { - public void onItemClick(AdapterView parent, View view, int position, long id) { - Intent intent = - new Intent(OrientationSelectorActivity.this, ThemeSelectorActivity.class); - intent.putExtra(ThemeTests.EXTRA_ORIENTATION, position); - startActivity(intent); - } - }; -} diff --git a/tests/src/android/theme/cts/ProgressDialogBuilder.java b/tests/src/android/theme/cts/ProgressDialogBuilder.java deleted file mode 100644 index 18decd9..0000000 --- a/tests/src/android/theme/cts/ProgressDialogBuilder.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.Dialog; -import android.app.ProgressDialog; -import android.view.View; - -/** - * This class implements the {@link DialogBuilder} interface - * in order to build {@link ProgressDialog}s for testing purposes. - * - *

In order to add more tests of {@link ProgressDialog}, simply - * add another case inside {@link ProgressDialogBuilder#buildDialog}. - */ -public class ProgressDialogBuilder implements DialogBuilder { - /** - * Builds a {@link ProgressDialog} that contains a circular - * {@link ProgressBar}. - */ - public static final int SPINNER = 0; - - /** - * Builds a {@link ProgressDialog} that contains a horizontal - * {@link ProgressBar}. - */ - public static final int HORIZONTAL = 1; - - private int mDialogType; - - public ProgressDialogBuilder(int dialogType) { - mDialogType = dialogType; - } - - @Override - public Dialog buildDialog(View view) { - ProgressDialog progressDialog = new ProgressDialog(view.getContext()); - progressDialog.setMessage("Loading..."); - - switch (mDialogType) { - case SPINNER: - progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER); - break; - case HORIZONTAL: - progressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); - progressDialog.setMax(100); - break; - } - - progressDialog.show(); - return progressDialog; - } - -} diff --git a/tests/src/android/theme/cts/SearchViewModifier.java b/tests/src/android/theme/cts/SearchViewModifier.java deleted file mode 100644 index dc2c024..0000000 --- a/tests/src/android/theme/cts/SearchViewModifier.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.view.View; -import android.widget.SearchView; - -/** - * This class modifies {@link SearchView} for the various tests that test - * the look of it. - */ -public class SearchViewModifier implements ThemeTestModifier { - public static final int QUERY_HINT = 0; - public static final int QUERY = 1; - - private int mSearchViewType; - - public SearchViewModifier(int searchViewType) { - mSearchViewType = searchViewType; - } - - @Override - public View modifyView(View view) { - SearchView sv = (SearchView) view; - - switch (mSearchViewType) { - case QUERY_HINT: - sv.setQueryHint("Query Hint"); - break; - case QUERY: - sv.setQuery("Query", false); - break; - } - - sv.setIconifiedByDefault(false); - return sv; - } -} diff --git a/tests/src/android/theme/cts/SnapshotActivity.java b/tests/src/android/theme/cts/SnapshotActivity.java deleted file mode 100644 index 1344600..0000000 --- a/tests/src/android/theme/cts/SnapshotActivity.java +++ /dev/null @@ -1,166 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.ActionBar; -import android.app.Activity; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.res.Configuration; -import android.content.res.Resources; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.os.Bundle; -import android.view.Menu; -import android.view.MenuItem; -import android.view.View; -import android.view.WindowManager.LayoutParams; -import android.widget.SearchView; - -/** - * This class is an Activity that knows how to set its orientation and theme (via intent - * extras being passed, as well as calling - * {@link ActivityTestInfo#modifyActivity(SnapshotActivity)} in order to - * perform some modification on the activity itself that is different for - * each test. - */ -public class SnapshotActivity extends Activity { - private int mActionItemState; - - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - mActionItemState = -1; - - updateWindowSize(); - - Intent intent = getIntent(); - - // set the orientation - int orientation = intent.getIntExtra(ThemeTests.EXTRA_ORIENTATION, - ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - - setRequestedOrientation(orientation); - - // set the theme - int themeId = intent.getIntExtra(ThemeTests.EXTRA_THEME_ID, 0); - - setTheme(themeId); - - setContentView(R.layout.empty); - - int testIndex = intent.getIntExtra(ThemeTests.EXTRA_ACTIVITY_TEST_INDEX, -1); - - if (testIndex < 0) { - return; - } - - // modify the Activity in some way - ThemeTests.getActivityTests()[testIndex].modifyActivity(this); - } - - @Override - public void onConfigurationChanged(Configuration newConfig) { - super.onConfigurationChanged(newConfig); - - updateWindowSize(); - } - - public void updateWindowSize() { - Resources resources = getResources(); - - // set the window to a known size so that we don't have issues with different - // screen sizes - int referenceWidthDp = resources.getDimensionPixelSize(R.dimen.reference_width); - int referenceHeightDp = resources.getDimensionPixelSize(R.dimen.reference_height); - - LayoutParams attrs = getWindow().getAttributes(); - - // set layout when the orientation has changed - if (attrs.width != referenceWidthDp || attrs.height != referenceHeightDp) { - getWindow().setLayout(referenceWidthDp, referenceHeightDp); - } - } - - /** - * Returns a {@link Bitmap} of the Activity's decor view. - * @return A {@link Bitmap} of the Activity's decor view. - */ - public Bitmap getBitmapOfWindow() { - View decorView = getWindow().getDecorView(); - - decorView.setFocusable(false); - - Bitmap bitmap = Bitmap.createBitmap( - decorView.getWidth(), decorView.getHeight(), Bitmap.Config.ARGB_8888); - - Canvas canvas = new Canvas(bitmap); - decorView.draw(canvas); - - return bitmap; - } - - - @Override - public boolean onCreateOptionsMenu(Menu menu) { - MenuItem actionItem; - SearchView searchView; - switch (mActionItemState) { - case ActionBarModifier.ACTION_ITEMS: - actionItem = menu.add("Share").setIcon(android.R.drawable.ic_menu_share); - actionItem.setShowAsAction( - MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT); - - actionItem = menu.add("Add").setIcon(android.R.drawable.ic_menu_add); - actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - actionItem = menu.add("Save").setIcon(android.R.drawable.ic_menu_save); - actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM); - - return true; - case ActionBarModifier.ACTION_VIEW: - getMenuInflater().inflate(R.menu.menu_searchview, menu); - searchView - = (SearchView) menu.findItem(R.id.menu_search).getActionView(); - searchView.setIconifiedByDefault(false); - return super.onCreateOptionsMenu(menu); - case ActionBarModifier.COLLAPSED_ACTION_VIEW: // TODO - fix this test: currently broken - getMenuInflater().inflate(R.menu.menu_searchview, menu); - actionItem = menu.findItem(R.id.menu_search); - actionItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW); - searchView = (SearchView) actionItem.getActionView(); - searchView.setFocusable(false); - actionItem.expandActionView(); - return super.onCreateOptionsMenu(menu); - default: - return false; - } - } - - /** - * Sets the actionItemState that will be used to figure out how to - * modify the {@link ActionBar}'s action items in {@link Activity#onCreateOptionsMenu}. - * @param actionItemState The actionItemState to use. Corrensponds to the public - * constants in {@link ActionBarModifier}. - */ - public void setActionItemState(int actionItemState) { - mActionItemState = actionItemState; - } -} diff --git a/tests/src/android/theme/cts/SplitSnapshotActivity.java b/tests/src/android/theme/cts/SplitSnapshotActivity.java deleted file mode 100644 index f97c638..0000000 --- a/tests/src/android/theme/cts/SplitSnapshotActivity.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 android.theme.cts; - -/** - * This class is a stub so that we can run the Activity tests using the - * uiOption SplitActionBarWhenNarrow. Its implementation is deliberately empty - * since it is supposed to run the same tests as those carried out by its - * base class {@link SnapshotActivity}. Changes to the tests, if necessary, - * should be carried out there. - */ -public class SplitSnapshotActivity extends SnapshotActivity { - // EMPTY BY DESIGN -} diff --git a/tests/src/android/theme/cts/TabHostModifier.java b/tests/src/android/theme/cts/TabHostModifier.java deleted file mode 100644 index 86197f5..0000000 --- a/tests/src/android/theme/cts/TabHostModifier.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.view.View; -import android.widget.TabHost; - -/** - * Modifies {@link TabHost} widget for use in testing. - */ -public class TabHostModifier implements ThemeTestModifier { - - @Override - public View modifyView(View view) { - TabHost tabHost = (TabHost) view; - tabHost.setup(); - TabHost.TabSpec spec; // Reusable TabSpec for each tab - - // Initialize a TabSpec for each tab and add it to the TabHost - spec = tabHost.newTabSpec("artists").setIndicator("Artists").setContent(R.id.tabInnerView); - tabHost.addTab(spec); - - // Do the same for the other tabs - spec = tabHost.newTabSpec("albums").setIndicator("Albums").setContent(R.id.tabInnerView); - tabHost.addTab(spec); - - spec = tabHost.newTabSpec("songs").setIndicator("Songs").setContent(R.id.tabInnerView); - tabHost.addTab(spec); - - tabHost.setCurrentTab(2); - - return view; - } -} diff --git a/tests/src/android/theme/cts/TestListActivity.java b/tests/src/android/theme/cts/TestListActivity.java deleted file mode 100644 index 380adab..0000000 --- a/tests/src/android/theme/cts/TestListActivity.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.os.Bundle; -import android.view.View; -import android.widget.AdapterView; -import android.widget.AdapterView.OnItemClickListener; -import android.widget.ListView; - -import junit.framework.Assert; - -/** - * Exists for debugging purposes. Allows the manual verifier - * to select which test to look at. Displays a list of all of the - * tests. Selecting one shows the reference and generated images - * for that specific test. - */ -public class TestListActivity extends Activity { - private int mThemeId; - private String mThemeName; - private int mOrientation; - - /** - * Called with the activity is first created. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - Intent intent = getIntent(); - mThemeId = intent.getIntExtra(ThemeTests.EXTRA_THEME_ID, 0); - - // test should fail if no theme is set - Assert.assertTrue("No Theme Resource ID set", mThemeId != 0); - - mThemeName = intent.getStringExtra(ThemeTests.EXTRA_THEME_NAME); - - setTheme(mThemeId); - - setContentView(R.layout.themetestlistactivity); - - ListView lv = (ListView) findViewById(R.id.tests_list); - lv.setAdapter(new ThemeTestAdapter(this, ThemeTests.getTests())); - - lv.setOnItemClickListener(mTestClickedListener); - - mOrientation = intent.getIntExtra(ThemeTests.EXTRA_ORIENTATION, - ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - } - - private OnItemClickListener mTestClickedListener = new OnItemClickListener() { - public void onItemClick(AdapterView parent, View view, int position, long id) { - Intent intent = new Intent(TestListActivity.this, ThemeTestRunnerActivity.class); - intent.putExtra(ThemeTests.EXTRA_THEME_ID, mThemeId); - intent.putExtra(ThemeTests.EXTRA_THEME_NAME, mThemeName); - intent.putExtra(ThemeTests.EXTRA_RUN_INDIVIDUAL_TEST, position); - intent.putExtra(ThemeTests.EXTRA_ORIENTATION, mOrientation); - startActivity(intent); - } - }; -} diff --git a/tests/src/android/theme/cts/TestReset.java b/tests/src/android/theme/cts/TestReset.java deleted file mode 100644 index 78e0fa0..0000000 --- a/tests/src/android/theme/cts/TestReset.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 android.theme.cts; - -/** - * This interface exists for the sole purpose of separating the - * {@link ActivityInstrumentationTestCase2} that runs the activity - * screenshot tests from the actual code. In order to work properly - * with multiple activities, the {@link ActivityInstrumentationTestCase2} - * must {@link ActivityInstrumentationTestCase2#tearDown} and - * {@link ActivityInstrumentationTestCase2#setUp} itself after - * each test. Since those methods are protected, this interface - * serves as a way to implement that functionality while allowing - * two separate {@link ActivityInstrumentationTestCase2}s to exist, - * one for the regular activity screenshot tests and the other one for - * the while sharing code between both for most of the test framework. - */ -public interface TestReset { - public void reset(); -} diff --git a/tests/src/android/theme/cts/TesterViewGroup.java b/tests/src/android/theme/cts/TesterViewGroup.java deleted file mode 100644 index aa42724..0000000 --- a/tests/src/android/theme/cts/TesterViewGroup.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.content.Context; -import android.content.res.Resources; -import android.util.AttributeSet; -import android.view.View; -import android.view.ViewGroup; - -/** - * Custom view group to handle density changes while maintaining screen independence. - */ -public class TesterViewGroup extends ViewGroup { - private int mReferenceWidthDp; - private int mReferenceHeightDp; - - public TesterViewGroup(Context context) { - this(context, null); - } - - public TesterViewGroup(Context context, AttributeSet attrs) { - super(context, attrs); - - Resources resources = context.getResources(); - - mReferenceWidthDp = resources.getDimensionPixelSize(R.dimen.reference_width); - mReferenceHeightDp = resources.getDimensionPixelSize(R.dimen.reference_height); - } - - @Override - protected void onLayout(boolean changed, int l, int t, int r, int b) { - if (!changed) { - return; - } - - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - View child = getChildAt(i); - child.layout(0, 0, child.getMeasuredWidth(), child.getMeasuredHeight()); - } - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - widthMeasureSpec = getMeasureSpec(LayoutParams.MATCH_PARENT, mReferenceWidthDp); - heightMeasureSpec = getMeasureSpec(LayoutParams.MATCH_PARENT, mReferenceHeightDp); - - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - - int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - View child = getChildAt(i); - - LayoutParams params = child.getLayoutParams(); - - int height = getMeasureSpec(params.height, mReferenceWidthDp); - int width = getMeasureSpec(params.width, mReferenceHeightDp); - child.measure(width, height); - } - } - - private int getMeasureSpec(int val, int referenceSize) { - if (val == LayoutParams.MATCH_PARENT) { - return MeasureSpec.makeMeasureSpec(referenceSize, MeasureSpec.EXACTLY); - } else if (val == LayoutParams.WRAP_CONTENT) { - return MeasureSpec.makeMeasureSpec(referenceSize, MeasureSpec.AT_MOST); - } else { - return val; - } - } -} diff --git a/tests/src/android/theme/cts/ThemeInfo.java b/tests/src/android/theme/cts/ThemeInfo.java deleted file mode 100644 index a2556e0..0000000 --- a/tests/src/android/theme/cts/ThemeInfo.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 android.theme.cts; - -public class ThemeInfo { - private int mResourceId; - private String mThemeName; - - public ThemeInfo(int resourceId, String themeName) { - mResourceId = resourceId; - mThemeName = themeName; - } - - public int getResourceId() { - return mResourceId; - } - - public String getThemeName() { - return mThemeName; - } -} diff --git a/tests/src/android/theme/cts/ThemeSelectorActivity.java b/tests/src/android/theme/cts/ThemeSelectorActivity.java deleted file mode 100644 index d9c05d6..0000000 --- a/tests/src/android/theme/cts/ThemeSelectorActivity.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.os.Bundle; -import android.view.View; -import android.widget.AdapterView; -import android.widget.ListView; -import android.widget.AdapterView.OnItemClickListener; - -/** - * This activity exists solely for debugging purposes. It allows the manual - * verifier to select which theme to test. - */ -public class ThemeSelectorActivity extends Activity { - private ThemeInfo[] mThemes; - private int mOrientation; - /** - * Called with the activity is first created. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - setContentView(R.layout.themetestlistactivity); - - ListView lv = (ListView) findViewById(R.id.tests_list); - - mThemes = ThemeTests.getThemes(); - lv.setAdapter(new ThemesAdapter(this, mThemes)); - - lv.setOnItemClickListener(mTestClickedListener); - - mOrientation = getIntent().getIntExtra(ThemeTests.EXTRA_ORIENTATION, - ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - } - - private OnItemClickListener mTestClickedListener = new OnItemClickListener() { - public void onItemClick(AdapterView parent, View view, int position, long id) { - Intent intent = new Intent(ThemeSelectorActivity.this, TestListActivity.class); - ThemeInfo theme = mThemes[position]; - intent.putExtra(ThemeTests.EXTRA_THEME_ID, theme.getResourceId()); - intent.putExtra(ThemeTests.EXTRA_THEME_NAME, theme.getThemeName()); - intent.putExtra(ThemeTests.EXTRA_ORIENTATION, mOrientation); - startActivity(intent); - } - }; -} diff --git a/tests/src/android/theme/cts/ThemeTestAdapter.java b/tests/src/android/theme/cts/ThemeTestAdapter.java deleted file mode 100644 index 2172d24..0000000 --- a/tests/src/android/theme/cts/ThemeTestAdapter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.Activity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.TextView; - -public class ThemeTestAdapter extends BaseAdapter { - private LayoutInflater mInflater; - private ThemeTestInfo[] mTests; - - public ThemeTestAdapter(Activity activity, ThemeTestInfo[] tests) { - mTests = tests; - mInflater = activity.getLayoutInflater(); - } - - @Override - public int getCount() { - return mTests.length; - } - - @Override - public Object getItem(int position) { - return mTests[position]; - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - if (convertView == null) { - convertView = mInflater.inflate(android.R.layout.simple_list_item_1, parent, false); - } - - ((TextView) convertView).setText(mTests[position].getTestName()); - - return convertView; - } -} diff --git a/tests/src/android/theme/cts/ThemeTestGeneratorActivity.java b/tests/src/android/theme/cts/ThemeTestGeneratorActivity.java deleted file mode 100644 index f770b5a..0000000 --- a/tests/src/android/theme/cts/ThemeTestGeneratorActivity.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.os.Bundle; - -import junit.framework.Assert; - -/** - * Generates the master bitmaps for all of the tests for the specific - * theme and orientation requested via the intent. - */ -public class ThemeTestGeneratorActivity extends Activity { - private ThemeTester mTester; - - /** - * Called with the activity is first created. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - Intent intent = getIntent(); - int themeId = intent.getIntExtra(ThemeTests.EXTRA_THEME_ID, 0); - - // test should fail if no theme is set - Assert.assertTrue("No Theme Resource ID set", themeId != 0); - - String themeName = intent.getStringExtra(ThemeTests.EXTRA_THEME_NAME); - - setTheme(themeId); - setContentView(R.layout.testing_activity); - - int orientation = intent.getIntExtra(ThemeTests.EXTRA_ORIENTATION, - ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - - setRequestedOrientation(orientation); - - String oriented = ""; - if (orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { - oriented = "land"; - } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { - oriented = "port"; - } - - mTester = new ThemeTester(this, themeName + "_" + oriented); - } - - public void generateTests() { - mTester.generateTests(); - } -} diff --git a/tests/src/android/theme/cts/ThemeTestInfo.java b/tests/src/android/theme/cts/ThemeTestInfo.java deleted file mode 100644 index eb28299..0000000 --- a/tests/src/android/theme/cts/ThemeTestInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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 android.theme.cts; - -/** - * Class that represents a test case. Add a new one to the list of tests in ThemeTests.java - * in order to create a new test. - */ -public class ThemeTestInfo { - private int mResourceId; - private ThemeTestModifier mModifier; - private String mTestname; - - /** - * Creates a new theme test. - * @param layoutResourceId The resource ID of the layout to use for this test. - * @param modifier The {@link ThemeTestModifier} to use in order to modify the layout - * of the test. - * @param testname The UNIQUE name of the test. - */ - public ThemeTestInfo(int layoutResourceId, ThemeTestModifier modifier, String testname) { - mResourceId = layoutResourceId; - mModifier = modifier; - mTestname = testname; - } - - public int getLayoutResourceId() { - return mResourceId; - } - - public ThemeTestModifier getThemeModifier() { - return mModifier; - } - - public String getTestName() { - return mTestname; - } -} diff --git a/tests/src/android/theme/cts/ThemeTestModifier.java b/tests/src/android/theme/cts/ThemeTestModifier.java deleted file mode 100644 index b5e3345..0000000 --- a/tests/src/android/theme/cts/ThemeTestModifier.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.view.View; - -/** - * Interface that should be implemented if you want to modify the view being tested. - * - * For a sample implementation, see {@link ViewPressedModifier}. - */ -public interface ThemeTestModifier { - /** - * Define this function in order to modify the layout for your test. - * The View that is passed in is the root of layout that is specified in the test. - * @param view The root view of the layout. - * @return The view that will be saved as a bitmap. This view does not necessarily - * have to be the view that was passed into modifyView, however most implementations - * probably will return the original view. - */ - public View modifyView(View view); -} diff --git a/tests/src/android/theme/cts/ThemeTestRunnerActivity.java b/tests/src/android/theme/cts/ThemeTestRunnerActivity.java deleted file mode 100644 index d337231..0000000 --- a/tests/src/android/theme/cts/ThemeTestRunnerActivity.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.os.Bundle; - -import junit.framework.Assert; - -/** - * Builds the bitmaps for all of the tests on the fly and - * compares them to the known master versions. - */ -public class ThemeTestRunnerActivity extends Activity { - private ThemeTester mTester; - /** - * Called with the activity is first created. - */ - @Override - public void onCreate(Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - - Intent intent = getIntent(); - int themeId = intent.getIntExtra(ThemeTests.EXTRA_THEME_ID, 0); - - // test should fail if no theme is set - Assert.assertTrue("No Theme Resource ID set", themeId != 0); - - String themeName = intent.getStringExtra(ThemeTests.EXTRA_THEME_NAME); - - setTheme(themeId); - setContentView(R.layout.testing_activity); - - int orientation = intent.getIntExtra(ThemeTests.EXTRA_ORIENTATION, - ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED); - - setRequestedOrientation(orientation); - - String oriented = ""; - if (orientation == ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) { - oriented = "land"; - } else if (orientation == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT) { - oriented = "port"; - } - - mTester = new ThemeTester(this, themeName + "_" + oriented); - - if (intent.getBooleanExtra(ThemeTests.EXTRA_RUN_TESTS, false)) { - mTester.runTests(); - } - - int position = intent.getIntExtra(ThemeTests.EXTRA_RUN_INDIVIDUAL_TEST, -1); - if (position != -1) { - mTester.setShouldAssert(false); - mTester.runTest(position); - } - } - - /** - * Runs the theme tests for the theme that was created. - */ - public void runTests() { - mTester.runTests(); - } -} diff --git a/tests/src/android/theme/cts/ThemeTester.java b/tests/src/android/theme/cts/ThemeTester.java deleted file mode 100644 index a69934f..0000000 --- a/tests/src/android/theme/cts/ThemeTester.java +++ /dev/null @@ -1,175 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.app.Activity; -import android.content.Context; -import android.content.res.Resources; -import android.content.res.Resources.NotFoundException; -import android.graphics.Bitmap; -import android.graphics.Canvas; -import android.graphics.drawable.BitmapDrawable; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.ImageView; -import android.widget.TextView; - -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - -import junit.framework.Assert; - -/** - * This class runs the series of tests for a specific theme in the activity. - * - *

- * Additionally, this class can also generate the good versions of bitmaps to use for testing. - */ -public class ThemeTester { - private Activity mActivity; - private String mThemeName; - private ImageView mReferenceImage; - private ImageView mGeneratedImage; - private TesterViewGroup mRoot; - private boolean mShouldAssert; - - /** - * Creates a ThemeTester to run all of the tests. - * @param activity Activity that serves as a test harness for this theme test. - * @param themeName Name of the theme being tested. - */ - public ThemeTester(Activity activity, String themeName) { - mActivity = activity; - mThemeName = themeName; - mRoot = (TesterViewGroup) mActivity.findViewById(R.id.test_group); - mShouldAssert = true; - - mReferenceImage = (ImageView) mActivity.findViewById(R.id.reference_image); - mGeneratedImage = (ImageView) mActivity.findViewById(R.id.generated_image); - } - - public void setShouldAssert(boolean shouldAssert) { - mShouldAssert = shouldAssert; - } - - /** - * Run all of the tests. - */ - public void runTests() { - ThemeTestInfo[] tests = ThemeTests.getTests(); - for (final ThemeTestInfo test : tests) { - runTest(test); - } - } - - /** - * Run an individual test based upon its position in the tests. - * @param position The position of the test that you wish to run. - */ - public void runTest(int position) { - runTest(ThemeTests.getTests()[position]); - } - - /** - * Run an individual test. - * @param test The {@link ThemeTestInfo} to use for this test. - */ - private void runTest(final ThemeTestInfo test) { - mRoot.post(new Runnable() { - public void run() { - testViewFromId(test); - } - }); - } - - /** - * Generate all of the tests, saving them to Bitmaps in the application's data folder. - */ - public void generateTests() { - ThemeTestInfo[] tests = ThemeTests.getTests(); - for (final ThemeTestInfo test : tests) { - mRoot.post(new Runnable() { - public void run() { - generateViewFromId(test); - } - }); - } - } - - private void testViewFromId(ThemeTestInfo test) { - processBitmapFromViewId(test.getLayoutResourceId(), test.getThemeModifier(), - new BitmapComparer(mActivity, mReferenceImage, - mThemeName + "_" + test.getTestName(), mShouldAssert, false)); - } - - private void generateViewFromId(ThemeTestInfo test) { - processBitmapFromViewId(test.getLayoutResourceId(), test.getThemeModifier(), - new BitmapSaver(mActivity, mThemeName + "_" + test.getTestName(), false)); - } - - private void processBitmapFromViewId( - int resid, ThemeTestModifier modifier, final BitmapProcessor processor) { - final View view = constructViewFromLayoutId(resid, modifier); - - view.post(new Runnable() { - public void run() { - Bitmap bitmap = Bitmap.createBitmap( - view.getWidth(), view.getHeight(), Bitmap.Config.ARGB_8888); - - Canvas canvas = new Canvas(bitmap); - view.draw(canvas); - mGeneratedImage.setImageBitmap(bitmap); - - processor.processBitmap(bitmap); - bitmap.recycle(); - - mRoot.removeView(view); - } - }); - } - - /** - * Inflates and returns the view and performs and modifications of it as required by the test. - * @param resid The resource id of the layout that will be constructed. - * @param modifier The ThemeTestModifier to modify the layout being tested. - * @return The root view of the layout being tested. - */ - private View constructViewFromLayoutId(int resid, ThemeTestModifier modifier) { - LayoutInflater inflater = LayoutInflater.from(mActivity); - - View view = inflater.inflate(resid, mRoot, false); - mRoot.addView(view); - - if (modifier != null) { - view = modifier.modifyView(view); - } - - mRoot.measure(0, 0); // don't care about the input values - we build our reference size - mRoot.layout(0, 0, mRoot.getMeasuredWidth(), mRoot.getMeasuredHeight()); - - view.setFocusable(false); - - return view; - } - - - - -} diff --git a/tests/src/android/theme/cts/ThemeTests.java b/tests/src/android/theme/cts/ThemeTests.java deleted file mode 100644 index 7dce779..0000000 --- a/tests/src/android/theme/cts/ThemeTests.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * 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 android.theme.cts; - -import com.android.cts.stub.R; - -import android.content.pm.ActivityInfo; - -public class ThemeTests { - /** - * Theme name to test. - */ - public static final String EXTRA_THEME_NAME = "android.intent.extra.THEME_NAME"; - - /** - * Theme ID to test. - */ - public static final String EXTRA_THEME_ID = "android.intent.extra.THEME_ID"; - - /** - * Runs only the test supplied (by position number). - */ - public static final String EXTRA_RUN_INDIVIDUAL_TEST - = "android.intent.extra.RUN_INDIVIDUAL_TEST"; - - /** - * Use solely for debugging. The actual intent that runs the tests will not have this flag. - */ - public static final String EXTRA_RUN_TESTS = "android.intent.extra.RUN_TESTS"; - - /** - * Sets the orientation of the tests. Options are - * {@link ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE} or - * {@link ActivityInfo.SCREEN_ORIENTATION_PORTRAIT}. - */ - public static final String EXTRA_ORIENTATION = "android.intent.extra.ORIENTATION"; - - /** - * The index of the current activity test that is being run so that it can be - * read on both sides of an intent. - */ - public static final String EXTRA_ACTIVITY_TEST_INDEX - = "android.intent.extra.ACTIVITY_TEST_INDEX"; - - /** - * The list of tests to run for each theme.

- * In order to create a new test, follow these steps.

- * 1. Create a layout file for the test you wish to run.
- * 2. (Optional) Create a class that derives from ThemeTestModifier - * that will modify the root view of your created layout. Set to null if you do not want - * to modify the view from the layout version.
- * 3. Create a unique String for the name of the test.
- * 4. Add all of the above to the list of tests. as a new {@link ThemeTestInfo}. - */ - private static final ThemeTestInfo[] TESTS = new ThemeTestInfo[] { - new ThemeTestInfo(R.layout.button, null, "button"), - new ThemeTestInfo(R.layout.button, new ViewPressedModifier(), "button_pressed"), - new ThemeTestInfo(R.layout.toggle_button, null, "toggle_button"), - new ThemeTestInfo(R.layout.toggle_button_checked, null, "toggle_button_checked"), - new ThemeTestInfo(R.layout.checkbox, null, "checkbox"), - new ThemeTestInfo(R.layout.checkbox_checked, null, "checkbox_checked"), - new ThemeTestInfo(R.layout.radiobutton, null, "radiobutton"), - new ThemeTestInfo(R.layout.radiobutton_checked, null, "radiobutton_checked"), - new ThemeTestInfo(R.layout.spinner, null, "spinner"), - new ThemeTestInfo(R.layout.progressbar, null, "progressbar"), - new ThemeTestInfo(R.layout.progressbar_small, null, "progressbar_small"), - new ThemeTestInfo(R.layout.progressbar_large, null, "progressbar_large"), - new ThemeTestInfo(R.layout.progressbar_horizontal0, null, "progressbar_horizontal0"), - new ThemeTestInfo(R.layout.progressbar_horizontal50, null, "progressbar_horizontal50"), - new ThemeTestInfo(R.layout.progressbar_horizontal100, - null, "progressbar_horizontal100"), - new ThemeTestInfo(R.layout.seekbar_0, null, "seekbar_0"), - new ThemeTestInfo(R.layout.seekbar_50, null, "seekbar_50"), - new ThemeTestInfo(R.layout.seekbar_100, null, "seekbar_100"), - new ThemeTestInfo(R.layout.radiogroup_vertical, null, "radiogroup_vertical"), - new ThemeTestInfo(R.layout.radiogroup_horizontal, null, "radiogroup_horizontal"), - new ThemeTestInfo(R.layout.ratingbar_0, null, "ratingbar_0"), - new ThemeTestInfo(R.layout.ratingbar_2point5, null, "ratingbar_2point5"), - new ThemeTestInfo(R.layout.ratingbar_5, null, "ratingbar_5"), - new ThemeTestInfo(R.layout.ratingbar_0, - new ViewPressedModifier(), "ratingbar_0_pressed"), - new ThemeTestInfo(R.layout.ratingbar_2point5, - new ViewPressedModifier(),"ratingbar_2point5_pressed"), - new ThemeTestInfo(R.layout.ratingbar_5, - new ViewPressedModifier(), "ratingbar_5_pressed"), - new ThemeTestInfo(R.layout.textview, null, "textview"), - new ThemeTestInfo(R.layout.blue_light, null, "blue_light"), - new ThemeTestInfo(R.layout.green_light, null, "green_light"), - new ThemeTestInfo(R.layout.red_light, null, "red_light"), - new ThemeTestInfo(R.layout.blue_dark, null, "blue_dark"), - new ThemeTestInfo(R.layout.green_dark, null, "green_dark"), - new ThemeTestInfo(R.layout.red_dark, null, "red_dark"), - new ThemeTestInfo(R.layout.purple, null, "purple"), - new ThemeTestInfo(R.layout.orange_light, null, "orange_light"), - new ThemeTestInfo(R.layout.orange_dark, null, "orange_dark"), - new ThemeTestInfo(R.layout.blue_bright, null, "blue_bright"), - new ThemeTestInfo(R.layout.edittext, null, "edittext"), - new ThemeTestInfo(R.layout.calendarview, new CalendarViewModifier(), "calendarview"), - new ThemeTestInfo(R.layout.zoomcontrols, null, "zoomcontrols"), - new ThemeTestInfo(R.layout.tabhost, new TabHostModifier(), "tabhost"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new AlertDialogBuilder( - AlertDialogBuilder.ONE_BUTTON)), "alertdialog_onebutton"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new AlertDialogBuilder( - AlertDialogBuilder.TWO_BUTTONS)), "alertdialog_twobuttons"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new AlertDialogBuilder( - AlertDialogBuilder.THREE_BUTTONS)), "alertdialog_threebuttons"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new AlertDialogBuilder( - AlertDialogBuilder.LIST)), "alertdialog_list"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new AlertDialogBuilder( - AlertDialogBuilder.SINGLE_CHOICE)), "alertdialog_singlechoice"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new AlertDialogBuilder( - AlertDialogBuilder.MULTI_CHOICE)), "alertdialog_multichoice"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new ProgressDialogBuilder( - ProgressDialogBuilder.SPINNER)), "progressdialog_spinner"), - new ThemeTestInfo(R.layout.empty, - new DialogModifier( - new ProgressDialogBuilder( - ProgressDialogBuilder.HORIZONTAL)), - "progressdialog_horizontal"), - new ThemeTestInfo(R.layout.searchview, null, "searchview"), - new ThemeTestInfo(R.layout.searchview, - new SearchViewModifier(SearchViewModifier.QUERY_HINT), - "searchview_queryhint"), - new ThemeTestInfo(R.layout.searchview, - new SearchViewModifier(SearchViewModifier.QUERY), - "searchview_query")}; - - /** - * Returns the list of tests to run on a particular theme.

- * - * In order to create a new test, follow these steps.

- * 1. Create a layout file for the test you wish to run.
- * 2. (Optional) Create a class that derives from ThemeTestModifier - * that will modify the root view of your created layout. Set to null if you do not want - * to modify the view from the layout version.
- * 3. Create a unique String for the name of the test.
- * 4. Add all of the above to the list of tests. as a new {@link ThemeTestInfo}. - * @return The list of tests. - */ - public static ThemeTestInfo[] getTests() { - return TESTS; - } - - /** - * The list of themes to test. In order to add a new theme, follow these steps.

- * 1. Add a new Theme to the array of Themes in - * cts/tests/src/android/theme/cts/ThemeTests.java. - * Make sure the "theme name" String is unique.
- * 2. There is no step 2. You're done. Congrats. - */ - private static final ThemeInfo[] THEMES = new ThemeInfo[] { - // The themes marked with asterisks seem to blow up when generating a 0x0 bitmap... - new ThemeInfo(android.R.style.Theme_Holo, "holo"), - new ThemeInfo(android.R.style.Theme_Holo_Dialog, "holo_dialog"), - new ThemeInfo(android.R.style.Theme_Holo_Dialog_MinWidth, "holo_dialog_minwidth"), - new ThemeInfo(android.R.style.Theme_Holo_Dialog_NoActionBar, - "holo_dialog_noactionbar"), - new ThemeInfo(android.R.style.Theme_Holo_Dialog_NoActionBar_MinWidth, - "holo_dialog_noactionbar_minwidth"), - new ThemeInfo(android.R.style.Theme_Holo_DialogWhenLarge, "holo_dialogwhenlarge"), - new ThemeInfo(android.R.style.Theme_Holo_DialogWhenLarge_NoActionBar, - "holo_dialogwhenlarge_noactionbar"), - new ThemeInfo(android.R.style.Theme_Holo_InputMethod, "holo_inputmethod"), // * - new ThemeInfo(android.R.style.Theme_Holo_Light, "holo_light"), - new ThemeInfo(android.R.style.Theme_Holo_Light_DarkActionBar, "holo_light_darkactionbar"), - new ThemeInfo(android.R.style.Theme_Holo_Light_Dialog, "holo_light_dialog"), - new ThemeInfo(android.R.style.Theme_Holo_Light_Dialog_MinWidth, - "holo_light_dialog_minwidth"), - new ThemeInfo(android.R.style.Theme_Holo_Light_Dialog_NoActionBar, - "holo_light_dialog_noactionbar"), - new ThemeInfo(android.R.style.Theme_Holo_Light_Dialog_NoActionBar_MinWidth, - "holo_light_dialog_noactionbar_minwidth"), - new ThemeInfo(android.R.style.Theme_Holo_Light_DialogWhenLarge, - "holo_light_dialogwhenlarge"), - new ThemeInfo(android.R.style.Theme_Holo_Light_DialogWhenLarge_NoActionBar, - "holo_light_dialogwhenlarge_noactionbar"), - new ThemeInfo(android.R.style.Theme_Holo_Light_NoActionBar, "holo_light_noactionbar"), - new ThemeInfo(android.R.style.Theme_Holo_Light_NoActionBar_Fullscreen, - "holo_light_noactionbar_fullscreen"), - new ThemeInfo(android.R.style.Theme_Holo_Light_Panel, "holo_light_panel"), // * - new ThemeInfo(android.R.style.Theme_Holo_NoActionBar, "holo_noactionbar"), - new ThemeInfo(android.R.style.Theme_Holo_NoActionBar_Fullscreen, - "holo_noactionbar_fullscreen"), - new ThemeInfo(android.R.style.Theme_Holo_Panel, "holo_panel"), // * - new ThemeInfo(android.R.style.Theme_Holo_Wallpaper, "holo_wallpaper"), - new ThemeInfo(android.R.style.Theme_Holo_Wallpaper_NoTitleBar, "holo_wallpaper_notitlebar") - }; - - /** - * Returns the list of themes to test. In order to add a new theme, follow these steps.

- * 1. Add a new Theme to the array of Themes in - * cts/tests/src/android/theme/cts/ThemeTests.java. - * Make sure the "theme name" String is unique.
- * 2. There is no step 2. You're done. Congrats. - * @return The list of themes. - */ - public static ThemeInfo[] getThemes() { - return THEMES; - } - - /** - * The list of Activity snapshot tests.

- * In order to create a new test, follow these steps.

- * 1. Create a class that inherits from {@link ActivitytestInfo}.
- * 2. Add an initialization of that class to the array below.
- * 3. Done. - */ - private static final ActivityTestInfo[] ACTIVITY_TESTS = new ActivityTestInfo[] { - new ActionBarModifier("actionbar", ActionBarModifier.BASIC), - new ActionBarModifier("actionbar_home_as_up", ActionBarModifier.DISPLAY_HOME_AS_UP), - new ActionBarModifier("actionbar_tabs", ActionBarModifier.TABS), - new ActionBarModifier("actionbar_list", ActionBarModifier.LIST), - new ActionBarModifier("actionbar_no_title", ActionBarModifier.NO_TITLE), - new ActionBarModifier("actionbar_no_icon", ActionBarModifier.NO_ICON), - new ActionBarModifier("actionbar_action_items", ActionBarModifier.ACTION_ITEMS), - new ActionBarModifier("actionbar_action_view", ActionBarModifier.ACTION_VIEW)//, - // TODO - fix this test - I think this one is particularly susceptible - // to the orientation bug so for now i'm just leaving it commented out - /*new ActionBarModifier( - "actionbar_collapsed_action_view", ActionBarModifier.COLLAPSED_ACTION_VIEW)*/ - }; - - /** - * Returns the list of Activity snapshot tests.

- * In order to create a new test, follow these steps.

- * 1. Create a class that inherits from {@link ActivitytestInfo}.
- * 2. Add an initialization of that class to the array below.
- * 3. Done. - * @return The list of Activity snapshot tests. - */ - public static ActivityTestInfo[] getActivityTests() { - return ACTIVITY_TESTS; - } -} diff --git a/tests/src/android/theme/cts/ThemesAdapter.java b/tests/src/android/theme/cts/ThemesAdapter.java deleted file mode 100644 index 15d535f..0000000 --- a/tests/src/android/theme/cts/ThemesAdapter.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.app.Activity; -import android.view.LayoutInflater; -import android.view.View; -import android.view.ViewGroup; -import android.widget.BaseAdapter; -import android.widget.TextView; - -public class ThemesAdapter extends BaseAdapter { - private LayoutInflater mInflater; - private ThemeInfo[] mThemes; - - public ThemesAdapter(Activity activity, ThemeInfo[] themes) { - mThemes = themes; - mInflater = activity.getLayoutInflater(); - } - - @Override - public int getCount() { - return mThemes.length; - } - - @Override - public Object getItem(int position) { - return mThemes[position]; - } - - @Override - public long getItemId(int position) { - return position; - } - - @Override - public View getView(int position, View convertView, ViewGroup parent) { - if (convertView == null) { - convertView = mInflater.inflate(android.R.layout.simple_list_item_1, parent, false); - } - - ((TextView) convertView).setText(mThemes[position].getThemeName()); - - return convertView; - } - -} diff --git a/tests/src/android/theme/cts/TimePickerModifier.java b/tests/src/android/theme/cts/TimePickerModifier.java deleted file mode 100644 index 9a370fc..0000000 --- a/tests/src/android/theme/cts/TimePickerModifier.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.view.View; -import android.widget.TimePicker; - -/** - * Modifies the {@link TimePicker} widget to set a precise time. - */ -public class TimePickerModifier implements ThemeTestModifier { - - @Override - public View modifyView(View view) { - TimePicker tp = (TimePicker) view; - tp.setCurrentHour(10); - tp.setCurrentMinute(40); - - return view; - } -} diff --git a/tests/src/android/theme/cts/ViewPressedModifier.java b/tests/src/android/theme/cts/ViewPressedModifier.java deleted file mode 100644 index 2330c82..0000000 --- a/tests/src/android/theme/cts/ViewPressedModifier.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 android.theme.cts; - -import android.view.View; - -/** - * Modifies the root view of a test so that it is in the pressed state. - */ -public class ViewPressedModifier implements ThemeTestModifier { - - @Override - public View modifyView(View view) { - view.setPressed(true); - return view; - } -} diff --git a/tests/src/android/view/cts/FocusHandlingStubActivity.java b/tests/src/android/view/cts/FocusHandlingStubActivity.java index 9faa609..2124550 100644 --- a/tests/src/android/view/cts/FocusHandlingStubActivity.java +++ b/tests/src/android/view/cts/FocusHandlingStubActivity.java @@ -16,10 +16,9 @@ package android.view.cts; -import com.android.cts.stub.R; - import android.app.Activity; import android.os.Bundle; +import com.android.cts.stub.R; /** * A simple activity to test "Focus Handling" @@ -28,7 +27,6 @@ public class FocusHandlingStubActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - setTheme(android.R.style.Theme_Holo_NoActionBar); setContentView(R.layout.focus_handling_layout); } } diff --git a/tests/src/android/webkit/cts/CtsTestServer.java b/tests/src/android/webkit/cts/CtsTestServer.java old mode 100755 new mode 100644 index 6d3bfe6..2a72d9f --- a/tests/src/android/webkit/cts/CtsTestServer.java +++ b/tests/src/android/webkit/cts/CtsTestServer.java @@ -15,7 +15,7 @@ */ package android.webkit.cts; -import libcore.io.Base64; +import org.apache.harmony.luni.util.Base64; import org.apache.http.Header; import org.apache.http.HttpException; import org.apache.http.HttpRequest; @@ -64,10 +64,6 @@ import java.security.cert.X509Certificate; import java.util.Date; import java.util.Hashtable; import java.util.List; -import java.util.concurrent.Callable; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.TimeUnit; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -381,11 +377,11 @@ public class CtsTestServer { .toString(); } - public synchronized String getLastRequestUrl() { + public String getLastRequestUrl() { return mLastQuery; } - public synchronized int getRequestCount() { + public int getRequestCount() { return mRequestCount; } @@ -394,7 +390,7 @@ public class CtsTestServer { * value, the server will include a "Expires" header. * @param timeMillis The time, in milliseconds, for which any future response will be valid. */ - public synchronized void setDocumentValidity(long timeMillis) { + public void setDocumentValidity(long timeMillis) { mDocValidity = timeMillis; } @@ -403,7 +399,7 @@ public class CtsTestServer { * a "Last-Modified" header calculated from the value. * @param timeMillis The age, in milliseconds, of any document served in the future. */ - public synchronized void setDocumentAge(long timeMillis) { + public void setDocumentAge(long timeMillis) { mDocAge = timeMillis; } @@ -415,14 +411,10 @@ public class CtsTestServer { private HttpResponse getResponse(HttpRequest request) throws InterruptedException, IOException { RequestLine requestLine = request.getRequestLine(); HttpResponse response = null; + mRequestCount += 1; Log.i(TAG, requestLine.getMethod() + ": " + requestLine.getUri()); String uriString = requestLine.getUri(); - - synchronized (this) { - mRequestCount += 1; - mLastQuery = uriString; - } - + mLastQuery = uriString; URI uri = URI.create(uriString); String path = uri.getPath(); String query = uri.getQuery(); @@ -440,12 +432,14 @@ public class CtsTestServer { if (path.startsWith(AUTH_PREFIX)) { // authentication required Header[] auth = request.getHeaders("Authorization"); - if ((auth.length > 0 && auth[0].getValue().equals(AUTH_CREDENTIALS)) - // This is a hack to make sure that loads to this url's will always - // ask for authentication. This is what the test expects. - && !path.endsWith("embedded_image.html")) { - // fall through and serve content - path = path.substring(AUTH_PREFIX.length()); + if (auth.length > 0) { + if (auth[0].getValue().equals(AUTH_CREDENTIALS)) { + // fall through and serve content + path = path.substring(AUTH_PREFIX.length()); + } else { + // incorrect password + response = createResponse(HttpStatus.SC_FORBIDDEN); + } } else { // request authorization response = createResponse(HttpStatus.SC_UNAUTHORIZED); @@ -591,17 +585,15 @@ public class CtsTestServer { private void setDateHeaders(HttpResponse response) { long time = System.currentTimeMillis(); - synchronized (this) { - if (mDocValidity != 0) { - String expires = DateUtils.formatDate(new Date(time + mDocValidity), - DateUtils.PATTERN_RFC1123); - response.addHeader("Expires", expires); - } - if (mDocAge != 0) { - String modified = DateUtils.formatDate(new Date(time - mDocAge), - DateUtils.PATTERN_RFC1123); - response.addHeader("Last-Modified", modified); - } + if (mDocValidity != 0) { + String expires = + DateUtils.formatDate(new Date(time + mDocValidity), DateUtils.PATTERN_RFC1123); + response.addHeader("Expires", expires); + } + if (mDocAge != 0) { + String modified = + DateUtils.formatDate(new Date(time - mDocAge), DateUtils.PATTERN_RFC1123); + response.addHeader("Last-Modified", modified); } response.addHeader("Date", DateUtils.formatDate(new Date(), DateUtils.PATTERN_RFC1123)); } @@ -609,7 +601,7 @@ public class CtsTestServer { /** * Create an empty response with the given status. */ - private static HttpResponse createResponse(int status) { + private HttpResponse createResponse(int status) { HttpResponse response = new BasicHttpResponse(HttpVersion.HTTP_1_0, status, null); // Fill in error reason. Avoid use of the ReasonPhraseCatalog, which is Locale-dependent. @@ -628,7 +620,7 @@ public class CtsTestServer { /** * Create a string entity for the given content. */ - private static StringEntity createEntity(String content) { + private StringEntity createEntity(String content) { try { StringEntity entity = new StringEntity(content); entity.setContentType("text/html"); @@ -639,7 +631,7 @@ public class CtsTestServer { return null; } - private static HttpResponse createTestDownloadResponse(Uri uri) throws IOException { + private HttpResponse createTestDownloadResponse(Uri uri) throws IOException { String downloadId = uri.getQueryParameter(DOWNLOAD_ID_PARAMETER); int numBytes = uri.getQueryParameter(NUM_BYTES_PARAMETER) != null ? Integer.parseInt(uri.getQueryParameter(NUM_BYTES_PARAMETER)) @@ -650,21 +642,16 @@ public class CtsTestServer { return response; } - private static FileEntity createFileEntity(String downloadId, int numBytes) throws IOException { + private FileEntity createFileEntity(String downloadId, int numBytes) throws IOException { String storageState = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equalsIgnoreCase(storageState)) { File storageDir = Environment.getExternalStorageDirectory(); File file = new File(storageDir, downloadId + ".bin"); BufferedOutputStream stream = new BufferedOutputStream(new FileOutputStream(file)); - byte data[] = new byte[1024]; - for (int i = 0; i < data.length; i++) { - data[i] = 1; - } try { - for (int i = 0; i < numBytes / data.length; i++) { - stream.write(data); + for (int i = 0; i < numBytes; i++) { + stream.write(1); } - stream.write(data, 0, numBytes % data.length); stream.flush(); } finally { stream.close(); @@ -681,7 +668,6 @@ public class CtsTestServer { private boolean mIsSsl; private boolean mIsCancelled; private SSLContext mSslContext; - private ExecutorService mExecutorService = Executors.newFixedThreadPool(20); /** * Defines the keystore contents for the server, BKS version. Holds just a @@ -763,13 +749,12 @@ public class CtsTestServer { } public void run() { + HttpParams params = new BasicHttpParams(); + params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0); while (!mIsCancelled) { try { Socket socket = mSocket.accept(); - DefaultHttpServerConnection conn = new DefaultHttpServerConnection(); - HttpParams params = new BasicHttpParams(); - params.setParameter(CoreProtocolPNames.PROTOCOL_VERSION, HttpVersion.HTTP_1_0); conn.bind(socket, params); // Determine whether we need to shutdown early before @@ -779,12 +764,19 @@ public class CtsTestServer { if (isShutdownRequest(request)) { mIsCancelled = true; } - mExecutorService.submit(new HandleResponseTask(conn, request)); + + HttpResponse response = mServer.getResponse(request); + conn.sendResponseHeader(response); + conn.sendResponseEntity(response); + conn.close(); + } catch (IOException e) { // normal during shutdown, ignore Log.w(TAG, e); } catch (HttpException e) { Log.w(TAG, e); + } catch (InterruptedException e) { + Log.w(TAG, e); } catch (UnsupportedOperationException e) { // DefaultHttpServerConnection's close() throws an // UnsupportedOperationException. @@ -792,44 +784,18 @@ public class CtsTestServer { } } try { - mExecutorService.shutdown(); - mExecutorService.awaitTermination(1L, TimeUnit.MINUTES); mSocket.close(); } catch (IOException ignored) { // safe to ignore - } catch (InterruptedException e) { - Log.e(TAG, "Shutting down threads", e); } } - private static boolean isShutdownRequest(HttpRequest request) { + private boolean isShutdownRequest(HttpRequest request) { RequestLine requestLine = request.getRequestLine(); String uriString = requestLine.getUri(); URI uri = URI.create(uriString); String path = uri.getPath(); return path.equals(SHUTDOWN_PREFIX); } - - private class HandleResponseTask implements Callable { - - private DefaultHttpServerConnection mConnection; - - private HttpRequest mRequest; - - public HandleResponseTask(DefaultHttpServerConnection connection, - HttpRequest request) { - this.mConnection = connection; - this.mRequest = request; - } - - @Override - public Void call() throws IOException, InterruptedException, HttpException { - HttpResponse response = mServer.getResponse(mRequest); - mConnection.sendResponseHeader(response); - mConnection.sendResponseEntity(response); - mConnection.close(); - return null; - } - } } } diff --git a/tests/src/android/widget/cts/MockTextView.java b/tests/src/android/widget/cts/MockTextView.java deleted file mode 100644 index 138338c..0000000 --- a/tests/src/android/widget/cts/MockTextView.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * 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 android.widget.cts; - -import android.content.Context; -import android.graphics.Canvas; -import android.graphics.Rect; -import android.graphics.drawable.Drawable; -import android.os.Bundle; -import android.text.method.MovementMethod; -import android.util.AttributeSet; -import android.view.ContextMenu; -import android.view.KeyEvent; -import android.widget.TextView; - -public class MockTextView extends TextView { - private boolean mHasCalledOnCreateContextMenu; - private boolean mHasCalledOnFocusChanged; - private boolean mHasCalledOnMeasure; - private boolean mHasCalledOnTextChanged; - private boolean mHasCalledDrawableStateChanged; - private boolean mHasCalledOnWindowFocusChanged; - private boolean mHasCalledOnPrivateIMECommand; - private boolean mHasCalledOnKeyMultiple; - - public MockTextView(Context context) { - super(context); - } - - public MockTextView(Context context, AttributeSet attrs) { - super(context, attrs); - } - - public MockTextView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); - } - - public boolean hasCalledOnWindowFocusChanged() { - return mHasCalledOnWindowFocusChanged; - } - - public boolean hasCalledOnCreateContextMenu() { - return mHasCalledOnCreateContextMenu; - } - - public boolean hasCalledDrawableStateChanged() { - return mHasCalledDrawableStateChanged; - } - - public boolean hasCalledOnFocusChanged() { - return mHasCalledOnFocusChanged; - } - - public boolean hasCalledOnMeasure() { - return mHasCalledOnMeasure; - } - - public boolean hasCalledOnTextChanged() { - return mHasCalledOnTextChanged; - } - - public boolean hasCalledOnPrivateIMECommand() { - return mHasCalledOnPrivateIMECommand; - } - - public boolean hasCalledOnKeyMultiple(){ - return mHasCalledOnKeyMultiple; - } - - public void reset() { - mHasCalledOnWindowFocusChanged = false; - mHasCalledDrawableStateChanged = false; - mHasCalledOnCreateContextMenu = false; - mHasCalledOnFocusChanged = false; - mHasCalledOnMeasure = false; - mHasCalledOnTextChanged = false; - mHasCalledOnPrivateIMECommand = false; - mHasCalledOnKeyMultiple = false; - } - - public int computeHorizontalScrollRange() { - return super.computeHorizontalScrollRange(); - } - - public int computeVerticalScrollRange() { - return super.computeVerticalScrollRange(); - } - - @Override - protected void drawableStateChanged() { - super.drawableStateChanged(); - mHasCalledDrawableStateChanged = true; - } - - public boolean getDefaultEditable() { - return super.getDefaultEditable(); - } - - public MovementMethod getDefaultMovementMethod() { - return super.getDefaultMovementMethod(); - } - - @Override - protected void onCreateContextMenu(ContextMenu menu) { - super.onCreateContextMenu(menu); - mHasCalledOnCreateContextMenu = true; - } - - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - } - - @Override - protected void onDraw(Canvas canvas) { - super.onDraw(canvas); - } - - @Override - protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) { - super.onFocusChanged(focused, direction, previouslyFocusedRect); - mHasCalledOnFocusChanged = true; - } - - @Override - public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) { - mHasCalledOnKeyMultiple = true; - return super.onKeyMultiple(keyCode, repeatCount, event); - } - - @Override - protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { - super.onMeasure(widthMeasureSpec, heightMeasureSpec); - mHasCalledOnMeasure = true; - } - - @Override - protected void onTextChanged(CharSequence text, int start, int before, int after) { - super.onTextChanged(text, start, before, after); - mHasCalledOnTextChanged = true; - } - - public boolean setFrame(int l, int t, int r, int b) { - return super.setFrame(l, t, r, b); - } - - @Override - public void onWindowFocusChanged(boolean hasWindowFocus) { - super.onWindowFocusChanged(hasWindowFocus); - mHasCalledOnWindowFocusChanged = true; - } - - public float getLeftFadingEdgeStrength() { - return super.getLeftFadingEdgeStrength(); - } - - public float getRightFadingEdgeStrength() { - return super.getRightFadingEdgeStrength(); - } - - @Override - public boolean onPrivateIMECommand(String action, Bundle data) { - mHasCalledOnPrivateIMECommand = true; - return super.onPrivateIMECommand(action, data); - } - - public int getFrameLeft() { - return mLeft; - } - - public int getFrameTop() { - return mTop; - } - - public int getFrameRight() { - return mRight; - } - - public int getFrameBottom() { - return mBottom; - } - - public int getBottomPaddingOffset() { - return super.getBottomPaddingOffset(); - } - - public int getLeftPaddingOffset() { - return super.getLeftPaddingOffset(); - } - - public int getRightPaddingOffset() { - return super.getRightPaddingOffset(); - } - - public int getTopPaddingOffset() { - return super.getTopPaddingOffset(); - } - - public boolean isPaddingOffsetRequired() { - return super.isPaddingOffsetRequired(); - } - - public boolean verifyDrawable(Drawable who) { - return super.verifyDrawable(who); - } - - public int computeVerticalScrollExtent() { - return super.computeVerticalScrollExtent(); - } -} diff --git a/tests/tests/acceleration/Android.mk b/tests/tests/acceleration/Android.mk deleted file mode 100644 index 3e2acac..0000000 --- a/tests/tests/acceleration/Android.mk +++ /dev/null @@ -1,33 +0,0 @@ -# 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. - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := optional - -LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) - -LOCAL_JAVA_LIBRARIES := android.test.runner - -LOCAL_SRC_FILES := $(call all-java-files-under, src) - -LOCAL_PACKAGE_NAME := CtsAccelerationTestCases - -LOCAL_INSTRUMENTATION_FOR := CtsAccelerationTestStubs - -LOCAL_SDK_VERSION := current - -include $(BUILD_PACKAGE) diff --git a/tests/tests/acceleration/AndroidManifest.xml b/tests/tests/acceleration/AndroidManifest.xml deleted file mode 100644 index 8a2f955..0000000 --- a/tests/tests/acceleration/AndroidManifest.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - diff --git a/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java deleted file mode 100644 index d2f1d9f..0000000 --- a/tests/tests/acceleration/src/android/acceleration/cts/BaseAccelerationTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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 android.acceleration.cts; - -import android.app.ActivityManager; -import android.content.Context; -import android.content.pm.ConfigurationInfo; -import android.content.pm.FeatureInfo; -import android.test.ActivityInstrumentationTestCase2; -import android.view.View; - -abstract class BaseAccelerationTest - extends ActivityInstrumentationTestCase2 { - - protected B mActivity; - - /** View with android:layerType="hardware" set */ - protected AcceleratedView mHardwareView; - - /** View with android:layerType="software" set */ - protected AcceleratedView mSoftwareView; - - /** View with setLayerType(HARDWARE) called */ - protected AcceleratedView mManualHardwareView; - - /** View with setLayerType(SOFTWARE) called */ - protected AcceleratedView mManualSoftwareView; - - BaseAccelerationTest(Class clazz) { - super(clazz); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - mActivity = getActivity(); - mHardwareView = mActivity.getHardwareAcceleratedView(); - mSoftwareView = mActivity.getSoftwareAcceleratedView(); - mManualHardwareView = mActivity.getManualHardwareAcceleratedView(); - mManualSoftwareView = mActivity.getManualSoftwareAcceleratedView(); - } - - public void testNotAttachedView() { - // Views that are not attached can't be attached to an accelerated window. - View view = new View(mActivity); - assertFalse(view.isHardwareAccelerated()); - } - - protected static int getGlEsVersion(Context context) { - ActivityManager activityManager = - (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); - ConfigurationInfo configInfo = activityManager.getDeviceConfigurationInfo(); - if (configInfo.reqGlEsVersion != ConfigurationInfo.GL_ES_VERSION_UNDEFINED) { - return getMajorVersion(configInfo.reqGlEsVersion); - } else { - return 1; // Lack of property means OpenGL ES version 1 - } - } - - /** @see FeatureInfo#getGlEsVersion() */ - private static int getMajorVersion(int glEsVersion) { - return ((glEsVersion & 0xffff0000) >> 16); - } -} diff --git a/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java deleted file mode 100644 index eddd34f..0000000 --- a/tests/tests/acceleration/src/android/acceleration/cts/HardwareAccelerationTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 android.acceleration.cts; - -/** - * Test that uses an Activity with hardware acceleration enabled. - */ -public class HardwareAccelerationTest - extends BaseAccelerationTest { - - public HardwareAccelerationTest() { - super(HardwareAcceleratedActivity.class); - } - - public void testIsHardwareAccelerated() { - // Hardware acceleration should be available on devices with GL ES 2 or higher... - if (getGlEsVersion(mActivity) >= 2) { - // Both of the views are attached to a hardware accelerated window - assertTrue(mHardwareView.isHardwareAccelerated()); - assertTrue(mSoftwareView.isHardwareAccelerated()); - assertTrue(mManualHardwareView.isHardwareAccelerated()); - assertTrue(mManualSoftwareView.isHardwareAccelerated()); - - assertTrue(mHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mSoftwareView.isCanvasHardwareAccelerated()); - assertTrue(mManualHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated()); - } else { - assertFalse(mHardwareView.isHardwareAccelerated()); - assertFalse(mSoftwareView.isHardwareAccelerated()); - assertFalse(mManualHardwareView.isHardwareAccelerated()); - assertFalse(mManualSoftwareView.isHardwareAccelerated()); - - assertFalse(mHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mSoftwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated()); - } - } -} diff --git a/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java deleted file mode 100644 index 146fa6a..0000000 --- a/tests/tests/acceleration/src/android/acceleration/cts/SoftwareAccelerationTest.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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 android.acceleration.cts; - -/** - * Test that uses an Activity with hardware acceleration explicitly disabled - * and makes sure that all views are rendered using software acceleration. - */ -public class SoftwareAccelerationTest - extends BaseAccelerationTest { - - public SoftwareAccelerationTest() { - super(SoftwareAcceleratedActivity.class); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - mActivity = getActivity(); - } - - public void testIsHardwareAccelerated() { - // Both of the views are not attached to a hardware accelerated window - assertFalse(mHardwareView.isHardwareAccelerated()); - assertFalse(mSoftwareView.isHardwareAccelerated()); - assertFalse(mManualHardwareView.isHardwareAccelerated()); - assertFalse(mManualSoftwareView.isHardwareAccelerated()); - - assertFalse(mHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mSoftwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated()); - } -} diff --git a/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java b/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java deleted file mode 100644 index bfbbe63..0000000 --- a/tests/tests/acceleration/src/android/acceleration/cts/WindowFlagHardwareAccelerationTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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 android.acceleration.cts; - -/** - * Test that uses an Activity with hardware acceleration enabled. - */ -public class WindowFlagHardwareAccelerationTest - extends BaseAccelerationTest { - - public WindowFlagHardwareAccelerationTest() { - super(WindowFlagHardwareAcceleratedActivity.class); - } - - public void testIsHardwareAccelerated() { - // Hardware acceleration should be available on devices with GL ES 2 or higher... - if (getGlEsVersion(mActivity) >= 2) { - // Both of the views are attached to a hardware accelerated window - assertTrue(mHardwareView.isHardwareAccelerated()); - assertTrue(mSoftwareView.isHardwareAccelerated()); - assertTrue(mManualHardwareView.isHardwareAccelerated()); - assertTrue(mManualSoftwareView.isHardwareAccelerated()); - - assertTrue(mHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mSoftwareView.isCanvasHardwareAccelerated()); - assertTrue(mManualHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated()); - } else { - assertFalse(mHardwareView.isHardwareAccelerated()); - assertFalse(mSoftwareView.isHardwareAccelerated()); - assertFalse(mManualHardwareView.isHardwareAccelerated()); - assertFalse(mManualSoftwareView.isHardwareAccelerated()); - - assertFalse(mHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mSoftwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualHardwareView.isCanvasHardwareAccelerated()); - assertFalse(mManualSoftwareView.isCanvasHardwareAccelerated()); - } - } -} diff --git a/tests/tests/accessibilityservice/Android.mk b/tests/tests/accessibilityservice/Android.mk index 71b7537..401f7a4 100644 --- a/tests/tests/accessibilityservice/Android.mk +++ b/tests/tests/accessibilityservice/Android.mk @@ -22,9 +22,7 @@ LOCAL_MODULE_PATH := $(TARGET_OUT_DATA_APPS) LOCAL_JAVA_LIBRARIES := android.test.runner -# TODO: include the core runner source as a library instead -LOCAL_SRC_FILES := $(call all-java-files-under, src)\ - $(call all-java-files-under, ../../core/runner/src) +LOCAL_SRC_FILES := $(call all-java-files-under, src) LOCAL_SRC_FILES += \ src/android/accessibilityservice/IAccessibilityServiceDelegate.aidl \ @@ -32,6 +30,6 @@ LOCAL_SRC_FILES += \ LOCAL_PACKAGE_NAME := CtsAccessibilityServiceTestCases -#LOCAL_SDK_VERSION := current +LOCAL_SDK_VERSION := current include $(BUILD_PACKAGE) diff --git a/tests/tests/accessibilityservice/AndroidManifest.xml b/tests/tests/accessibilityservice/AndroidManifest.xml index ddf38c7..811c87f 100644 --- a/tests/tests/accessibilityservice/AndroidManifest.xml +++ b/tests/tests/accessibilityservice/AndroidManifest.xml @@ -19,21 +19,16 @@ - - - + - - + android:name="android.accessibilityservice.cts.AccessibilityEndToEndTestActivity"/> - diff --git a/tests/tests/accessibilityservice/res/layout/query_window_test.xml b/tests/tests/accessibilityservice/res/layout/query_window_test.xml deleted file mode 100644 index 4b32eb1..0000000 --- a/tests/tests/accessibilityservice/res/layout/query_window_test.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - -