OSDN Git Service

ResourceBundleのフォールバック禁止
authorOlyutorskii <olyutorskii@users.osdn.me>
Thu, 11 Apr 2013 12:33:05 +0000 (21:33 +0900)
committerOlyutorskii <olyutorskii@users.osdn.me>
Thu, 11 Apr 2013 12:33:05 +0000 (21:33 +0900)
18 files changed:
CHANGELOG.txt
src/main/java/jp/sfjp/mikutoga/math/MkQuat.java
src/main/java/jp/sourceforge/mikutoga/pmd/BoneType.java
src/main/java/jp/sourceforge/mikutoga/pmd/Deg3d.java
src/main/java/jp/sourceforge/mikutoga/pmd/MorphType.java
src/main/java/jp/sourceforge/mikutoga/pmd/Rad3d.java
src/main/java/jp/sourceforge/mikutoga/pmd/RigidBehaviorType.java
src/main/java/jp/sourceforge/mikutoga/pmd/RigidShapeType.java
src/main/java/jp/sourceforge/mikutoga/pmd/TripletRange.java
src/main/java/jp/sourceforge/mikutoga/pmd/package-info.java
src/test/java/jp/sourceforge/mikutoga/pmd/BoneTypeTest.java [new file with mode: 0644]
src/test/java/jp/sourceforge/mikutoga/pmd/Deg3dTest.java [new file with mode: 0644]
src/test/java/jp/sourceforge/mikutoga/pmd/IllegalPmdDataExceptionTest.java [new file with mode: 0644]
src/test/java/jp/sourceforge/mikutoga/pmd/MorphTypeTest.java
src/test/java/jp/sourceforge/mikutoga/pmd/Rad3dTest.java [new file with mode: 0644]
src/test/java/jp/sourceforge/mikutoga/pmd/RigidBehaviorTypeTest.java [new file with mode: 0644]
src/test/java/jp/sourceforge/mikutoga/pmd/RigidShapeTypeTest.java [new file with mode: 0644]
src/test/java/jp/sourceforge/mikutoga/pmd/TripletRangeTest.java [new file with mode: 0644]

index de44ca5..99bbfa4 100644 (file)
@@ -7,6 +7,7 @@ TogaGem 変更履歴
 X.XXX.X (20XX-XX-XX)
     ・逆正接の分母に小さな値が来たときの判定を甘くした。
     ・パッケージ構成を変更。
 X.XXX.X (20XX-XX-XX)
     ・逆正接の分母に小さな値が来たときの判定を甘くした。
     ・パッケージ構成を変更。
+    ・多言語対応に際してのフォールバックを禁止。
 
 2.102.2 (2013-03-17)
     ・Maven3対応。
 
 2.102.2 (2013-03-17)
     ・Maven3対応。
