diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2014-04-15 19:30:35 -0700 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2014-04-15 20:03:20 -0700 |
commit | bdd0ad79b9b027280bd371c7b6795b04ed89ac8f (patch) | |
tree | 26f1d1b10fec448c6a46ba2a7dfec7fc46d01bf2 /tools/layoutlib | |
parent | f1e7187645f0b0388f7b97d742395efd228b347a (diff) | |
download | frameworks_base-bdd0ad79b9b027280bd371c7b6795b04ed89ac8f.zip frameworks_base-bdd0ad79b9b027280bd371c7b6795b04ed89ac8f.tar.gz frameworks_base-bdd0ad79b9b027280bd371c7b6795b04ed89ac8f.tar.bz2 |
Layoutlib tests now check methods return value [DO NOT MERGE]
The change is a cherry-pick of relevant fixes from the following
commits on master branch:
the followning commits:
9be03c4e980d3058aeb3fd730da5f7d4a4a4f8a8 and
e05bb956ce429618fd4f971a9dc708b9313c59ea
Change-Id: I87cef323c4eaee4e9f60475f01156b276593fa50
Diffstat (limited to 'tools/layoutlib')
3 files changed, 15 insertions, 5 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java index 13d2ba1..f74e4d1 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Bitmap_Delegate.java @@ -518,7 +518,8 @@ public final class Bitmap_Delegate { } @LayoutlibDelegate - /*package*/ static void nativeSetHasAlpha(int nativeBitmap, boolean hasAlpha) { + /*package*/ static void nativeSetAlphaAndPremultiplied(int nativeBitmap, boolean hasAlpha, + boolean isPremul) { // get the delegate from the native int. Bitmap_Delegate delegate = sManager.getDelegate(nativeBitmap); if (delegate == null) { diff --git a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java index cb31b8f..57af6e9 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Region_Delegate.java @@ -275,21 +275,21 @@ public class Region_Delegate { } @LayoutlibDelegate - /*package*/ static boolean nativeSetRegion(int native_dst, int native_src) { + /*package*/ static void nativeSetRegion(int native_dst, int native_src) { Region_Delegate dstRegion = sManager.getDelegate(native_dst); if (dstRegion == null) { - return true; + return; } Region_Delegate srcRegion = sManager.getDelegate(native_src); if (srcRegion == null) { - return true; + return; } dstRegion.mArea.reset(); dstRegion.mArea.add(srcRegion.mArea); - return true; + return; } @LayoutlibDelegate diff --git a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/TestDelegates.java b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/TestDelegates.java index d3218db..7c0bc84 100644 --- a/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/TestDelegates.java +++ b/tools/layoutlib/bridge/tests/src/com/android/layoutlib/bridge/TestDelegates.java @@ -129,6 +129,15 @@ public class TestDelegates extends TestCase { originalClass.getName()), delegateMethod.getAnnotation(LayoutlibDelegate.class)); + // check the return type of the methods match. + assertTrue( + String.format("Delegate method %1$s.%2$s does not match the corresponding " + + "framework method which returns %3$s", + delegateClass.getName(), + getMethodName(delegateMethod), + originalMethod.getReturnType().getName()), + delegateMethod.getReturnType() == originalMethod.getReturnType()); + // check that the method is static assertTrue( String.format( |