]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/testcases/org/simantics/databoard/tests/TestMultiDimension.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.databoard / testcases / org / simantics / databoard / tests / TestMultiDimension.java
1 /*******************************************************************************\r
2  *  Copyright (c) 2010 Association for Decentralized Information Management in\r
3  *  Industry THTH ry.\r
4  *  All rights reserved. This program and the accompanying materials\r
5  *  are made available under the terms of the Eclipse Public License v1.0\r
6  *  which accompanies this distribution, and is available at\r
7  *  http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  *  Contributors:\r
10  *      VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.databoard.tests;
13
14 import junit.framework.TestCase;\r
15 \r
16 import org.simantics.databoard.Datatypes;\r
17 import org.simantics.databoard.annotations.Length;\r
18 import org.simantics.databoard.type.ArrayType;\r
19 import org.simantics.databoard.type.Datatype;\r
20 import org.simantics.databoard.type.RecordType;\r
21 import org.simantics.databoard.util.Range;\r
22
23 public class TestMultiDimension extends TestCase {
24         
25         public static class Image {
26
27                 public Image() {}
28                 
29                 public @Length({"320", "240"}) RGB[][] pixels;
30                 
31         }
32         
33         public static class RGB {
34                 
35                 int r;
36                 int g;
37                 int b;
38                 
39         }       
40         
41         public void testMultiDim() {
42         Datatype dt = Datatypes.getDatatypeUnchecked( Image.class );
43         RecordType rt = (RecordType) dt;
44         ArrayType at = (ArrayType) rt.getComponentType(0);
45         assertEquals(at.getLength(), Range.create(320));
46         ArrayType at2 = (ArrayType) at.componentType;
47         assertEquals(at2.getLength(), Range.create(240));
48          
49         }
50         
51 }
52