colour.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <xml xmlns="http://www.w3.org/1999/xhtml">
  2. <block type="procedures_defnoreturn" x="260" y="14">
  3. <field name="NAME">test colour picker</field>
  4. <statement name="STACK">
  5. <block type="unittest_assertequals" inline="false">
  6. <value name="MESSAGE">
  7. <block type="text">
  8. <field name="TEXT">static colour</field>
  9. </block>
  10. </value>
  11. <value name="ACTUAL">
  12. <block type="colour_picker">
  13. <field name="COLOUR">#ff6600</field>
  14. </block>
  15. </value>
  16. <value name="EXPECTED">
  17. <block type="text">
  18. <field name="TEXT">#ff6600</field>
  19. </block>
  20. </value>
  21. </block>
  22. </statement>
  23. </block>
  24. <block type="procedures_defnoreturn" x="630" y="13">
  25. <field name="NAME">test rgb</field>
  26. <statement name="STACK">
  27. <block type="unittest_assertequals" inline="false">
  28. <value name="MESSAGE">
  29. <block type="text">
  30. <field name="TEXT">from rgb</field>
  31. </block>
  32. </value>
  33. <value name="ACTUAL">
  34. <block type="colour_rgb" inline="false">
  35. <value name="RED">
  36. <block type="math_number">
  37. <field name="NUM">100</field>
  38. </block>
  39. </value>
  40. <value name="GREEN">
  41. <block type="math_number">
  42. <field name="NUM">40</field>
  43. </block>
  44. </value>
  45. <value name="BLUE">
  46. <block type="math_number">
  47. <field name="NUM">0</field>
  48. </block>
  49. </value>
  50. </block>
  51. </value>
  52. <value name="EXPECTED">
  53. <block type="text">
  54. <field name="TEXT">#ff6600</field>
  55. </block>
  56. </value>
  57. </block>
  58. </statement>
  59. </block>
  60. <block type="unittest_main" x="-5" y="49">
  61. <statement name="DO">
  62. <block type="procedures_callnoreturn">
  63. <mutation name="test colour picker"></mutation>
  64. <next>
  65. <block type="procedures_callnoreturn">
  66. <mutation name="test blend"></mutation>
  67. <next>
  68. <block type="procedures_callnoreturn">
  69. <mutation name="test rgb"></mutation>
  70. <next>
  71. <block type="procedures_callnoreturn">
  72. <mutation name="test colour random"></mutation>
  73. </block>
  74. </next>
  75. </block>
  76. </next>
  77. </block>
  78. </next>
  79. </block>
  80. </statement>
  81. </block>
  82. <block type="procedures_defnoreturn" x="-7" y="223">
  83. <field name="NAME">test colour random</field>
  84. <statement name="STACK">
  85. <block type="controls_repeat_ext" inline="true">
  86. <value name="TIMES">
  87. <block type="math_number">
  88. <field name="NUM">100</field>
  89. </block>
  90. </value>
  91. <statement name="DO">
  92. <block type="variables_set" inline="false">
  93. <field name="VAR">item</field>
  94. <value name="VALUE">
  95. <block type="colour_random"></block>
  96. </value>
  97. <next>
  98. <block type="unittest_assertequals" inline="false">
  99. <value name="MESSAGE">
  100. <block type="text">
  101. <field name="TEXT">test name</field>
  102. </block>
  103. </value>
  104. <value name="ACTUAL">
  105. <block type="text_length" inline="false">
  106. <value name="VALUE">
  107. <block type="variables_get">
  108. <field name="VAR">item</field>
  109. </block>
  110. </value>
  111. </block>
  112. </value>
  113. <value name="EXPECTED">
  114. <block type="math_number">
  115. <field name="NUM">7</field>
  116. </block>
  117. </value>
  118. <next>
  119. <block type="unittest_assertequals" inline="false">
  120. <value name="MESSAGE">
  121. <block type="text">
  122. <field name="TEXT">test name</field>
  123. </block>
  124. </value>
  125. <value name="ACTUAL">
  126. <block type="text_charAt">
  127. <mutation at="false"></mutation>
  128. <field name="WHERE">FIRST</field>
  129. <value name="VALUE">
  130. <block type="variables_get">
  131. <field name="VAR">item</field>
  132. </block>
  133. </value>
  134. </block>
  135. </value>
  136. <value name="EXPECTED">
  137. <block type="text">
  138. <field name="TEXT">#</field>
  139. </block>
  140. </value>
  141. <next>
  142. <block type="controls_for">
  143. <field name="VAR">i</field>
  144. <value name="FROM">
  145. <block type="math_number">
  146. <field name="NUM">2</field>
  147. </block>
  148. </value>
  149. <value name="TO">
  150. <block type="math_number">
  151. <field name="NUM">7</field>
  152. </block>
  153. </value>
  154. <statement name="DO">
  155. <block type="unittest_assertvalue" inline="false">
  156. <value name="MESSAGE">
  157. <block type="text">
  158. <field name="TEXT">test name</field>
  159. </block>
  160. </value>
  161. <field name="EXPECTED">TRUE</field>
  162. <value name="ACTUAL">
  163. <block type="logic_compare">
  164. <field name="OP">NEQ</field>
  165. <value name="A">
  166. <block type="math_number">
  167. <field name="NUM">0</field>
  168. </block>
  169. </value>
  170. <value name="B">
  171. <block type="text_indexOf" inline="false">
  172. <field name="END">FIRST</field>
  173. <value name="VALUE">
  174. <block type="text">
  175. <field name="TEXT">abcdefABDEF0123456789</field>
  176. </block>
  177. </value>
  178. <value name="FIND">
  179. <block type="text_charAt">
  180. <mutation at="true"></mutation>
  181. <field name="WHERE">FROM_START</field>
  182. <value name="VALUE">
  183. <block type="variables_get">
  184. <field name="VAR">item</field>
  185. </block>
  186. </value>
  187. <value name="AT">
  188. <block type="variables_get">
  189. <field name="VAR">i</field>
  190. </block>
  191. </value>
  192. </block>
  193. </value>
  194. </block>
  195. </value>
  196. </block>
  197. </value>
  198. </block>
  199. </statement>
  200. </block>
  201. </next>
  202. </block>
  203. </next>
  204. </block>
  205. </next>
  206. </block>
  207. </statement>
  208. </block>
  209. </statement>
  210. </block>
  211. <block type="procedures_defnoreturn" x="520" y="205">
  212. <field name="NAME">test blend</field>
  213. <statement name="STACK">
  214. <block type="unittest_assertequals" inline="false">
  215. <value name="MESSAGE">
  216. <block type="text">
  217. <field name="TEXT">blend</field>
  218. </block>
  219. </value>
  220. <value name="ACTUAL">
  221. <block type="colour_blend" inline="false">
  222. <value name="COLOUR1">
  223. <block type="colour_picker">
  224. <field name="COLOUR">#ff0000</field>
  225. </block>
  226. </value>
  227. <value name="COLOUR2">
  228. <block type="colour_rgb" inline="false">
  229. <value name="RED">
  230. <block type="math_number">
  231. <field name="NUM">100</field>
  232. </block>
  233. </value>
  234. <value name="GREEN">
  235. <block type="math_number">
  236. <field name="NUM">40</field>
  237. </block>
  238. </value>
  239. <value name="BLUE">
  240. <block type="math_number">
  241. <field name="NUM">0</field>
  242. </block>
  243. </value>
  244. </block>
  245. </value>
  246. <value name="RATIO">
  247. <block type="math_number">
  248. <field name="NUM">0.4</field>
  249. </block>
  250. </value>
  251. </block>
  252. </value>
  253. <value name="EXPECTED">
  254. <block type="text">
  255. <field name="TEXT">#ff2900</field>
  256. </block>
  257. </value>
  258. </block>
  259. </statement>
  260. </block>
  261. </xml>