Merge "Merge 1911a6f7 into gingerbread. do not merge." into gingerbread

This commit is contained in:
Xavier Ducrohet
2011-02-28 12:24:01 -08:00
committed by Android (Google) Code Review
12 changed files with 67 additions and 66 deletions

View File

@ -1,2 +1 @@
bridge/bin bin
create/bin

View File

@ -1,9 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry excluding="org/kxml2/io/" kind="src" path="src"/> <classpathentry excluding="org/kxml2/io/" kind="src" path="src"/>
<classpathentry kind="src" path="tests"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/layoutlib_api/layoutlib_api-prebuilt.jar"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/layoutlib_api/layoutlib_api-prebuilt.jar"/>
<classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_PLAT_SRC/dalvik/libcore/xml/src/main/java"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_PLAT_SRC/dalvik/libcore/xml/src/main/java"/>
<classpathentry kind="var" path="ANDROID_PLAT_SRC/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar" sourcepath="/ANDROID_PLAT_SRC/frameworks/base"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar" sourcepath="/ANDROID_PLAT_SRC/frameworks/base"/>

View File

@ -33,3 +33,6 @@ LOCAL_MODULE := layoutlib
include $(BUILD_HOST_JAVA_LIBRARY) include $(BUILD_HOST_JAVA_LIBRARY)
# Build all sub-directories
include $(call all-makefiles-under,$(LOCAL_PATH))

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/layoutlib_bridge"/>
<classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_PLAT_SRC/dalvik/libcore/xml/src/main/java"/>
<classpathentry kind="var" path="ANDROID_PLAT_SRC/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar" sourcepath="/ANDROID_PLAT_SRC/frameworks/base"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>layoutlib_bridge-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>

View File

@ -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))

View File

@ -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());
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

View File

@ -14,17 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package com.android.layoutlib.bridge; package android.graphics;
import android.graphics.Matrix;
import android.text.TextPaint;
import junit.framework.TestCase; import junit.framework.TestCase;
/** /**
* *
*/ */
public class AndroidGraphicsTests extends TestCase { public class Matrix_DelegateTest extends TestCase {
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
@ -36,14 +33,17 @@ public class AndroidGraphicsTests extends TestCase {
super.tearDown(); super.tearDown();
} }
public void testMatrix() { public void testIdentity() {
Matrix m1 = new Matrix(); Matrix m1 = new Matrix();
assertTrue(m1.isIdentity()); assertTrue(m1.isIdentity());
m1.setValues(new float[] { 1,0,0, 0,1,0, 0,0,1 }); m1.setValues(new float[] { 1,0,0, 0,1,0, 0,0,1 });
assertTrue(m1.isIdentity()); assertTrue(m1.isIdentity());
}
public void testCopyConstructor() {
Matrix m1 = new Matrix();
Matrix m2 = new Matrix(m1); Matrix m2 = new Matrix(m1);
float[] v1 = new float[9]; float[] v1 = new float[9];
@ -55,9 +55,4 @@ public class AndroidGraphicsTests extends TestCase {
assertEquals(v1[i], v2[i]); assertEquals(v1[i], v2[i]);
} }
} }
public void textTextPaint() {
TextPaint p = new TextPaint();
assertNotNull(p);
}
} }