index 974732c..d00b175 100644 (file)
@@ -20,7 +20,7 @@ public strictfp class MkQuat {
 
     static{
         double one = 1.0;
 
     static{
         double one = 1.0;
-        for(int ct=1; ct<=STEP_BELOW; ct++){
+        for(int ct = 1; ct <= STEP_BELOW; ct++){
             one = StrictMath.nextAfter(one, 0.0);
         }
         BELOWONE = one;
             one = StrictMath.nextAfter(one, 0.0);
         }
         BELOWONE = one;
index 8a916a4..734adbc 100644 (file)
@@ -7,6 +7,7 @@
 
 package jp.sourceforge.mikutoga.pmd;
 
 
 package jp.sourceforge.mikutoga.pmd;
 
+import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
 import java.util.Locale;
 import java.util.ResourceBundle;
 
@@ -49,9 +50,19 @@ public enum BoneType {
     LINKEDROT(0x09),
     ;
 
     LINKEDROT(0x09),
     ;
 
+    private static final ResourceBundle.Control NOFALLBACK;
     private static final String FAMILY_NAME =
             "jp.sourceforge.mikutoga.pmd.resources.BoneTypeName";
 
     private static final String FAMILY_NAME =
             "jp.sourceforge.mikutoga.pmd.resources.BoneTypeName";
 
+    static{
+        List<String> rbforms = ResourceBundle.Control.FORMAT_DEFAULT;
+        NOFALLBACK = ResourceBundle.Control.getNoFallbackControl(rbforms);
+
+        String name = ROTATE.getClass().getPackage().getName();
+        assert FAMILY_NAME.startsWith(name);
+    }
+
+
     private final byte encoded;
 
     /**
     private final byte encoded;
 
     /**
@@ -104,6 +115,7 @@ public enum BoneType {
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
+        assert locale != null;
         return getGuiName(locale);
     }
 
         return getGuiName(locale);
     }
 
@@ -114,7 +126,8 @@ public enum BoneType {
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
-        ResourceBundle rb = ResourceBundle.getBundle(FAMILY_NAME, locale);
+        ResourceBundle rb =
+                ResourceBundle.getBundle(FAMILY_NAME, locale, NOFALLBACK);
         String key = name();
         String result = rb.getString(key);
         return result;
         String key = name();
         String result = rb.getString(key);
         return result;
index c34ff07..4281b05 100644 (file)
@@ -8,7 +8,8 @@
 package jp.sourceforge.mikutoga.pmd;
 
 /**
 package jp.sourceforge.mikutoga.pmd;
 
 /**
- * XYZ3軸による回転量(degree)。
+ * XYZ3軸によるジョイント回転量(degree)。
+ * オイラー角か否か詳細は不明。
  * radianではなくdegree。(直角は90.0)
  */
 public class Deg3d {
  * radianではなくdegree。(直角は90.0)
  */
 public class Deg3d {
index b9e6358..c6c5ee4 100644 (file)
@@ -7,6 +7,7 @@
 
 package jp.sourceforge.mikutoga.pmd;
 
 
 package jp.sourceforge.mikutoga.pmd;
 
+import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
 import java.util.Locale;
 import java.util.ResourceBundle;
 
@@ -34,9 +35,19 @@ public enum MorphType {
     EXTRA(0x04),
     ;
 
     EXTRA(0x04),
     ;
 
+    private static final ResourceBundle.Control NOFALLBACK;
     private static final String FAMILY_NAME =
             "jp.sourceforge.mikutoga.pmd.resources.MorphTypeName";
 
     private static final String FAMILY_NAME =
             "jp.sourceforge.mikutoga.pmd.resources.MorphTypeName";
 
+    static{
+        List<String> rbforms = ResourceBundle.Control.FORMAT_DEFAULT;
+        NOFALLBACK = ResourceBundle.Control.getNoFallbackControl(rbforms);
+
+        String name = BASE.getClass().getPackage().getName();
+        assert FAMILY_NAME.startsWith(name);
+    }
+
+
     private final byte encoded;
 
     /**
     private final byte encoded;
 
     /**
@@ -89,6 +100,7 @@ public enum MorphType {
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
+        assert locale != null;
         return getGuiName(locale);
     }
 
         return getGuiName(locale);
     }
 
@@ -99,7 +111,8 @@ public enum MorphType {
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
-        ResourceBundle rb = ResourceBundle.getBundle(FAMILY_NAME, locale);
+        ResourceBundle rb =
+                ResourceBundle.getBundle(FAMILY_NAME, locale, NOFALLBACK);
         String key = name();
         String result = rb.getString(key);
         return result;
         String key = name();
         String result = rb.getString(key);
         return result;
index 7e1cce3..8e679a8 100644 (file)
@@ -8,7 +8,8 @@
 package jp.sourceforge.mikutoga.pmd;
 
 /**
 package jp.sourceforge.mikutoga.pmd;
 
 /**
- * XYZ3軸による回転量(radian)。
+ * XYZ3軸によるジョイント回転量(radian)。
+ * オイラー角か否か詳細は不明。
  * degereeではなくradian。(直角はΠ/2)
  */
 public class Rad3d {
  * degereeではなくradian。(直角はΠ/2)
  */
 public class Rad3d {
index 663f06c..a42ddfb 100644 (file)
@@ -7,6 +7,7 @@
 
 package jp.sourceforge.mikutoga.pmd;
 
 
 package jp.sourceforge.mikutoga.pmd;
 
+import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
 import java.util.Locale;
 import java.util.ResourceBundle;
 
@@ -28,9 +29,19 @@ public enum RigidBehaviorType {
     BONEDDYNAMICS(0x02),
     ;
 
     BONEDDYNAMICS(0x02),
     ;
 
+    private static final ResourceBundle.Control NOFALLBACK;
     private static final String FAMILY_NAME =
         "jp.sourceforge.mikutoga.pmd.resources.RigidBehaviorTypeName";
 
     private static final String FAMILY_NAME =
         "jp.sourceforge.mikutoga.pmd.resources.RigidBehaviorTypeName";
 
+    static{
+        List<String> rbforms = ResourceBundle.Control.FORMAT_DEFAULT;
+        NOFALLBACK = ResourceBundle.Control.getNoFallbackControl(rbforms);
+
+        String name = FOLLOWBONE.getClass().getPackage().getName();
+        assert FAMILY_NAME.startsWith(name);
+    }
+
+
     private final byte encoded;
 
     /**
     private final byte encoded;
 
     /**
@@ -83,6 +94,7 @@ public enum RigidBehaviorType {
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
+        assert locale != null;
         return getGuiName(locale);
     }
 
         return getGuiName(locale);
     }
 
@@ -93,7 +105,8 @@ public enum RigidBehaviorType {
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
-        ResourceBundle rb = ResourceBundle.getBundle(FAMILY_NAME, locale);
+        ResourceBundle rb =
+                ResourceBundle.getBundle(FAMILY_NAME, locale, NOFALLBACK);
         String key = name();
         String result = rb.getString(key);
         return result;
         String key = name();
         String result = rb.getString(key);
         return result;
index ed12009..c2163f4 100644 (file)
@@ -7,6 +7,7 @@
 
 package jp.sourceforge.mikutoga.pmd;
 
 
 package jp.sourceforge.mikutoga.pmd;
 
+import java.util.List;
 import java.util.Locale;
 import java.util.ResourceBundle;
 
 import java.util.Locale;
 import java.util.ResourceBundle;
 
@@ -28,9 +29,19 @@ public enum RigidShapeType {
     CAPSULE(0x02),
     ;
 
     CAPSULE(0x02),
     ;
 
+    private static final ResourceBundle.Control NOFALLBACK;
     private static final String FAMILY_NAME =
             "jp.sourceforge.mikutoga.pmd.resources.RigidShapeTypeName";
 
     private static final String FAMILY_NAME =
             "jp.sourceforge.mikutoga.pmd.resources.RigidShapeTypeName";
 
+    static{
+        List<String> rbforms = ResourceBundle.Control.FORMAT_DEFAULT;
+        NOFALLBACK = ResourceBundle.Control.getNoFallbackControl(rbforms);
+
+        String name = SPHERE.getClass().getPackage().getName();
+        assert FAMILY_NAME.startsWith(name);
+    }
+
+
     private final byte encoded;
 
     /**
     private final byte encoded;
 
     /**
@@ -83,6 +94,7 @@ public enum RigidShapeType {
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
      */
     public String getGuiName(){
         Locale locale = Locale.getDefault();
+        assert locale != null;
         return getGuiName(locale);
     }
 
         return getGuiName(locale);
     }
 
@@ -93,7 +105,8 @@ public enum RigidShapeType {
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
      */
     public String getGuiName(Locale locale){
         if(locale == null) return getGuiName();
-        ResourceBundle rb = ResourceBundle.getBundle(FAMILY_NAME, locale);
+        ResourceBundle rb =
+                ResourceBundle.getBundle(FAMILY_NAME, locale, NOFALLBACK);
         String key = name();
         String result = rb.getString(key);
         return result;
         String key = name();
         String result = rb.getString(key);
         return result;
index ae36731..40f1130 100644 (file)
@@ -8,7 +8,7 @@
 package jp.sourceforge.mikutoga.pmd;
 
 /**
 package jp.sourceforge.mikutoga.pmd;
 
 /**
- * XYZ三組float値の範囲制約。
+ * ジョイント用XYZ三組float値の範囲制約。
  */
 public class TripletRange {
 
  */
 public class TripletRange {
 
index 106c9b8..500810d 100644 (file)
@@ -6,7 +6,7 @@
  */
 
 /**
  */
 
 /**
- * PMDモデルファイルに相当するオブジェクト各種。
+ * PMDã\83¢ã\83\87ã\83«ã\83\95ã\82¡ã\82¤ã\83«ã\81®æ§\8bæ\88\90è¦\81ç´ ã\81«ç\9b¸å½\93ã\81\99ã\82\8bã\82ªã\83\96ã\82¸ã\82§ã\82¯ã\83\88å\90\84種ã\80\82
  */
 
 package jp.sourceforge.mikutoga.pmd;
  */
 
 package jp.sourceforge.mikutoga.pmd;
diff --git a/src/test/java/jp/sourceforge/mikutoga/pmd/BoneTypeTest.java b/src/test/java/jp/sourceforge/mikutoga/pmd/BoneTypeTest.java
new file mode 100644 (file)
index 0000000..b0c812c
--- /dev/null
@@ -0,0 +1,168 @@
+/*
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import java.util.Locale;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class BoneTypeTest {
+
+    public BoneTypeTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     * Test of values method, of class BoneType.
+     */
+    @Test
+    public void testValues() {
+        System.out.println("values");
+
+        BoneType[] array = BoneType.values();
+
+        assertEquals(10, array.length);
+
+        assertEquals(BoneType.ROTATE,      array[0]);
+        assertEquals(BoneType.ROTMOV,      array[1]);
+        assertEquals(BoneType.IK,          array[2]);
+        assertEquals(BoneType.UNKNOWN,     array[3]);
+        assertEquals(BoneType.UNDERIK,     array[4]);
+        assertEquals(BoneType.UNDERROT,    array[5]);
+        assertEquals(BoneType.IKCONNECTED, array[6]);
+        assertEquals(BoneType.HIDDEN,      array[7]);
+        assertEquals(BoneType.TWIST,       array[8]);
+        assertEquals(BoneType.LINKEDROT,   array[9]);
+
+        return;
+    }
+
+    /**
+     * Test of decode method, of class BoneType.
+     */
+    @Test
+    public void testDecode() {
+        System.out.println("decode");
+
+        assertEquals(BoneType.ROTATE,      BoneType.decode((byte)0x00));
+        assertEquals(BoneType.ROTMOV,      BoneType.decode((byte)0x01));
+        assertEquals(BoneType.IK,          BoneType.decode((byte)0x02));
+        assertEquals(BoneType.UNKNOWN,     BoneType.decode((byte)0x03));
+        assertEquals(BoneType.UNDERIK,     BoneType.decode((byte)0x04));
+        assertEquals(BoneType.UNDERROT,    BoneType.decode((byte)0x05));
+        assertEquals(BoneType.IKCONNECTED, BoneType.decode((byte)0x06));
+        assertEquals(BoneType.HIDDEN,      BoneType.decode((byte)0x07));
+        assertEquals(BoneType.TWIST,       BoneType.decode((byte)0x08));
+        assertEquals(BoneType.LINKEDROT,   BoneType.decode((byte)0x09));
+
+        assertNull(BoneType.decode((byte)0x0a));
+
+        return;
+    }
+
+    /**
+     * Test of encode method, of class BoneType.
+     */
+    @Test
+    public void testEncode() {
+        System.out.println("encode");
+
+        assertEquals(0x00, BoneType.ROTATE.encode());
+        assertEquals(0x01, BoneType.ROTMOV.encode());
+        assertEquals(0x02, BoneType.IK.encode());
+        assertEquals(0x03, BoneType.UNKNOWN.encode());
+        assertEquals(0x04, BoneType.UNDERIK.encode());
+        assertEquals(0x05, BoneType.UNDERROT.encode());
+        assertEquals(0x06, BoneType.IKCONNECTED.encode());
+        assertEquals(0x07, BoneType.HIDDEN.encode());
+        assertEquals(0x08, BoneType.TWIST.encode());
+        assertEquals(0x09, BoneType.LINKEDROT.encode());
+
+        return;
+    }
+
+    /**
+     * Test of getGuiName method, of class BoneType.
+     */
+    @Test
+    public void testGetGuiName_0args() {
+        System.out.println("getGuiName");
+
+        Locale locale = Locale.getDefault();
+
+        for(BoneType type : BoneType.values()){
+            assertEquals(type.getGuiName(locale), type.getGuiName());
+        }
+
+        return;
+    }
+
+    /**
+     * Test of getGuiName method, of class BoneType.
+     */
+    @Test
+    public void testGetGuiName_Locale() {
+        System.out.println("getGuiName");
+
+        Locale locale;
+
+        locale = Locale.JAPANESE;
+        assertEquals("回転",           BoneType.ROTATE.getGuiName(locale));
+        assertEquals("回転/移動",      BoneType.ROTMOV.getGuiName(locale));
+        assertEquals("IK",             BoneType.IK.getGuiName(locale));
+        assertEquals("不明",           BoneType.UNKNOWN.getGuiName(locale));
+        assertEquals("IK影響下(回転)", BoneType.UNDERIK.getGuiName(locale));
+        assertEquals("回転影響下",     BoneType.UNDERROT.getGuiName(locale));
+        assertEquals("IK接続先",       BoneType.IKCONNECTED.getGuiName(locale));
+        assertEquals("非表示",         BoneType.HIDDEN.getGuiName(locale));
+        assertEquals("捩り",           BoneType.TWIST.getGuiName(locale));
+        assertEquals("回転連動",       BoneType.LINKEDROT.getGuiName(locale));
+
+        locale = Locale.JAPAN;
+        assertEquals("回転",           BoneType.ROTATE.getGuiName(locale));
+
+        locale = Locale.ITALY;
+        assertEquals("Rotate",         BoneType.ROTATE.getGuiName(locale));
+        assertEquals("Rotate/Move",    BoneType.ROTMOV.getGuiName(locale));
+        assertEquals("IK",             BoneType.IK.getGuiName(locale));
+        assertEquals("Unknown",        BoneType.UNKNOWN.getGuiName(locale));
+        assertEquals("Under IK",       BoneType.UNDERIK.getGuiName(locale));
+        assertEquals("Under rotate",   BoneType.UNDERROT.getGuiName(locale));
+        assertEquals("IK connected",   BoneType.IKCONNECTED.getGuiName(locale));
+        assertEquals("Hidden",         BoneType.HIDDEN.getGuiName(locale));
+        assertEquals("Twist",          BoneType.TWIST.getGuiName(locale));
+        assertEquals("Linked Rotate",  BoneType.LINKEDROT.getGuiName(locale));
+
+        locale = Locale.ENGLISH;
+        assertEquals("Rotate",         BoneType.ROTATE.getGuiName(locale));
+
+        locale = Locale.US;
+        assertEquals("Rotate",         BoneType.ROTATE.getGuiName(locale));
+
+        return;
+    }
+
+}
diff --git a/src/test/java/jp/sourceforge/mikutoga/pmd/Deg3dTest.java b/src/test/java/jp/sourceforge/mikutoga/pmd/Deg3dTest.java
new file mode 100644 (file)
index 0000000..908257f
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class Deg3dTest {
+
+    public Deg3dTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     * Test of method, of class Deg3d.
+     */
+    @Test
+    public void test() {
+        System.out.println("test Deg3d");
+
+        Deg3d deg = new Deg3d();
+
+        assertEquals(0.0f, deg.getXDeg(), 0);
+        assertEquals(0.0f, deg.getYDeg(), 0);
+        assertEquals(0.0f, deg.getZDeg(), 0);
+
+        deg.setXDeg(1.0f);
+        deg.setYDeg(2.0f);
+        deg.setZDeg(3.0f);
+
+        assertEquals(1.0f, deg.getXDeg(), 0);
+        assertEquals(2.0f, deg.getYDeg(), 0);
+        assertEquals(3.0f, deg.getZDeg(), 0);
+
+        assertEquals("deg=[1.0, 2.0, 3.0]", deg.toString());
+
+        return;
+    }
+
+}
diff --git a/src/test/java/jp/sourceforge/mikutoga/pmd/IllegalPmdDataExceptionTest.java b/src/test/java/jp/sourceforge/mikutoga/pmd/IllegalPmdDataExceptionTest.java
new file mode 100644 (file)
index 0000000..0c0c3a7
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class IllegalPmdDataExceptionTest {
+
+    public IllegalPmdDataExceptionTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    @Test
+    public void testSomeMethod() {
+        IllegalPmdDataException ex;
+
+        ex = new IllegalPmdDataException();
+        assertNull(ex.getCause());
+        assertNull(ex.getMessage());
+
+        ex = new IllegalPmdDataException("msg");
+        assertNull(ex.getCause());
+        assertEquals("msg", ex.getMessage());
+
+        Throwable cex = new IllegalArgumentException();
+        ex = new IllegalPmdDataException(cex);
+        assertEquals(cex, ex.getCause());
+        assertEquals(cex.toString(), ex.getMessage());
+
+        return;
+    }
+
+}
index 3608a2b..e0f1863 100644 (file)
@@ -13,7 +13,7 @@ import org.junit.Test;
 import static org.junit.Assert.*;
 
 /**
 import static org.junit.Assert.*;
 
 /**
- * 
+ *
  */
 public class MorphTypeTest {
 
  */
 public class MorphTypeTest {
 
@@ -47,11 +47,11 @@ public class MorphTypeTest {
 
         assertEquals(5, array.length);
 
 
         assertEquals(5, array.length);
 
-        assertEquals(MorphType.BASE, array[0]);
+        assertEquals(MorphType.BASE,    array[0]);
         assertEquals(MorphType.EYEBROW, array[1]);
         assertEquals(MorphType.EYEBROW, array[1]);
-        assertEquals(MorphType.EYE, array[2]);
-        assertEquals(MorphType.LIP, array[3]);
-        assertEquals(MorphType.EXTRA, array[4]);
+        assertEquals(MorphType.EYE,     array[2]);
+        assertEquals(MorphType.LIP,     array[3]);
+        assertEquals(MorphType.EXTRA,   array[4]);
 
         return;
     }
 
         return;
     }
@@ -112,14 +112,47 @@ public class MorphTypeTest {
     public void testGetGuiName_Locale(){
         System.out.println("getGuiName");
 
     public void testGetGuiName_Locale(){
         System.out.println("getGuiName");
 
-        Locale locale = Locale.JAPANESE;
+        Locale locale;
 
 
-        assertEquals("base", MorphType.BASE.getGuiName(locale));
-        assertEquals("まゆ", MorphType.EYEBROW.getGuiName(locale));
-        assertEquals("目", MorphType.EYE.getGuiName(locale));
+        locale = Locale.JAPANESE;
+        assertEquals("base",   MorphType.BASE.getGuiName(locale));
+        assertEquals("まゆ",   MorphType.EYEBROW.getGuiName(locale));
+        assertEquals("目",     MorphType.EYE.getGuiName(locale));
         assertEquals("リップ", MorphType.LIP.getGuiName(locale));
         assertEquals("その他", MorphType.EXTRA.getGuiName(locale));
         assertEquals("リップ", MorphType.LIP.getGuiName(locale));
         assertEquals("その他", MorphType.EXTRA.getGuiName(locale));
-        
+
+        locale = Locale.JAPAN;
+        assertEquals("まゆ",   MorphType.EYEBROW.getGuiName(locale));
+
+        locale = Locale.ITALY;
+        assertEquals("base",  MorphType.BASE.getGuiName(locale));
+        assertEquals("brow",  MorphType.EYEBROW.getGuiName(locale));
+        assertEquals("eyes",  MorphType.EYE.getGuiName(locale));
+        assertEquals("mouse", MorphType.LIP.getGuiName(locale));
+        assertEquals("other", MorphType.EXTRA.getGuiName(locale));
+
+        locale = Locale.ENGLISH;
+        assertEquals("brow",  MorphType.EYEBROW.getGuiName(locale));
+
+        locale = Locale.US;
+        assertEquals("brow",  MorphType.EYEBROW.getGuiName(locale));
+
+        return;
+    }
+
+    /**
+     * Test of isBase method, of class MorphType.
+     */
+    @Test
+    public void testIsBase(){
+        System.out.println("isBase");
+
+        assertTrue(MorphType.BASE.isBase());
+        assertFalse(MorphType.EYEBROW.isBase());
+        assertFalse(MorphType.EYE.isBase());
+        assertFalse(MorphType.LIP.isBase());
+        assertFalse(MorphType.EXTRA.isBase());
+
         return;
     }
 
         return;
     }
 
diff --git a/src/test/java/jp/sourceforge/mikutoga/pmd/Rad3dTest.java b/src/test/java/jp/sourceforge/mikutoga/pmd/Rad3dTest.java
new file mode 100644 (file)
index 0000000..52f8fcd
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class Rad3dTest {
+
+    public Rad3dTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     * Test of method, of class Deg3d.
+     */
+    @Test
+    public void test() {
+        System.out.println("test Rad3d");
+
+        Rad3d rad = new Rad3d();
+
+        assertEquals(0.0f, rad.getXRad(), 0);
+        assertEquals(0.0f, rad.getYRad(), 0);
+        assertEquals(0.0f, rad.getZRad(), 0);
+
+        rad.setXRad(1.0f);
+        rad.setYRad(2.0f);
+        rad.setZRad(3.0f);
+
+        assertEquals(1.0f, rad.getXRad(), 0);
+        assertEquals(2.0f, rad.getYRad(), 0);
+        assertEquals(3.0f, rad.getZRad(), 0);
+
+        assertEquals("rad=[1.0, 2.0, 3.0]", rad.toString());
+
+        return;
+    }
+
+}
diff --git a/src/test/java/jp/sourceforge/mikutoga/pmd/RigidBehaviorTypeTest.java b/src/test/java/jp/sourceforge/mikutoga/pmd/RigidBehaviorTypeTest.java
new file mode 100644 (file)
index 0000000..63b0ec1
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import java.util.Locale;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class RigidBehaviorTypeTest {
+
+    public RigidBehaviorTypeTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     * Test of values method, of class RigidBehaviorType.
+     */
+    @Test
+    public void testValues() {
+        System.out.println("values");
+
+        RigidBehaviorType[] array = RigidBehaviorType.values();
+
+        assertEquals(3, array.length);
+
+        assertEquals(RigidBehaviorType.FOLLOWBONE,    array[0]);
+        assertEquals(RigidBehaviorType.ONLYDYNAMICS,  array[1]);
+        assertEquals(RigidBehaviorType.BONEDDYNAMICS, array[2]);
+
+        return;
+    }
+
+    /**
+     * Test of decode method, of class RigidBehaviorType.
+     */
+    @Test
+    public void testDecode() {
+        System.out.println("decode");
+
+        assertEquals(RigidBehaviorType.FOLLOWBONE,    RigidBehaviorType.decode((byte)0x00));
+        assertEquals(RigidBehaviorType.ONLYDYNAMICS,  RigidBehaviorType.decode((byte)0x01));
+        assertEquals(RigidBehaviorType.BONEDDYNAMICS, RigidBehaviorType.decode((byte)0x02));
+
+        assertNull(RigidBehaviorType.decode((byte)0x03));
+
+        return;
+    }
+
+    /**
+     * Test of encode method, of class RigidBehaviorType.
+     */
+    @Test
+    public void testEncode() {
+        System.out.println("encode");
+
+        assertEquals(0x00, RigidBehaviorType.FOLLOWBONE.encode());
+        assertEquals(0x01, RigidBehaviorType.ONLYDYNAMICS.encode());
+        assertEquals(0x02, RigidBehaviorType.BONEDDYNAMICS.encode());
+
+        return;
+    }
+
+    /**
+     * Test of getGuiName method, of class RigidBehaviorType.
+     */
+    @Test
+    public void testGetGuiName_0args() {
+        System.out.println("getGuiName");
+
+        Locale locale = Locale.getDefault();
+
+        for(RigidBehaviorType type : RigidBehaviorType.values()){
+            assertEquals(type.getGuiName(locale), type.getGuiName());
+        }
+
+        return;
+    }
+
+    /**
+     * Test of getGuiName method, of class RigidBehaviorType.
+     */
+    @Test
+    public void testGetGuiName_Locale() {
+        System.out.println("getGuiName");
+
+        Locale locale;
+
+        locale = Locale.JAPANESE;
+        assertEquals("ボーン追従",   RigidBehaviorType.FOLLOWBONE.getGuiName(locale));
+        assertEquals("物理演算",   RigidBehaviorType.ONLYDYNAMICS.getGuiName(locale));
+        assertEquals("ボーン位置合わせ",   RigidBehaviorType.BONEDDYNAMICS.getGuiName(locale));
+
+        locale = Locale.JAPAN;
+        assertEquals("ボーン追従",   RigidBehaviorType.FOLLOWBONE.getGuiName(locale));
+
+        locale = Locale.ITALY;
+        assertEquals("static(to bone)",   RigidBehaviorType.FOLLOWBONE.getGuiName(locale));
+        assertEquals("dynamic",   RigidBehaviorType.ONLYDYNAMICS.getGuiName(locale));
+        assertEquals("bone matching",   RigidBehaviorType.BONEDDYNAMICS.getGuiName(locale));
+
+        locale = Locale.ENGLISH;
+        assertEquals("static(to bone)",   RigidBehaviorType.FOLLOWBONE.getGuiName(locale));
+
+        locale = Locale.US;
+        assertEquals("static(to bone)",   RigidBehaviorType.FOLLOWBONE.getGuiName(locale));
+
+        return;
+    }
+
+}
diff --git a/src/test/java/jp/sourceforge/mikutoga/pmd/RigidShapeTypeTest.java b/src/test/java/jp/sourceforge/mikutoga/pmd/RigidShapeTypeTest.java
new file mode 100644 (file)
index 0000000..26eab40
--- /dev/null
@@ -0,0 +1,133 @@
+/*
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import java.util.Locale;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class RigidShapeTypeTest {
+
+    public RigidShapeTypeTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     * Test of values method, of class RigidShapeType.
+     */
+    @Test
+    public void testValues() {
+        System.out.println("values");
+
+        RigidShapeType[] array = RigidShapeType.values();
+
+        assertEquals(3, array.length);
+
+        assertEquals(RigidShapeType.SPHERE,  array[0]);
+        assertEquals(RigidShapeType.BOX,     array[1]);
+        assertEquals(RigidShapeType.CAPSULE, array[2]);
+
+        return;
+    }
+
+    /**
+     * Test of decode method, of class RigidShapeType.
+     */
+    @Test
+    public void testDecode() {
+        System.out.println("decode");
+
+        assertEquals(RigidShapeType.SPHERE,  RigidShapeType.decode((byte)0x00));
+        assertEquals(RigidShapeType.BOX,     RigidShapeType.decode((byte)0x01));
+        assertEquals(RigidShapeType.CAPSULE, RigidShapeType.decode((byte)0x02));
+
+        assertNull(RigidShapeType.decode((byte)0x03));
+
+        return;
+    }
+
+    /**
+     * Test of encode method, of class RigidShapeType.
+     */
+    @Test
+    public void testEncode() {
+        System.out.println("encode");
+
+        assertEquals(0x00, RigidShapeType.SPHERE.encode());
+        assertEquals(0x01, RigidShapeType.BOX.encode());
+        assertEquals(0x02, RigidShapeType.CAPSULE.encode());
+
+        return;
+    }
+
+    /**
+     * Test of getGuiName method, of class RigidShapeType.
+     */
+    @Test
+    public void testGetGuiName_0args() {
+        System.out.println("getGuiName");
+
+        Locale locale = Locale.getDefault();
+
+        for(RigidShapeType type : RigidShapeType.values()){
+            assertEquals(type.getGuiName(locale), type.getGuiName());
+        }
+
+        return;
+    }
+
+    /**
+     * Test of getGuiName method, of class RigidShapeType.
+     */
+    @Test
+    public void testGetGuiName_Locale() {
+        System.out.println("getGuiName");
+
+        Locale locale;
+
+        locale = Locale.JAPANESE;
+        assertEquals("球",   RigidShapeType.SPHERE.getGuiName(locale));
+        assertEquals("箱",   RigidShapeType.BOX.getGuiName(locale));
+        assertEquals("カプセル",   RigidShapeType.CAPSULE.getGuiName(locale));
+
+        locale = Locale.JAPAN;
+        assertEquals("球",   RigidShapeType.SPHERE.getGuiName(locale));
+
+        locale = Locale.ITALY;
+        assertEquals("sphere",   RigidShapeType.SPHERE.getGuiName(locale));
+        assertEquals("box",      RigidShapeType.BOX.getGuiName(locale));
+        assertEquals("capsule",  RigidShapeType.CAPSULE.getGuiName(locale));
+
+        locale = Locale.ENGLISH;
+        assertEquals("sphere",   RigidShapeType.SPHERE.getGuiName(locale));
+
+        locale = Locale.US;
+        assertEquals("sphere",   RigidShapeType.SPHERE.getGuiName(locale));
+
+        return;
+    }
+
+}
diff --git a/src/test/java/jp/sourceforge/mikutoga/pmd/TripletRangeTest.java b/src/test/java/jp/sourceforge/mikutoga/pmd/TripletRangeTest.java
new file mode 100644 (file)
index 0000000..7d4998c
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ */
+
+package jp.sourceforge.mikutoga.pmd;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
+
+/**
+ *
+ */
+public class TripletRangeTest {
+
+    public TripletRangeTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    /**
+     * Test of method, of class TripletRange.
+     */
+    @Test
+    public void test() {
+        System.out.println("test");
+
+        TripletRange range;
+
+        range = new TripletRange();
+        assertEquals(0.0f, range.getXFrom(), 0);
+        assertEquals(0.0f, range.getXTo(), 0);
+        assertEquals(0.0f, range.getYFrom(), 0);
+        assertEquals(0.0f, range.getYTo(), 0);
+        assertEquals(0.0f, range.getZFrom(), 0);
+        assertEquals(0.0f, range.getZTo(), 0);
+
+        range.setXRange(1.0f, 2.0f);
+        assertEquals(1.0f, range.getXFrom(), 0);
+        assertEquals(2.0f, range.getXTo(), 0);
+        range.setXRange(2.0f, 1.0f);
+        assertEquals(1.0f, range.getXFrom(), 0);
+        assertEquals(2.0f, range.getXTo(), 0);
+        assertTrue(range.isValidX(1.0f));
+        assertTrue(range.isValidX(1.5f));
+        assertTrue(range.isValidX(2.0f));
+        assertFalse(range.isValidX(0.5f));
+        assertFalse(range.isValidX(2.5f));
+
+        range.setYRange(3.0f, 4.0f);
+        assertEquals(3.0f, range.getYFrom(), 0);
+        assertEquals(4.0f, range.getYTo(), 0);
+        range.setYRange(4.0f, 3.0f);
+        assertEquals(3.0f, range.getYFrom(), 0);
+        assertEquals(4.0f, range.getYTo(), 0);
+        assertTrue(range.isValidY(3.0f));
+        assertTrue(range.isValidY(3.5f));
+        assertTrue(range.isValidY(4.0f));
+        assertFalse(range.isValidY(2.5f));
+        assertFalse(range.isValidY(4.5f));
+
+        range.setZRange(5.0f, 6.0f);
+        assertEquals(5.0f, range.getZFrom(), 0);
+        assertEquals(6.0f, range.getZTo(), 0);
+        range.setZRange(6.0f, 5.0f);
+        assertEquals(5.0f, range.getZFrom(), 0);
+        assertEquals(6.0f, range.getZTo(), 0);
+        assertTrue(range.isValidZ(5.0f));
+        assertTrue(range.isValidZ(5.5f));
+        assertTrue(range.isValidZ(6.0f));
+        assertFalse(range.isValidZ(4.5f));
+        assertFalse(range.isValidZ(6.5f));
+
+        assertEquals("x=[1.0 - 2.0] y=[3.0 - 4.0] z=[5.0 - 6.0]", range.toString());
+
+        return;
+    }
+
+}