aboutsummaryrefslogtreecommitdiffstats
path: root/layoutlib_api/tests
diff options
context:
space:
mode:
Diffstat (limited to 'layoutlib_api/tests')
-rw-r--r--layoutlib_api/tests/.classpath9
-rw-r--r--layoutlib_api/tests/.project17
-rw-r--r--layoutlib_api/tests/Android.mk27
-rw-r--r--layoutlib_api/tests/src/com/android/resources/FolderTypeRelationShipTest.java44
4 files changed, 97 insertions, 0 deletions
diff --git a/layoutlib_api/tests/.classpath b/layoutlib_api/tests/.classpath
new file mode 100644
index 0000000..15b6472
--- /dev/null
+++ b/layoutlib_api/tests/.classpath
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/common"/>
+ <classpathentry kind="var" path="ANDROID_SRC/prebuilts/tools/common/guava-tools/guava-10.0.1.jar" sourcepath="/ANDROID_SRC/prebuilts/tools/common/guava-tools/src.zip"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/layoutlib_api/tests/.project b/layoutlib_api/tests/.project
new file mode 100644
index 0000000..9f550a3
--- /dev/null
+++ b/layoutlib_api/tests/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>common-tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/layoutlib_api/tests/Android.mk b/layoutlib_api/tests/Android.mk
new file mode 100644
index 0000000..10e75e8
--- /dev/null
+++ b/layoutlib_api/tests/Android.mk
@@ -0,0 +1,27 @@
+# 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)
+
+# Only compile source java files in this lib.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_MODULE := common-tests
+LOCAL_MODULE_TAGS := optional
+
+LOCAL_JAVA_LIBRARIES := common junit
+
+include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/layoutlib_api/tests/src/com/android/resources/FolderTypeRelationShipTest.java b/layoutlib_api/tests/src/com/android/resources/FolderTypeRelationShipTest.java
new file mode 100644
index 0000000..809eae7
--- /dev/null
+++ b/layoutlib_api/tests/src/com/android/resources/FolderTypeRelationShipTest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.resources;
+
+import com.android.resources.FolderTypeRelationship;
+import com.android.resources.ResourceFolderType;
+import com.android.resources.ResourceType;
+
+import junit.framework.TestCase;
+
+public class FolderTypeRelationShipTest extends TestCase {
+
+ public void testResourceType() {
+ // all resource type should be in the FolderTypeRelationShip map.
+ // loop on all the enum, and make sure there's at least one folder type for it.
+ for (ResourceType type : ResourceType.values()) {
+ assertTrue(type.getDisplayName(),
+ FolderTypeRelationship.getRelatedFolders(type).size() > 0);
+ }
+ }
+
+ public void testResourceFolderType() {
+ // all resource folder type should generate at least one type of resource.
+ // loop on all the enum, and make sure there's at least one res type for it.
+ for (ResourceFolderType type : ResourceFolderType.values()) {
+ assertTrue(type.getName(),
+ FolderTypeRelationship.getRelatedResourceTypes(type).size() > 0);
+ }
+ }
+}