OSDN Git Service

877cfb01d2de155d41f959e267879f97accf5923
[mikutoga/TogaGem.git] / src / test / java / jp / sfjp / mikutoga / typical / TypicalBoneTest.java
1 /*
2  */
3
4 package jp.sfjp.mikutoga.typical;
5
6 import java.util.List;
7 import org.junit.After;
8 import org.junit.AfterClass;
9 import org.junit.Before;
10 import org.junit.BeforeClass;
11 import org.junit.Test;
12 import static org.junit.Assert.*;
13
14 /**
15  *
16  */
17 public class TypicalBoneTest {
18
19     public TypicalBoneTest() {
20     }
21
22     @BeforeClass
23     public static void setUpClass() {
24     }
25
26     @AfterClass
27     public static void tearDownClass() {
28     }
29
30     @Before
31     public void setUp() {
32     }
33
34     @After
35     public void tearDown() {
36     }
37
38     /**
39      * Test of findWithPrimary method, of class TypicalBone.
40      */
41     @Test
42     public void testFindWithPrimary() {
43         System.out.println("findWithPrimary");
44
45         TypicalBone result;
46         result = TypicalBone.findWithPrimary("頭");
47
48         assertEquals("頭", result.getTopPrimaryName());
49         assertEquals("head", result.getTopGlobalName());
50         assertEquals(1, result.getPrimaryNameList().size());
51         assertEquals("頭", result.getPrimaryNameList().get(0));
52         assertEquals(1, result.getGlobalNameList().size());
53         assertEquals("head", result.getGlobalNameList().get(0));
54
55         return;
56     }
57
58     /**
59      * Test of findWithGlobal method, of class TypicalBone.
60      */
61     @Test
62     public void testFindWithGlobal() {
63         System.out.println("findWithGlobal");
64
65         TypicalBone result;
66
67         result = TypicalBone.findWithGlobal("head");
68         assertNotNull(result);
69
70         TypicalBone result2;
71         result2 = TypicalBone.findWithPrimary("頭");
72
73         assertSame(result, result2);
74
75         return;
76     }
77
78     /**
79      * Test of primary2global method, of class TypicalBone.
80      */
81     @Test
82     public void testPrimary2global() {
83         System.out.println("primary2global");
84
85         String result;
86
87         result = TypicalBone.primary2global("頭");
88         assertEquals("head", result);
89
90         String result1;
91         String result2;
92
93         result1 = TypicalBone.primary2global("ボーン15");
94         result2 = TypicalBone.primary2global("ボーン15");
95         assertSame(result1, result2);
96
97         result = TypicalBone.primary2global("XXX");
98         assertNull(result);
99
100         return;
101     }
102
103     /**
104      * Test of global2primary method, of class TypicalBone.
105      */
106     @Test
107     public void testGlobal2primary() {
108         System.out.println("global2primary");
109
110         String result;
111
112         result = TypicalBone.global2primary("head");
113         assertEquals("頭", result);
114
115         result = TypicalBone.global2primary("head");
116         assertEquals("頭", result);
117
118         result = TypicalBone.global2primary("XXX");
119         assertNull(result);
120
121         return;
122     }
123
124     /**
125      * Test of getTypicalBoneList method, of class TypicalBone.
126      */
127     @Test
128     public void testGetBoneList() {
129         System.out.println("getBoneList");
130
131         List<TypicalBone> boneList;
132
133         boneList = TypicalBone.getTypicalBoneList();
134
135         assertNotNull(boneList);
136         assertEquals(77, boneList.size());
137
138         TypicalBone bone1st = boneList.get(0);
139         TypicalBone boneLast = boneList.get(77-1);
140
141         assertEquals("センター", bone1st.getTopPrimaryName());
142         assertEquals("ボーン15", boneLast.getTopPrimaryName());
143
144         assertEquals("center", bone1st.getTopGlobalName());
145         assertEquals("bone15", boneLast.getTopGlobalName());
146
147         return;
148     }
149
150     /**
151      * Test of isRoot method, of class TypicalBone.
152      */
153     @Test
154     public void testIsRoot() {
155         System.out.println("isRoot");
156
157         TypicalBone bone;
158
159         bone = TypicalBone.findWithPrimary("センター");
160         assertTrue(bone.isRoot());
161
162         bone = TypicalBone.findWithPrimary("頭");
163         assertFalse(bone.isRoot());
164
165         bone = TypicalBone.findWithPrimary("右足IK");
166         assertTrue(bone.isRoot());
167
168         bone = TypicalBone.findWithPrimary("左足IK");
169         assertTrue(bone.isRoot());
170
171         bone = TypicalBone.findWithPrimary("ボーン01");
172         assertTrue(bone.isRoot());
173
174         return;
175     }
176
177 }