1 /*******************************************************************************
2 * Copyright (c) 2010 Association for Decentralized Information Management in
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
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.databoard.tests;
14 import junit.framework.TestCase;
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;
23 public class TestMultiDimension extends TestCase {
25 public static class Image {
29 public @Length({"320", "240"}) RGB[][] pixels;
33 public static class RGB {
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));