PropertyBinding.js 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /**
  2. * @author TristanVALCKE / https://github.com/TristanVALCKE
  3. */
  4. QUnit.module( 'BufferAttribute' );
  5. QUnit.test( 'parseTrackName' , function( assert ) {
  6. var paths = [
  7. [
  8. '.property',
  9. {
  10. nodeName: undefined,
  11. objectName: undefined,
  12. objectIndex: undefined,
  13. propertyName: 'property',
  14. propertyIndex: undefined
  15. }
  16. ],
  17. [
  18. 'nodeName.property',
  19. {
  20. nodeName: 'nodeName',
  21. objectName: undefined,
  22. objectIndex: undefined,
  23. propertyName: 'property',
  24. propertyIndex: undefined
  25. }
  26. ],
  27. [
  28. 'a.property',
  29. {
  30. nodeName: 'a',
  31. objectName: undefined,
  32. objectIndex: undefined,
  33. propertyName: 'property',
  34. propertyIndex: undefined
  35. }
  36. ],
  37. [
  38. 'no.de.Name.property',
  39. {
  40. nodeName: 'no.de.Name',
  41. objectName: undefined,
  42. objectIndex: undefined,
  43. propertyName: 'property',
  44. propertyIndex: undefined
  45. }
  46. ],
  47. [
  48. 'no.d-e.Name.property',
  49. {
  50. nodeName: 'no.d-e.Name',
  51. objectName: undefined,
  52. objectIndex: undefined,
  53. propertyName: 'property',
  54. propertyIndex: undefined
  55. }
  56. ],
  57. [
  58. 'nodeName.property[accessor]',
  59. {
  60. nodeName: 'nodeName',
  61. objectName: undefined,
  62. objectIndex: undefined,
  63. propertyName: 'property',
  64. propertyIndex: 'accessor'
  65. }
  66. ],
  67. [
  68. 'nodeName.material.property[accessor]',
  69. {
  70. nodeName: 'nodeName',
  71. objectName: 'material',
  72. objectIndex: undefined,
  73. propertyName: 'property',
  74. propertyIndex: 'accessor'
  75. }
  76. ],
  77. [
  78. 'no.de.Name.material.property',
  79. {
  80. nodeName: 'no.de.Name',
  81. objectName: 'material',
  82. objectIndex: undefined,
  83. propertyName: 'property',
  84. propertyIndex: undefined
  85. }
  86. ],
  87. [
  88. 'no.de.Name.material[materialIndex].property',
  89. {
  90. nodeName: 'no.de.Name',
  91. objectName: 'material',
  92. objectIndex: 'materialIndex',
  93. propertyName: 'property',
  94. propertyIndex: undefined
  95. }
  96. ],
  97. [
  98. 'uuid.property[accessor]',
  99. {
  100. nodeName: 'uuid',
  101. objectName: undefined,
  102. objectIndex: undefined,
  103. propertyName: 'property',
  104. propertyIndex: 'accessor'
  105. }
  106. ],
  107. [
  108. 'uuid.objectName[objectIndex].propertyName[propertyIndex]',
  109. {
  110. nodeName: 'uuid',
  111. objectName: 'objectName',
  112. objectIndex: 'objectIndex',
  113. propertyName: 'propertyName',
  114. propertyIndex: 'propertyIndex'
  115. }
  116. ],
  117. [
  118. 'parentName/nodeName.property',
  119. {
  120. // directoryName is currently unused.
  121. nodeName: 'nodeName',
  122. objectName: undefined,
  123. objectIndex: undefined,
  124. propertyName: 'property',
  125. propertyIndex: undefined
  126. }
  127. ],
  128. [
  129. 'parentName/no.de.Name.property',
  130. {
  131. // directoryName is currently unused.
  132. nodeName: 'no.de.Name',
  133. objectName: undefined,
  134. objectIndex: undefined,
  135. propertyName: 'property',
  136. propertyIndex: undefined
  137. }
  138. ],
  139. [
  140. 'parentName/parentName/nodeName.property[index]',
  141. {
  142. // directoryName is currently unused.
  143. nodeName: 'nodeName',
  144. objectName: undefined,
  145. objectIndex: undefined,
  146. propertyName: 'property',
  147. propertyIndex: 'index'
  148. }
  149. ],
  150. [
  151. '.bone[Armature.DEF_cog].position',
  152. {
  153. nodeName: undefined,
  154. objectName: 'bone',
  155. objectIndex: 'Armature.DEF_cog',
  156. propertyName: 'position',
  157. propertyIndex: undefined
  158. }
  159. ],
  160. [
  161. 'scene:helium_balloon_model:helium_balloon_model.position',
  162. {
  163. nodeName: 'helium_balloon_model',
  164. objectName: undefined,
  165. objectIndex: undefined,
  166. propertyName: 'position',
  167. propertyIndex: undefined
  168. }
  169. ]
  170. ];
  171. paths.forEach( function ( path, i ) {
  172. assert.smartEqual(
  173. THREE.PropertyBinding.parseTrackName( path[ 0 ] ),
  174. path[ 1 ],
  175. 'Parses track name: ' + path[ 0 ]
  176. );
  177. } );
  178. });