Home | History | Annotate | Download | only in graphics
      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;
     18 
     19 import junit.framework.TestCase;
     20 
     21 /**
     22  *
     23  */
     24 public class Matrix_DelegateTest extends TestCase {
     25 
     26     @Override
     27     protected void setUp() throws Exception {
     28         super.setUp();
     29     }
     30 
     31     @Override
     32     protected void tearDown() throws Exception {
     33         super.tearDown();
     34     }
     35 
     36     public void testIdentity() {
     37         Matrix m1 = new Matrix();
     38 
     39         assertTrue(m1.isIdentity());
     40 
     41         m1.setValues(new float[] { 1,0,0, 0,1,0, 0,0,1 });
     42         assertTrue(m1.isIdentity());
     43     }
     44 
     45     public void testCopyConstructor() {
     46         Matrix m1 = new Matrix();
     47         Matrix m2 = new Matrix(m1);
     48 
     49         float[] v1 = new float[9];
     50         float[] v2 = new float[9];
     51         m1.getValues(v1);
     52         m2.getValues(v2);
     53 
     54         for (int i = 0 ; i < 9; i++) {
     55             assertEquals(v1[i], v2[i]);
     56         }
     57     }
     58 }
     59