Home | History | Annotate | Download | only in cts
      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 static org.junit.Assert.assertEquals;
     20 
     21 import android.graphics.Paint;
     22 import android.graphics.Paint.Join;
     23 import android.support.test.filters.SmallTest;
     24 import android.support.test.runner.AndroidJUnit4;
     25 
     26 import org.junit.Test;
     27 import org.junit.runner.RunWith;
     28 
     29 @SmallTest
     30 @RunWith(AndroidJUnit4.class)
     31 public class Paint_JoinTest {
     32     @Test
     33     public void testValueOf() {
     34         assertEquals(Join.BEVEL, Join.valueOf("BEVEL"));
     35         assertEquals(Join.MITER, Join.valueOf("MITER"));
     36         assertEquals(Join.ROUND, Join.valueOf("ROUND"));
     37     }
     38 
     39     @Test
     40     public void testValues() {
     41         // set the actual value
     42         Join[] actual = Join.values();
     43 
     44         assertEquals(3, actual.length);
     45         assertEquals(Join.MITER, actual[0]);
     46         assertEquals(Join.ROUND, actual[1]);
     47         assertEquals(Join.BEVEL, actual[2]);
     48 
     49         // Here we use Join as the param of setStrokeJoin
     50         // and get the setting result by getStrokeJoin
     51         Paint p = new Paint();
     52         p.setStrokeJoin(actual[0]);
     53         assertEquals(Join.MITER, p.getStrokeJoin());
     54         p.setStrokeJoin(actual[1]);
     55         assertEquals(Join.ROUND, p.getStrokeJoin());
     56         p.setStrokeJoin(actual[2]);
     57         assertEquals(Join.BEVEL, p.getStrokeJoin());
     58     }
     59 }
     60