diff options
author | Paul Duffin <paulduffin@google.com> | 2017-02-20 13:03:59 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-02-20 13:03:59 +0000 |
commit | 14fd9cebe9903a0199e724bd32977f50ca6d6a6f (patch) | |
tree | 8af8610bedd5c5f244840491b2001cbac0a3cf70 | |
parent | 02737595cbd5c07f33f48f9be1bd7091752b1aa4 (diff) | |
parent | 1f2955ad0deb698974b33ca2390c2d4847e078d0 (diff) |
Merge "Avoid using JUnit code in production WallpaperCropper" am: 9598c98db0 am: e4add524e9
am: 1f2955ad0d
Change-Id: I0921dc15784c2aff6b1b1c4ce33fe8aed0eaba98
3 files changed, 12 insertions, 10 deletions
diff --git a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java index 100b0b3b9c1f..e708d53e556c 100644 --- a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java +++ b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/BitmapTexture.java @@ -18,8 +18,6 @@ package com.android.gallery3d.glrenderer; import android.graphics.Bitmap; -import junit.framework.Assert; - // BitmapTexture is a texture whose content is specified by a fixed Bitmap. // // The texture does not own the Bitmap. The user should make sure the Bitmap @@ -34,7 +32,9 @@ public class BitmapTexture extends UploadedTexture { public BitmapTexture(Bitmap bitmap, boolean hasBorder) { super(hasBorder); - Assert.assertTrue(bitmap != null && !bitmap.isRecycled()); + if (bitmap == null || bitmap.isRecycled()) { + throw new AssertionError(); + } mContentBitmap = bitmap; } diff --git a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java index 16b220690ef4..358b2dc36693 100644 --- a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java +++ b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/GLPaint.java @@ -16,8 +16,6 @@ package com.android.gallery3d.glrenderer; -import junit.framework.Assert; - public class GLPaint { private float mLineWidth = 1f; private int mColor = 0; @@ -31,7 +29,9 @@ public class GLPaint { } public void setLineWidth(float width) { - Assert.assertTrue(width >= 0); + if (width < 0) { + throw new AssertionError(); + } mLineWidth = width; } diff --git a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java index f41a979b7ddd..2e878791e7fe 100644 --- a/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java +++ b/packages/WallpaperCropper/src/com/android/gallery3d/glrenderer/UploadedTexture.java @@ -20,8 +20,6 @@ import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.opengl.GLUtils; -import junit.framework.Assert; - import java.util.HashMap; import javax.microedition.khronos.opengles.GL11; @@ -144,7 +142,9 @@ public abstract class UploadedTexture extends BasicTexture { } private void freeBitmap() { - Assert.assertTrue(mBitmap != null); + if (mBitmap == null) { + throw new AssertionError(); + } onFreeBitmap(mBitmap); mBitmap = null; } @@ -219,7 +219,9 @@ public abstract class UploadedTexture extends BasicTexture { int texWidth = getTextureWidth(); int texHeight = getTextureHeight(); - Assert.assertTrue(bWidth <= texWidth && bHeight <= texHeight); + if (bWidth > texWidth || bHeight > texHeight) { + throw new AssertionError(); + } // Upload the bitmap to a new texture. mId = canvas.getGLId().generateTexture(); |