jmonkeyengine/engine/test/com/jme/animation/CompactQuaternionArrayTest.java
nor..67 3cdaf0e051 jme3:
- fix imports in all classes

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8843 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
2011-12-03 14:06:48 +00:00

46 lines
1.5 KiB
Java

package com.jme.animation;
import com.jme3.animation.CompactQuaternionArray;
import com.jme3.math.Quaternion;
import java.util.Arrays;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
public class CompactQuaternionArrayTest {
@Before
public void setUp() throws Exception {
}
@Test
public void testCompactQuaternionArrayQuaternionArray() {
Quaternion[] objArray = new Quaternion[] {
new Quaternion(1, 0, 1, 1),
new Quaternion(1, 1, 1, 0),
new Quaternion(0, 1, 1, 0),
new Quaternion(1, 1, 1, 0),
new Quaternion(1, 0, 1, 1),
};
CompactQuaternionArray compact = new CompactQuaternionArray();
compact.add(objArray);
assertTrue(Arrays.equals(compact.getIndex(objArray), new int[] {0, 1, 2, 1, 0}));
assertTrue(Arrays.equals(compact.getSerializedData(), new float[] {1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0}));
}
@Test
public void testCompactQuaternionArrayDoubleArrayIntArray() {
int[] indexArray = new int[] {0, 1, 2, 1, 0};
float[] dataArray = new float[] {1, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0};
Quaternion[] objArray = new Quaternion[] {
new Quaternion(1, 0, 1, 1),
new Quaternion(1, 1, 1, 0),
new Quaternion(0, 1, 1, 0),
new Quaternion(1, 1, 1, 0),
new Quaternion(1, 0, 1, 1),
};
CompactQuaternionArray compact = new CompactQuaternionArray(dataArray, indexArray);
assertTrue(Arrays.deepEquals(compact.toObjectArray(), objArray));
}
}