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 package android.graphics.cts; 17 18 import static org.junit.Assert.assertEquals; 19 20 import android.graphics.Canvas; 21 import android.graphics.Canvas.EdgeType; 22 import android.graphics.Path; 23 import android.graphics.RectF; 24 import android.support.test.filters.SmallTest; 25 import android.support.test.runner.AndroidJUnit4; 26 27 import org.junit.Test; 28 import org.junit.runner.RunWith; 29 30 @SmallTest 31 @RunWith(AndroidJUnit4.class) 32 public class Canvas_EdgeTypeTest { 33 @Test 34 public void testValueOf(){ 35 assertEquals(EdgeType.BW, EdgeType.valueOf("BW")); 36 assertEquals(EdgeType.AA, EdgeType.valueOf("AA")); 37 } 38 39 @Test 40 public void testValues(){ 41 EdgeType[] edgeType = EdgeType.values(); 42 43 assertEquals(2, edgeType.length); 44 assertEquals(EdgeType.BW, edgeType[0]); 45 assertEquals(EdgeType.AA, edgeType[1]); 46 47 Canvas c = new Canvas(); 48 49 //EdgeType is used as a argument here for all the methods that use it 50 c.quickReject(new Path(), EdgeType.AA); 51 c.quickReject(new Path(), EdgeType.BW); 52 c.quickReject(new RectF(), EdgeType.AA); 53 c.quickReject(new RectF(), EdgeType.BW); 54 c.quickReject(10, 100, 100, 10, EdgeType.AA); 55 c.quickReject(10, 100, 100, 10, EdgeType.BW); 56 } 57 } 58