1 /* 2 * Copyright (C) 2008 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.graphics.cts; 18 19 import android.graphics.Bitmap; 20 import android.graphics.BitmapShader; 21 import android.graphics.Matrix; 22 import android.graphics.Shader; 23 import android.test.AndroidTestCase; 24 25 public class ShaderTest extends AndroidTestCase { 26 public void testConstructor() { 27 new Shader(); 28 } 29 30 public void testAccessLocalMatrix() { 31 int width = 80; 32 int height = 120; 33 int[] color = new int[width * height]; 34 Bitmap bitmap = Bitmap.createBitmap(color, width, height, Bitmap.Config.RGB_565); 35 36 Shader shader = new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT); 37 Matrix m = new Matrix(); 38 39 shader.setLocalMatrix(m); 40 assertFalse(shader.getLocalMatrix(m)); 41 42 shader.setLocalMatrix(null); 43 assertFalse(shader.getLocalMatrix(m)); 44 } 45 } 46