diff --git a/tools/layoutlib/.gitignore b/tools/layoutlib/.gitignore index 0ec5000668c77..c5e82d74585d1 100644 --- a/tools/layoutlib/.gitignore +++ b/tools/layoutlib/.gitignore @@ -1,2 +1 @@ -bridge/bin -create/bin +bin \ No newline at end of file diff --git a/tools/layoutlib/bridge/.classpath b/tools/layoutlib/bridge/.classpath index 5cfda29ae2e98..9fb000e65653a 100644 --- a/tools/layoutlib/bridge/.classpath +++ b/tools/layoutlib/bridge/.classpath @@ -1,9 +1,7 @@ - - diff --git a/tools/layoutlib/bridge/Android.mk b/tools/layoutlib/bridge/Android.mk index 7e70f330b7d9d..687a91feeb6f5 100644 --- a/tools/layoutlib/bridge/Android.mk +++ b/tools/layoutlib/bridge/Android.mk @@ -33,3 +33,6 @@ LOCAL_MODULE := layoutlib include $(BUILD_HOST_JAVA_LIBRARY) +# Build all sub-directories +include $(call all-makefiles-under,$(LOCAL_PATH)) + diff --git a/tools/layoutlib/bridge/tests/.classpath b/tools/layoutlib/bridge/tests/.classpath new file mode 100644 index 0000000000000..9cc2433dd7ed0 --- /dev/null +++ b/tools/layoutlib/bridge/tests/.classpath @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/tools/layoutlib/bridge/tests/.project b/tools/layoutlib/bridge/tests/.project new file mode 100644 index 0000000000000..2325eed166277 --- /dev/null +++ b/tools/layoutlib/bridge/tests/.project @@ -0,0 +1,17 @@ + + + layoutlib_bridge-tests + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/tools/layoutlib/bridge/tests/Android.mk b/tools/layoutlib/bridge/tests/Android.mk new file mode 100644 index 0000000000000..e303638ae821c --- /dev/null +++ b/tools/layoutlib/bridge/tests/Android.mk @@ -0,0 +1,30 @@ +# 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 := layoutlib-tests +LOCAL_MODULE_TAGS := optional + +LOCAL_JAVA_LIBRARIES := layoutlib kxml2-2.3.0 junit + +include $(BUILD_HOST_JAVA_LIBRARY) + +# Build all sub-directories +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java b/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java deleted file mode 100644 index a3219e7a0ff6b..0000000000000 --- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/NinePatchTest.java +++ /dev/null @@ -1,51 +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 com.android.layoutlib.bridge; - -import com.android.ninepatch.NinePatch; - -import java.net.URL; - -import junit.framework.TestCase; - -public class NinePatchTest extends TestCase { - - private NinePatch mPatch; - - @Override - protected void setUp() throws Exception { - URL url = this.getClass().getClassLoader().getResource( - "com/android/layoutlib/testdata/button.9.png"); - - mPatch = NinePatch.load(url, false /* convert */); - } - - public void test9PatchLoad() throws Exception { - assertNotNull(mPatch); - } - - public void test9PatchMinSize() { - int[] padding = new int[4]; - mPatch.getPadding(padding); - assertEquals(13, padding[0]); - assertEquals(3, padding[1]); - assertEquals(13, padding[2]); - assertEquals(4, padding[3]); - assertEquals(36, mPatch.getWidth()); - assertEquals(25, mPatch.getHeight()); - } -} diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/testdata/button.9.png b/tools/layoutlib/bridge/tests/com/android/layoutlib/testdata/button.9.png deleted file mode 100644 index 9d52f40d00fd9..0000000000000 Binary files a/tools/layoutlib/bridge/tests/com/android/layoutlib/testdata/button.9.png and /dev/null differ diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/AndroidGraphicsTests.java b/tools/layoutlib/bridge/tests/src/android/graphics/Matrix_DelegateTest.java similarity index 81% rename from tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/AndroidGraphicsTests.java rename to tools/layoutlib/bridge/tests/src/android/graphics/Matrix_DelegateTest.java index ba3c51a6c6ac0..ec4edacca5eb7 100644 --- a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/AndroidGraphicsTests.java +++ b/tools/layoutlib/bridge/tests/src/android/graphics/Matrix_DelegateTest.java @@ -14,17 +14,14 @@ * limitations under the License. */ -package com.android.layoutlib.bridge; - -import android.graphics.Matrix; -import android.text.TextPaint; +package android.graphics; import junit.framework.TestCase; /** * */ -public class AndroidGraphicsTests extends TestCase { +public class Matrix_DelegateTest extends TestCase { @Override protected void setUp() throws Exception { @@ -36,14 +33,17 @@ public class AndroidGraphicsTests extends TestCase { super.tearDown(); } - public void testMatrix() { + public void testIdentity() { Matrix m1 = new Matrix(); assertTrue(m1.isIdentity()); m1.setValues(new float[] { 1,0,0, 0,1,0, 0,0,1 }); assertTrue(m1.isIdentity()); + } + public void testCopyConstructor() { + Matrix m1 = new Matrix(); Matrix m2 = new Matrix(m1); float[] v1 = new float[9]; @@ -55,9 +55,4 @@ public class AndroidGraphicsTests extends TestCase { assertEquals(v1[i], v2[i]); } } - - public void textTextPaint() { - TextPaint p = new TextPaint(); - assertNotNull(p); - } } diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/TestDelegates.java b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/TestDelegates.java similarity index 100% rename from tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/TestDelegates.java rename to tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/TestDelegates.java diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/android/BridgeXmlBlockParserTest.java b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParserTest.java similarity index 100% rename from tools/layoutlib/bridge/tests/com/android/layoutlib/bridge/android/BridgeXmlBlockParserTest.java rename to tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/android/BridgeXmlBlockParserTest.java diff --git a/tools/layoutlib/bridge/tests/com/android/layoutlib/testdata/layout1.xml b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/testdata/layout1.xml similarity index 100% rename from tools/layoutlib/bridge/tests/com/android/layoutlib/testdata/layout1.xml rename to tools/layoutlib/bridge/tests/src/com/android/layoutlib/testdata/layout1.xml