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.Region.Op;
     22 import android.support.test.filters.SmallTest;
     23 import android.support.test.runner.AndroidJUnit4;
     24 
     25 import org.junit.Test;
     26 import org.junit.runner.RunWith;
     27 
     28 @SmallTest
     29 @RunWith(AndroidJUnit4.class)
     30 public class Region_OpTest {
     31     @Test
     32     public void testValueOf() {
     33         assertEquals(Op.DIFFERENCE, Op.valueOf("DIFFERENCE"));
     34         assertEquals(Op.INTERSECT, Op.valueOf("INTERSECT"));
     35         assertEquals(Op.UNION, Op.valueOf("UNION"));
     36         assertEquals(Op.XOR, Op.valueOf("XOR"));
     37         assertEquals(Op.REVERSE_DIFFERENCE, Op.valueOf("REVERSE_DIFFERENCE"));
     38         assertEquals(Op.REPLACE, Op.valueOf("REPLACE"));
     39         // Every Op element has been tested in testOp1(), testOp2(), testOp3(),
     40         // testOp4() and testOp5() in the {@link RegionTest}.
     41         // Every Op element indicates one operation type.
     42     }
     43 
     44     @Test
     45     public void testValues() {
     46         // set the expected value
     47         Op[] expected = {
     48                 Op.DIFFERENCE,
     49                 Op.INTERSECT,
     50                 Op.UNION,
     51                 Op.XOR,
     52                 Op.REVERSE_DIFFERENCE,
     53                 Op.REPLACE };
     54         Op[] actual = Op.values();
     55         assertEquals(expected.length, actual.length);
     56         assertEquals(expected[0], actual[0]);
     57         assertEquals(expected[1], actual[1]);
     58         assertEquals(expected[2], actual[2]);
     59         assertEquals(expected[3], actual[3]);
     60         assertEquals(expected[4], actual[4]);
     61         assertEquals(expected[5], actual[5]);
     62     }
     63 }
     64