]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.databoard/testcases/org/simantics/databoard/tests/TestMultiDimension.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.databoard / testcases / org / simantics / databoard / tests / TestMultiDimension.java
1 /*******************************************************************************
2  *  Copyright (c) 2010 Association for Decentralized Information Management in
3  *  Industry THTH ry.
4  *  All rights reserved. This program and the accompanying materials
5  *  are made available under the terms of the Eclipse Public License v1.0
6  *  which accompanies this distribution, and is available at
7  *  http://www.eclipse.org/legal/epl-v10.html
8  *
9  *  Contributors:
10  *      VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package org.simantics.databoard.tests;
13
14 import junit.framework.TestCase;
15
16 import org.simantics.databoard.Datatypes;
17 import org.simantics.databoard.annotations.Length;
18 import org.simantics.databoard.type.ArrayType;
19 import org.simantics.databoard.type.Datatype;
20 import org.simantics.databoard.type.RecordType;
21 import org.simantics.databoard.util.Range;
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