diff options
author | Tor Norbye <tnorbye@google.com> | 2012-04-25 17:18:59 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-04-25 17:45:17 -0700 |
commit | 1d853f24d12b3a777879610781d53236e8c33c36 (patch) | |
tree | da3d9ded3203f9a5eb8d6aa8825c4ba30edf564f /eclipse | |
parent | 62fede062094b6c8a852b9a965927fd2f621b476 (diff) | |
download | sdk-1d853f24d12b3a777879610781d53236e8c33c36.zip sdk-1d853f24d12b3a777879610781d53236e8c33c36.tar.gz sdk-1d853f24d12b3a777879610781d53236e8c33c36.tar.bz2 |
Test fix: The image parameter is mandatory
Change-Id: I9b8ca8e0384f1cb2343d13e8e43b268c63ed4dcb
Diffstat (limited to 'eclipse')
2 files changed, 11 insertions, 9 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtils.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtils.java index e912f53..30a2e78 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtils.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtils.java @@ -22,6 +22,8 @@ import static com.android.ide.eclipse.adt.AdtConstants.DOT_JPG; import static com.android.ide.eclipse.adt.AdtConstants.DOT_PNG; import static com.android.ide.eclipse.adt.AdtUtils.endsWithIgnoreCase; +import com.android.annotations.NonNull; +import com.android.annotations.Nullable; import com.android.ide.common.api.Rect; import org.eclipse.swt.graphics.RGB; @@ -124,7 +126,10 @@ public class ImageUtils { * @return a cropped version of the source image, or null if the whole image was blank * and cropping completely removed everything */ - public static BufferedImage cropBlank(BufferedImage image, Rect initialCrop) { + @Nullable + public static BufferedImage cropBlank( + @NonNull BufferedImage image, + @Nullable Rect initialCrop) { return cropBlank(image, initialCrop, image.getType()); } @@ -167,8 +172,11 @@ public class ImageUtils { * @return a cropped version of the source image, or null if the whole image was blank * and cropping completely removed everything */ - public static BufferedImage cropColor(BufferedImage image, - final int blankArgb, Rect initialCrop) { + @Nullable + public static BufferedImage cropColor( + @NonNull BufferedImage image, + final int blankArgb, + @Nullable Rect initialCrop) { return cropColor(image, blankArgb, initialCrop, image.getType()); } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtilsTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtilsTest.java index 4bd0bba..9e9c734 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtilsTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ImageUtilsTest.java @@ -157,12 +157,6 @@ public class ImageUtilsTest extends TestCase { assertEquals(0xFFFF0000, crop.getRGB(49, 49)); } - public void testNullOk() throws Exception { - ImageUtils.cropBlank(null, null); - ImageUtils.cropColor(null, 0, null); - } - - public void testNothingTodo() throws Exception { BufferedImage image = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB_PRE); Graphics g = image.getGraphics(); |