scarpe 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (378) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +7 -1
  3. data/.yardopts +1 -0
  4. data/CHANGELOG.md +52 -6
  5. data/Gemfile +2 -1
  6. data/Gemfile.lock +20 -6
  7. data/LICENSE.txt +7 -1
  8. data/README.md +100 -21
  9. data/Rakefile +68 -1
  10. data/examples/Edit_box_Styles.rb +8 -0
  11. data/examples/Kerning.rb +7 -0
  12. data/examples/animate.rb +20 -0
  13. data/examples/arrow.rb +10 -0
  14. data/examples/border.rb +11 -0
  15. data/examples/btn_tooltip.rb +7 -0
  16. data/examples/button_style_changed.rb +7 -0
  17. data/examples/button_styles_default.rb +6 -0
  18. data/examples/check.rb +2 -0
  19. data/examples/download_and_show_image.rb +3 -0
  20. data/examples/flags/finland.rb +15 -0
  21. data/examples/flags/italy.rb +11 -0
  22. data/examples/flags/mauritius.rb +14 -0
  23. data/examples/font_family.rb +17 -0
  24. data/examples/font_shorthand.rb +9 -0
  25. data/examples/gen.rb +12 -8
  26. data/examples/highlander.rb +3 -3
  27. data/examples/legacy/README.md +6 -0
  28. data/examples/legacy/not_checked/shoes-contrib/basic/shoes-notes.rb +1 -1
  29. data/examples/legacy/not_checked/shoes-manual/append.rb +10 -0
  30. data/examples/legacy/not_checked/shoes-manual/background_change.rb +12 -0
  31. data/examples/legacy/not_checked/shoes-manual/background_pattern.rb +5 -0
  32. data/examples/legacy/not_checked/shoes-manual/basic_app.rb +8 -0
  33. data/examples/legacy/not_checked/shoes-manual/border.rb +9 -0
  34. data/examples/legacy/not_checked/shoes-manual/builtins/FONTS.rb +5 -0
  35. data/examples/legacy/not_checked/shoes-manual/builtins/ask.rb +2 -0
  36. data/examples/legacy/not_checked/shoes-manual/builtins/ask_color.rb +5 -0
  37. data/examples/legacy/not_checked/shoes-manual/builtins/ask_open_file.rb +5 -0
  38. data/examples/legacy/not_checked/shoes-manual/builtins/ask_save_folder.rb +2 -0
  39. data/examples/legacy/not_checked/shoes-manual/builtins/confirm.rb +4 -0
  40. data/examples/legacy/not_checked/shoes-manual/builtins/debug.rb +2 -0
  41. data/examples/legacy/not_checked/shoes-manual/builtins/info.rb +3 -0
  42. data/examples/legacy/not_checked/shoes-manual/button.rb +9 -0
  43. data/examples/legacy/not_checked/shoes-manual/clear.rb +7 -0
  44. data/examples/legacy/not_checked/shoes-manual/custom_header.rb +13 -0
  45. data/examples/legacy/not_checked/shoes-manual/displace.rb +14 -0
  46. data/examples/legacy/not_checked/shoes-manual/edit_box.rb +8 -0
  47. data/examples/legacy/not_checked/shoes-manual/fill_pattern.rb +5 -0
  48. data/examples/legacy/not_checked/shoes-manual/fonts.rb +7 -0
  49. data/examples/legacy/not_checked/shoes-manual/gutter.rb +6 -0
  50. data/examples/legacy/not_checked/shoes-manual/image_web.rb +4 -0
  51. data/examples/legacy/not_checked/shoes-manual/keypress.rb +7 -0
  52. data/examples/legacy/not_checked/shoes-manual/list_box.rb +10 -0
  53. data/examples/legacy/not_checked/shoes-manual/motion.rb +10 -0
  54. data/examples/legacy/not_checked/shoes-manual/mouse.rb +8 -0
  55. data/examples/legacy/not_checked/shoes-manual/move.rb +14 -0
  56. data/examples/legacy/not_checked/shoes-manual/nested_ovals.rb +8 -0
  57. data/examples/legacy/not_checked/shoes-manual/oval.rb +7 -0
  58. data/examples/legacy/not_checked/shoes-manual/ovals.rb +6 -0
  59. data/examples/legacy/not_checked/shoes-manual/ovals_image.rb +8 -0
  60. data/examples/legacy/not_checked/shoes-manual/prepend.rb +7 -0
  61. data/examples/legacy/not_checked/shoes-manual/progress_bar.rb +10 -0
  62. data/examples/legacy/not_checked/shoes-manual/radio.rb +18 -0
  63. data/examples/legacy/not_checked/shoes-manual/radio_alternative_1.rb +7 -0
  64. data/examples/legacy/not_checked/shoes-manual/radio_alternative_2.rb +9 -0
  65. data/examples/legacy/not_checked/shoes-manual/rotate_rectangle.rb +6 -0
  66. data/examples/legacy/not_checked/shoes-manual/shape.rb +11 -0
  67. data/examples/legacy/not_checked/shoes-manual/static/avatar.png +0 -0
  68. data/examples/legacy/not_checked/shoes-manual/stroke.rb +5 -0
  69. data/examples/legacy/not_checked/shoes-manual/style.rb +3 -0
  70. data/examples/legacy/not_checked/shoes-manual/style_alternative_1.rb +4 -0
  71. data/examples/legacy/not_checked/shoes-manual/style_alternative_2.rb +5 -0
  72. data/examples/legacy/not_checked/shoes-manual/style_length.rb +5 -0
  73. data/examples/legacy/not_checked/shoes-manual/timer.rb +6 -0
  74. data/examples/legacy/not_checked/shoes-manual/trigger_window.rb +8 -0
  75. data/examples/legacy/not_checked/shoes-manual/window_owner.rb +8 -0
  76. data/examples/legacy/not_checked/simple/anim-shapes.rb +1 -1
  77. data/examples/legacy/not_checked/speedometer_app.rb +55 -0
  78. data/examples/legacy/working/shoes_manual/alert_button.rb +2 -0
  79. data/examples/legacy/working/shoes_manual/animate.rb +7 -0
  80. data/examples/legacy/working/shoes_manual/background_para.rb +4 -0
  81. data/examples/legacy/working/shoes_manual/button_alternative.rb +7 -0
  82. data/examples/legacy/working/shoes_manual/checkbox.rb +17 -0
  83. data/examples/legacy/working/shoes_manual/download.rb +12 -0
  84. data/examples/legacy/working/shoes_manual/edit_box.rb +6 -0
  85. data/examples/legacy/working/shoes_manual/editline.rb +7 -0
  86. data/examples/legacy/working/shoes_manual/fixed_height.rb +8 -0
  87. data/examples/legacy/working/shoes_manual/fixed_width.rb +12 -0
  88. data/examples/legacy/working/shoes_manual/image.rb +5 -0
  89. data/examples/legacy/working/shoes_manual/instance_variable_check.rb +10 -0
  90. data/examples/legacy/working/shoes_manual/message.rb +18 -0
  91. data/examples/legacy/working/shoes_manual/rectangle.rb +6 -0
  92. data/examples/legacy/working/shoes_manual/save_download.rb +12 -0
  93. data/examples/legacy/working/shoes_manual/self_check.rb +10 -0
  94. data/examples/legacy/working/shoes_manual/stack.rb +7 -0
  95. data/examples/legacy/working/shoes_manual/style_info.rb +8 -0
  96. data/examples/legacy/working/shoes_manual/utf8_support.rb +8 -0
  97. data/examples/legacy/working/shoes_manual/width.rb +4 -0
  98. data/examples/legacy/working/simple/image-icon.rb +3 -0
  99. data/examples/legacy/{not_checked → working}/simple/image.rb +1 -1
  100. data/examples/list_box_choose.rb +17 -0
  101. data/examples/local_assets/local_file_server.rb +82 -0
  102. data/examples/local_assets/multi_image.rb +5 -0
  103. data/examples/local_assets/sample.gif +0 -0
  104. data/examples/local_assets/sample.mp4 +0 -0
  105. data/examples/local_assets/small.png +0 -0
  106. data/examples/local_fonts.rb +5 -2
  107. data/examples/local_images.rb +2 -3
  108. data/examples/margin.rb +13 -0
  109. data/examples/margin_check.rb +27 -0
  110. data/examples/oval-with-kwargs.rb +3 -0
  111. data/examples/oval.rb +26 -0
  112. data/examples/para/para_text.rb +14 -0
  113. data/examples/para_font_styles.rb +17 -0
  114. data/examples/para_font_variant.rb +6 -0
  115. data/examples/para_fontweight.rb +13 -0
  116. data/examples/parse_xl_funnies.rb +3 -0
  117. data/examples/progress.rb +31 -0
  118. data/examples/radio/radio_groups.rb +2 -2
  119. data/examples/rect.rb +4 -0
  120. data/examples/rotate_shapes.rb +17 -0
  121. data/examples/scarpe_ext.rb +3 -0
  122. data/examples/shapes/star.rb +1 -3
  123. data/examples/simpler-menu.rb +21 -0
  124. data/examples/spacing.rb +1 -1
  125. data/examples/span.rb +4 -2
  126. data/exe/scarpe +2 -1
  127. data/lacci/Gemfile +2 -0
  128. data/lacci/Gemfile.lock +8 -1
  129. data/lacci/lacci.gemspec +2 -2
  130. data/lacci/lib/lacci/scarpe_cli.rb +2 -2
  131. data/lacci/lib/lacci/scarpe_core.rb +2 -1
  132. data/lacci/lib/lacci/version.rb +1 -1
  133. data/lacci/lib/scarpe/niente/app.rb +23 -0
  134. data/lacci/lib/scarpe/niente/display_service.rb +66 -0
  135. data/lacci/lib/scarpe/niente/drawable.rb +59 -0
  136. data/lacci/lib/scarpe/niente/shoes_spec.rb +93 -0
  137. data/lacci/lib/scarpe/niente.rb +32 -0
  138. data/lacci/lib/shoes/app.rb +111 -72
  139. data/lacci/lib/shoes/background.rb +2 -2
  140. data/lacci/lib/shoes/border.rb +2 -2
  141. data/lacci/lib/shoes/builtins.rb +63 -0
  142. data/lacci/lib/shoes/changelog.rb +52 -0
  143. data/lacci/lib/shoes/colors.rb +3 -1
  144. data/lacci/lib/shoes/constants.rb +41 -2
  145. data/lacci/lib/shoes/display_service.rb +80 -18
  146. data/lacci/lib/shoes/download.rb +2 -2
  147. data/lacci/lib/shoes/drawable.rb +654 -0
  148. data/lacci/lib/shoes/drawables/arc.rb +27 -0
  149. data/lacci/lib/shoes/drawables/arrow.rb +21 -0
  150. data/lacci/lib/shoes/drawables/border.rb +28 -0
  151. data/lacci/lib/shoes/drawables/button.rb +57 -0
  152. data/lacci/lib/shoes/drawables/check.rb +33 -0
  153. data/lacci/lib/shoes/drawables/document_root.rb +20 -0
  154. data/lacci/lib/shoes/{widgets → drawables}/edit_box.rb +9 -8
  155. data/lacci/lib/shoes/{widgets → drawables}/edit_line.rb +8 -7
  156. data/lacci/lib/shoes/drawables/flow.rb +20 -0
  157. data/lacci/lib/shoes/drawables/font_helper.rb +62 -0
  158. data/lacci/lib/shoes/{widgets → drawables}/image.rb +7 -7
  159. data/lacci/lib/shoes/drawables/line.rb +17 -0
  160. data/lacci/lib/shoes/drawables/link.rb +31 -0
  161. data/lacci/lib/shoes/drawables/list_box.rb +59 -0
  162. data/lacci/lib/shoes/drawables/oval.rb +48 -0
  163. data/lacci/lib/shoes/drawables/para.rb +206 -0
  164. data/lacci/lib/shoes/drawables/progress.rb +15 -0
  165. data/lacci/lib/shoes/drawables/radio.rb +35 -0
  166. data/lacci/lib/shoes/drawables/rect.rb +18 -0
  167. data/lacci/lib/shoes/{widgets → drawables}/shape.rb +8 -8
  168. data/lacci/lib/shoes/drawables/slot.rb +178 -0
  169. data/lacci/lib/shoes/drawables/stack.rb +21 -0
  170. data/lacci/lib/shoes/drawables/star.rb +28 -0
  171. data/lacci/lib/shoes/drawables/subscription_item.rb +93 -0
  172. data/lacci/lib/shoes/drawables/text_drawable.rb +122 -0
  173. data/lacci/lib/shoes/drawables/video.rb +17 -0
  174. data/lacci/lib/shoes/drawables/widget.rb +74 -0
  175. data/lacci/lib/shoes/drawables.rb +32 -0
  176. data/lacci/lib/shoes/errors.rb +38 -0
  177. data/lacci/lib/shoes/log.rb +2 -2
  178. data/lacci/lib/shoes/margin_helper.rb +79 -0
  179. data/lacci/lib/shoes/ruby_extensions.rb +15 -0
  180. data/lacci/lib/shoes-spec.rb +93 -0
  181. data/lacci/lib/shoes.rb +31 -10
  182. data/lacci/test/.gitignore +1 -0
  183. data/lacci/test/test_draw_context.rb +167 -0
  184. data/lacci/test/test_font_helper.rb +57 -0
  185. data/lacci/test/test_helper.rb +81 -0
  186. data/lacci/test/test_lacci.rb +99 -3
  187. data/lacci/test/test_margin_helper.rb +82 -0
  188. data/lacci/test/test_niente_test_infra.rb +26 -0
  189. data/lacci/test/test_oval.rb +82 -0
  190. data/lacci/test/test_parenting.rb +140 -0
  191. data/lacci/test/test_shoes_errors.rb +49 -0
  192. data/lacci/test/test_text_drawables.rb +23 -0
  193. data/lib/scarpe/assets.rb +18 -0
  194. data/lib/scarpe/cats_cradle.rb +84 -103
  195. data/lib/scarpe/errors.rb +77 -0
  196. data/lib/scarpe/shoes_spec.rb +160 -0
  197. data/lib/scarpe/version.rb +2 -2
  198. data/lib/scarpe/wv/app.rb +21 -20
  199. data/lib/scarpe/wv/arc.rb +4 -51
  200. data/lib/scarpe/wv/arrow.rb +9 -0
  201. data/lib/scarpe/wv/border.rb +9 -18
  202. data/lib/scarpe/wv/button.rb +7 -35
  203. data/lib/scarpe/wv/check.rb +3 -5
  204. data/lib/scarpe/wv/control_interface.rb +20 -30
  205. data/lib/scarpe/wv/document_root.rb +81 -4
  206. data/lib/scarpe/wv/{widget.rb → drawable.rb} +71 -82
  207. data/lib/scarpe/wv/edit_box.rb +8 -18
  208. data/lib/scarpe/wv/edit_line.rb +9 -20
  209. data/lib/scarpe/wv/flow.rb +2 -18
  210. data/lib/scarpe/wv/image.rb +7 -30
  211. data/lib/scarpe/wv/line.rb +3 -25
  212. data/lib/scarpe/wv/link.rb +6 -17
  213. data/lib/scarpe/wv/list_box.rb +6 -29
  214. data/lib/scarpe/wv/oval.rb +13 -0
  215. data/lib/scarpe/wv/para.rb +12 -30
  216. data/lib/scarpe/wv/progress.rb +19 -0
  217. data/lib/scarpe/wv/radio.rb +9 -10
  218. data/lib/scarpe/wv/rect.rb +13 -0
  219. data/lib/scarpe/wv/scarpe_extensions.rb +8 -0
  220. data/lib/scarpe/wv/shape.rb +13 -13
  221. data/lib/scarpe/wv/slot.rb +8 -25
  222. data/lib/scarpe/wv/stack.rb +2 -18
  223. data/lib/scarpe/wv/star.rb +3 -53
  224. data/lib/scarpe/wv/subscription_item.rb +38 -4
  225. data/lib/scarpe/wv/text_drawable.rb +90 -0
  226. data/lib/scarpe/wv/video.rb +15 -15
  227. data/lib/scarpe/wv/web_wrangler.rb +320 -328
  228. data/lib/scarpe/wv/webview_local_display.rb +52 -33
  229. data/lib/scarpe/wv/webview_relay_display.rb +12 -12
  230. data/lib/scarpe/wv/webview_relay_util.rb +7 -10
  231. data/lib/scarpe/wv/wv_display_worker.rb +2 -2
  232. data/lib/scarpe/wv.rb +52 -12
  233. data/lib/scarpe/wv_local.rb +1 -1
  234. data/lib/scarpe/wv_relay.rb +1 -1
  235. data/lib/scarpe.rb +1 -0
  236. data/logger/debug_web_wrangler.json +1 -1
  237. data/logger/scarpe_wv_test.json +1 -1
  238. data/scarpe-components/Gemfile +4 -1
  239. data/scarpe-components/Gemfile.lock +85 -0
  240. data/scarpe-components/README.md +2 -2
  241. data/scarpe-components/assets/bootstrap-themes/bootstrap-cerulean.css +12229 -0
  242. data/scarpe-components/assets/bootstrap-themes/bootstrap-cosmo.css +11810 -0
  243. data/scarpe-components/assets/bootstrap-themes/bootstrap-cyborg.css +12210 -0
  244. data/scarpe-components/assets/bootstrap-themes/bootstrap-darkly.css +12153 -0
  245. data/scarpe-components/assets/bootstrap-themes/bootstrap-flatly.css +12126 -0
  246. data/scarpe-components/assets/bootstrap-themes/bootstrap-icons.min.css +5 -0
  247. data/scarpe-components/assets/bootstrap-themes/bootstrap-journal.css +12099 -0
  248. data/scarpe-components/assets/bootstrap-themes/bootstrap-litera.css +12211 -0
  249. data/scarpe-components/assets/bootstrap-themes/bootstrap-lumen.css +12369 -0
  250. data/scarpe-components/assets/bootstrap-themes/bootstrap-lux.css +11928 -0
  251. data/scarpe-components/assets/bootstrap-themes/bootstrap-materia.css +13184 -0
  252. data/scarpe-components/assets/bootstrap-themes/bootstrap-minty.css +12177 -0
  253. data/scarpe-components/assets/bootstrap-themes/bootstrap-morph.css +12750 -0
  254. data/scarpe-components/assets/bootstrap-themes/bootstrap-pulse.css +11890 -0
  255. data/scarpe-components/assets/bootstrap-themes/bootstrap-quartz.css +12622 -0
  256. data/scarpe-components/assets/bootstrap-themes/bootstrap-sandstone.css +12201 -0
  257. data/scarpe-components/assets/bootstrap-themes/bootstrap-simplex.css +12186 -0
  258. data/scarpe-components/assets/bootstrap-themes/bootstrap-sketchy.css +12451 -0
  259. data/scarpe-components/assets/bootstrap-themes/bootstrap-slate.css +12492 -0
  260. data/scarpe-components/assets/bootstrap-themes/bootstrap-solar.css +12149 -0
  261. data/scarpe-components/assets/bootstrap-themes/bootstrap-spacelab.css +12266 -0
  262. data/scarpe-components/assets/bootstrap-themes/bootstrap-superhero.css +12216 -0
  263. data/scarpe-components/assets/bootstrap-themes/bootstrap-united.css +12077 -0
  264. data/scarpe-components/assets/bootstrap-themes/bootstrap-vapor.css +12549 -0
  265. data/scarpe-components/assets/bootstrap-themes/bootstrap-yeti.css +12325 -0
  266. data/scarpe-components/assets/bootstrap-themes/bootstrap-zephyr.css +12283 -0
  267. data/scarpe-components/assets/bootstrap-themes/bootstrap.bundle.min.js +7 -0
  268. data/scarpe-components/lib/scarpe/components/asset_server.rb +219 -0
  269. data/scarpe-components/lib/scarpe/components/base64.rb +23 -5
  270. data/scarpe-components/lib/scarpe/components/calzini/alert.rb +49 -0
  271. data/scarpe-components/lib/scarpe/components/calzini/art_drawables.rb +227 -0
  272. data/scarpe-components/lib/scarpe/components/calzini/border.rb +38 -0
  273. data/scarpe-components/lib/scarpe/components/calzini/button.rb +37 -0
  274. data/scarpe-components/lib/scarpe/components/calzini/misc.rb +136 -0
  275. data/scarpe-components/lib/scarpe/components/calzini/para.rb +237 -0
  276. data/scarpe-components/lib/scarpe/components/calzini/slots.rb +109 -0
  277. data/scarpe-components/lib/scarpe/components/calzini.rb +236 -0
  278. data/scarpe-components/lib/scarpe/components/errors.rb +24 -0
  279. data/scarpe-components/lib/scarpe/components/file_helpers.rb +1 -0
  280. data/scarpe-components/lib/scarpe/components/html.rb +134 -0
  281. data/scarpe-components/lib/scarpe/components/minitest_export_reporter.rb +83 -0
  282. data/scarpe-components/lib/scarpe/components/minitest_import_runnable.rb +98 -0
  283. data/scarpe-components/lib/scarpe/components/minitest_result.rb +127 -0
  284. data/scarpe-components/lib/scarpe/components/modular_logger.rb +5 -5
  285. data/scarpe-components/lib/scarpe/components/print_logger.rb +22 -3
  286. data/scarpe-components/lib/scarpe/components/process_helpers.rb +37 -0
  287. data/scarpe-components/lib/scarpe/components/promises.rb +14 -14
  288. data/scarpe-components/lib/scarpe/components/segmented_file_loader.rb +36 -17
  289. data/scarpe-components/lib/scarpe/components/string_helpers.rb +10 -0
  290. data/scarpe-components/lib/scarpe/components/tiranti.rb +167 -0
  291. data/scarpe-components/lib/scarpe/components/unit_test_helpers.rb +48 -6
  292. data/scarpe-components/lib/scarpe/components/version.rb +2 -2
  293. data/scarpe-components/test/assets/big-image.png +0 -0
  294. data/scarpe-components/test/assets/big-stylesheet.css +497 -0
  295. data/scarpe-components/test/assets/little-image.png +0 -0
  296. data/scarpe-components/test/assets/little-stylesheet.css +1 -0
  297. data/scarpe-components/test/calzini/test_calzini_alert.rb +30 -0
  298. data/scarpe-components/test/calzini/test_calzini_art_drawables.rb +105 -0
  299. data/scarpe-components/test/calzini/test_calzini_button.rb +54 -0
  300. data/scarpe-components/test/calzini/test_calzini_misc.rb +115 -0
  301. data/scarpe-components/test/calzini/test_calzini_para.rb +34 -0
  302. data/scarpe-components/test/calzini/test_calzini_slots.rb +85 -0
  303. data/scarpe-components/test/calzini/test_calzini_text_drawables.rb +106 -0
  304. data/scarpe-components/test/calzini/test_various.rb +133 -0
  305. data/scarpe-components/test/mtr_data/exception.json +1 -0
  306. data/scarpe-components/test/mtr_data/fail_with_message.json +1 -0
  307. data/scarpe-components/test/mtr_data/skipped_no_message.json +1 -0
  308. data/scarpe-components/test/mtr_data/skipped_w_msg.json +1 -0
  309. data/scarpe-components/test/mtr_data/succeed_2_asserts.json +1 -0
  310. data/scarpe-components/test/test_asset_server.rb +72 -0
  311. data/scarpe-components/test/test_components.rb +31 -2
  312. data/scarpe-components/test/test_dimensions.rb +26 -0
  313. data/scarpe-components/test/test_helper.rb +20 -1
  314. data/scarpe-components/test/test_html.rb +65 -0
  315. data/scarpe-components/test/test_minitest_result.rb +68 -0
  316. data/scarpe-components/test/test_promises.rb +5 -4
  317. data/scarpe-components/test/test_segmented_app_files.rb +10 -6
  318. data/scarpegen.rb +14 -14
  319. data/sig/scarpe.rbs +1 -1
  320. data/tasks/check_html_fixtures.rb +140 -0
  321. data/tasks/regenerate_html_fixtures.rb +104 -0
  322. data/templates/basic_class_template.erb +13 -14
  323. data/templates/class_template_with_event_bind.erb +4 -4
  324. data/templates/class_template_with_shapes.erb +8 -28
  325. data/templates/example_template.erb +1 -1
  326. data/templates/module_template.erb +4 -4
  327. data/templates/webview_template.erb +3 -2
  328. metadata +286 -80
  329. data/examples/legacy/not_checked/shoes-contrib/elements/image-icon.rb +0 -3
  330. data/lacci/lib/shoes/spacing.rb +0 -9
  331. data/lacci/lib/shoes/widget.rb +0 -218
  332. data/lacci/lib/shoes/widgets/alert.rb +0 -19
  333. data/lacci/lib/shoes/widgets/arc.rb +0 -51
  334. data/lacci/lib/shoes/widgets/button.rb +0 -35
  335. data/lacci/lib/shoes/widgets/check.rb +0 -28
  336. data/lacci/lib/shoes/widgets/document_root.rb +0 -20
  337. data/lacci/lib/shoes/widgets/flow.rb +0 -22
  338. data/lacci/lib/shoes/widgets/font.rb +0 -14
  339. data/lacci/lib/shoes/widgets/line.rb +0 -18
  340. data/lacci/lib/shoes/widgets/link.rb +0 -25
  341. data/lacci/lib/shoes/widgets/list_box.rb +0 -25
  342. data/lacci/lib/shoes/widgets/para.rb +0 -68
  343. data/lacci/lib/shoes/widgets/radio.rb +0 -35
  344. data/lacci/lib/shoes/widgets/slot.rb +0 -75
  345. data/lacci/lib/shoes/widgets/span.rb +0 -26
  346. data/lacci/lib/shoes/widgets/stack.rb +0 -24
  347. data/lacci/lib/shoes/widgets/star.rb +0 -44
  348. data/lacci/lib/shoes/widgets/subscription_item.rb +0 -60
  349. data/lacci/lib/shoes/widgets/text_widget.rb +0 -51
  350. data/lacci/lib/shoes/widgets/video.rb +0 -15
  351. data/lacci/lib/shoes/widgets.rb +0 -29
  352. data/lib/scarpe/evented_assertions.rb +0 -88
  353. data/lib/scarpe/wv/alert.rb +0 -66
  354. data/lib/scarpe/wv/background.rb +0 -27
  355. data/lib/scarpe/wv/control_interface_test.rb +0 -238
  356. data/lib/scarpe/wv/dimensions.rb +0 -22
  357. data/lib/scarpe/wv/font.rb +0 -36
  358. data/lib/scarpe/wv/html.rb +0 -108
  359. data/lib/scarpe/wv/spacing.rb +0 -41
  360. data/lib/scarpe/wv/span.rb +0 -68
  361. data/lib/scarpe/wv/text_widget.rb +0 -30
  362. /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/definr.rb +0 -0
  363. /data/examples/legacy/not_checked/{expert → shoes-contrib/basic}/funnies.rb +0 -0
  364. /data/examples/legacy/not_checked/shoes-contrib/{elements → basic}/list_box-select-class.rb +0 -0
  365. /data/examples/legacy/{not_checked → working}/shoes3-tests/editline/editline.rb +0 -0
  366. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/basic-edit-box.rb +0 -0
  367. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/basic-fps.rb +0 -0
  368. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/border-cat.rb +0 -0
  369. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/check-mate.rb +0 -0
  370. /data/examples/legacy/{not_checked/shoes-contrib/manipulation → working/simple}/clear-slot.rb +0 -0
  371. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/clock.rb +0 -0
  372. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/gradient-shoes.rb +0 -0
  373. /data/examples/legacy/{not_checked/shoes-contrib/basic → working/simple}/list_box-shape-report.rb +0 -0
  374. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/list_box.rb +0 -0
  375. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/phat-button.rb +0 -0
  376. /data/examples/legacy/{not_checked/shoes-contrib → working}/simple/simple-calc.rb +0 -0
  377. /data/examples/legacy/{not_checked/shoes-contrib/position → working/simple}/stack-width.rb +0 -0
  378. /data/examples/legacy/{not_checked/shoes-contrib/elements → working/simple}/width-introspec.rb +0 -0
@@ -0,0 +1,105 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ class TestCalziniArtDrawables < Minitest::Test
6
+ def setup
7
+ @calzini = CalziniRenderer.new
8
+ end
9
+
10
+ def assert_start_and_finish(start, finish, value)
11
+ assert value.start_with?(start),
12
+ "Expected string to start with correct prefix... prefix: #{start.inspect} Value: #{value.inspect}"
13
+ assert value.end_with?(finish),
14
+ "Expected string to end with correct suffix... suffix: #{finish.inspect} Value: #{value.inspect}"
15
+ end
16
+
17
+ def test_arc_example
18
+ arc_example = @calzini.render(
19
+ "arc",
20
+ {
21
+ "width" => 200,
22
+ "height" => 150,
23
+ "left" => 17,
24
+ "top" => 42,
25
+ "angle1" => 3.14 / 2,
26
+ "angle2" => 3.14 / 4,
27
+ },
28
+ )
29
+ ex_html_start = %{<div id="elt-1" style="position:absolute;top:42px;left:17px;width:200px;height:150px"><svg width="200" height="150"><path d="M100 75 L200 75 A100 75 0 1 0 170.73882691671997 128.01188858290243 Z" transform="rotate(, 100, 75)" /></svg></div>}
30
+ ex_html_end = %{" /></svg></div>}
31
+ assert_start_and_finish(ex_html_start, ex_html_end, arc_example)
32
+ end
33
+
34
+ def test_line_example
35
+ assert_equal %{<div id="elt-1" style="position:absolute;top:4px;left:7px">} +
36
+ %{<svg width="100" height="104"><line x1="7" y1="4" x2="100" y2="104" style="stroke:black;stroke-width:4">} +
37
+ %{</line></svg></div>},
38
+ @calzini.render("line", { "top" => "4", "left" => "7", "x1" => "20", "y1" => "17", "x2" => "100", "y2" => "104" })
39
+ end
40
+
41
+ def test_line_draw_context
42
+ assert_equal %{<div id="elt-1" style="position:absolute;top:4px;left:7px">} +
43
+ %{<svg width="100" height="104"><line x1="7" y1="4" x2="100" y2="104" style="stroke:red;stroke-width:4">} +
44
+ %{</line></svg></div>},
45
+ @calzini.render(
46
+ "line",
47
+ { "top" => "4", "left" => "7", "x1" => "20", "y1" => "17", "x2" => "100", "y2" => "104", "draw_context" => { "stroke" => "red" } },
48
+ )
49
+ end
50
+
51
+ def test_line_hidden
52
+ assert_equal %{<div id="elt-1" style="display:none;position:absolute;top:4px;left:7px">} +
53
+ %{<svg width="100" height="104"><line x1="7" y1="4" x2="100" y2="104" style="stroke:black;stroke-width:4">} +
54
+ %{</line></svg></div>},
55
+ @calzini.render("line", { "top" => "4", "left" => "7", "x1" => "20", "y1" => "17", "x2" => "100", "y2" => "104", "hidden" => true })
56
+ end
57
+
58
+ def test_rect_default_stroke
59
+ assert_equal %{<div id="elt-1" style="display:none;position:absolute;top:9;left:12;width:147;height:91">} +
60
+ %{<svg width="147" height="91"><rect x="12" y="9" width="147" height="91" transform="rotate( 73 45)" />} +
61
+ %{</svg></div>},
62
+ @calzini.render("rect", { "top" => "9", "left" => "12", "width" => "147", "height" => "91", "draw_context" => {}, "hidden" => true })
63
+ end
64
+
65
+ def test_rect_round_corners
66
+ assert_equal %{<div id="elt-1" style="display:none;position:absolute;top:9;left:12;width:147;height:91">} +
67
+ %{<svg width="177" height="121"><rect x="12" y="9" width="147" height="91" style="stroke:red" rx="15" transform="rotate( 88 60)" />} +
68
+ %{</svg></div>},
69
+ @calzini.render(
70
+ "rect",
71
+ {
72
+ "top" => "9",
73
+ "left" => "12",
74
+ "width" => "147",
75
+ "height" => "91",
76
+ "curve" => "15",
77
+ "draw_context" => { "stroke" => "red" },
78
+ "hidden" => true,
79
+ },
80
+ )
81
+ end
82
+
83
+ def test_rect_hidden
84
+ assert_equal %{<div id="elt-1" style="display:none;position:absolute;top:4;left:7;width:20;height:17">} +
85
+ %{<svg width="20" height="17"><rect x="7" y="4" width="20" height="17" transform="rotate( 10 8)" />} +
86
+ %{</svg></div>},
87
+ @calzini.render("rect", { "top" => "4", "left" => "7", "width" => "20", "height" => "17", "hidden" => true })
88
+ end
89
+
90
+ def test_star_simple
91
+ start = %{<div id="elt-1"><svg width="2.0" height="2.0" style="fill:black"><polygon points="2.0,1.0,1.4}
92
+ finish = %{" style="stroke:black;stroke-width:2" /></svg></div>}
93
+ assert_start_and_finish start,
94
+ finish,
95
+ @calzini.render("star", { "points" => 5, "outer" => 2.0, "inner" => 1.0 })
96
+ end
97
+
98
+ def test_star_colors
99
+ start = %{<div id="elt-1"><svg width="2.0" height="2.0" style="fill:red"><polygon points="2.0,1.0,1.4}
100
+ finish = %{" style="stroke:green;stroke-width:2" /></svg></div>}
101
+ assert_start_and_finish start,
102
+ finish,
103
+ @calzini.render("star", { "points" => 5, "outer" => 2.0, "inner" => 1.0, "draw_context" => { "fill" => "red", "stroke" => "green" } })
104
+ end
105
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ class TestCalziniButton < Minitest::Test
6
+ def setup
7
+ @calzini = CalziniRenderer.new
8
+ end
9
+
10
+ def test_button_defaults
11
+ assert_equal %{<button id="elt-1" onclick="handle('click')" onmouseover="handle('hover')"></button>}, @calzini.render("button", {})
12
+ end
13
+
14
+ def test_button_with_html_class
15
+ assert_equal %{<button id="elt-1" onclick="handle('click')" onmouseover="handle('hover')" class="buttonish"></button>}, @calzini.render("button", { "html_class" => "buttonish" })
16
+ end
17
+
18
+ def test_button_all_standard_properties_set
19
+ props = {
20
+ "color" => "red",
21
+ "padding_top" => "4",
22
+ "padding_bottom" => "5",
23
+ "text_color" => "blue",
24
+ "width" => 201,
25
+ "height" => 203,
26
+ "font_size" => "14",
27
+ "top" => "10",
28
+ "left" => "11",
29
+ "size" => "17",
30
+ "font" => "Lucida",
31
+ }
32
+ assert_equal %{<button id="elt-1" onclick="handle('click')" onmouseover="handle('hover')" } +
33
+ %{style="position:absolute;top:10;left:11;width:201px;height:203px;padding-top:4;padding-bottom:5;background-color:red;color:blue;font-size:17px;font-family:Lucida"></button>},
34
+ @calzini.render("button", props)
35
+ end
36
+
37
+ def test_button_all_standard_properties_nil
38
+ props = {
39
+ "color" => nil,
40
+ "padding_top" => nil,
41
+ "padding_bottom" => nil,
42
+ "text_color" => nil,
43
+ "width" => nil,
44
+ "height" => nil,
45
+ "font_size" => nil,
46
+ "top" => nil,
47
+ "left" => nil,
48
+ "size" => nil,
49
+ "font" => nil,
50
+ "stroke" => nil,
51
+ }
52
+ assert_equal %{<button id="elt-1" onclick="handle('click')" onmouseover="handle('hover')"></button>}, @calzini.render("button", props)
53
+ end
54
+ end
@@ -0,0 +1,115 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ class TestCalziniMiscDrawables < Minitest::Test
6
+ def setup
7
+ @calzini = CalziniRenderer.new
8
+ end
9
+
10
+ def test_checkbox_checked
11
+ assert_equal %{<input type="checkbox" id="elt-1" onclick="handle('click')" value="done?" checked="true" />},
12
+ @calzini.render("check", { "text" => "done?", "checked" => true })
13
+ end
14
+
15
+ def test_checkbox_unchecked
16
+ assert_equal %{<input type="checkbox" id="elt-1" onclick="handle('click')" value="done?" checked="false" />},
17
+ @calzini.render("check", { "text" => "done?", "checked" => false })
18
+ end
19
+
20
+ def test_checkbox_hidden
21
+ assert_equal %{<input type="checkbox" id="elt-1" onclick="handle('click')" value="done?" checked="true" style="display:none" />},
22
+ @calzini.render("check", { "text" => "done?", "checked" => true, "hidden" => true })
23
+ end
24
+
25
+ def test_edit_box_default
26
+ assert_equal %{<textarea id="elt-1" oninput="handle('change', this.value)" onmouseover="handle('hover')"></textarea>},
27
+ @calzini.render("edit_box", {})
28
+ end
29
+
30
+ def test_edit_box_hidden
31
+ assert_equal %{<textarea id="elt-1" oninput="handle('change', this.value)" onmouseover="handle('hover')" style="display:none"></textarea>},
32
+ @calzini.render("edit_box", { "hidden" => true })
33
+ end
34
+
35
+ def test_edit_box_simple
36
+ assert_equal %{<textarea id="elt-1" oninput="handle('change', this.value)" onmouseover="handle('hover')" style="width:75;height:50">default</textarea>},
37
+ @calzini.render("edit_box", { "height" => "50", "width" => "75", "text" => "default" })
38
+ end
39
+
40
+ def test_edit_line_default
41
+ assert_equal %{<input id="elt-1" oninput="handle('change', this.value)" onmouseover="handle('hover')" style="font:;color:" />},
42
+ @calzini.render("edit_line", {})
43
+ end
44
+
45
+ def test_edit_line_hidden
46
+ assert_equal %{<input id="elt-1" oninput="handle('change', this.value)" onmouseover="handle('hover')" style="display:none;font:;color:" />},
47
+ @calzini.render("edit_line", { "hidden" => true })
48
+ end
49
+
50
+ def test_edit_line_simple
51
+ assert_equal %{<input id="elt-1" oninput="handle('change', this.value)" onmouseover="handle('hover')" value="(default)" style="width:200;font:;color:" />},
52
+ @calzini.render("edit_line", { "width" => "200", "text" => "(default)" })
53
+ end
54
+
55
+ def test_image_simple
56
+ assert_equal %{<img id="elt-1" src="https://example.com/example.png" />},
57
+ @calzini.render("image", { "url" => "https://example.com/example.png" })
58
+ end
59
+
60
+ def test_image_with_click
61
+ assert_equal %{<a id="elt-1" href="https://google.com"><img id="elt-1" src="https://example.com/example.png" style="width:150;height:200" /></a>},
62
+ @calzini.render("image", { "url" => "https://example.com/example.png", "height" => "200", "width" => "150", "click" => "https://google.com" })
63
+ end
64
+
65
+ def test_image_with_abs_positioning
66
+ assert_equal %{<img id="elt-1" src="https://example.com/example.png" style="position:absolute;top:15;left:20;width:150;height:200" />},
67
+ @calzini.render("image", { "url" => "https://example.com/example.png", "height" => "200", "width" => "150", "top" => "15", "left" => "20" })
68
+ end
69
+
70
+ def test_list_box_empty
71
+ assert_equal %{<select id="elt-1" onchange="handle('change', this.options[this.selectedIndex].value)"></select>},
72
+ @calzini.render("list_box", {})
73
+ end
74
+
75
+ def test_list_box_simple
76
+ assert_equal %{<select id="elt-1" onchange="handle('change', this.options[this.selectedIndex].value)"} +
77
+ %{ style="width:150;height:75"><option value="dog">dog</option>} +
78
+ %{<option value="cat" selected="true">cat</option><option value="bird">bird</option></select>},
79
+ @calzini.render("list_box", { "height" => "75", "width" => "150", "items" => ["dog", "cat", "bird"], "choose" => "cat" })
80
+ end
81
+
82
+ def test_list_box_none_selected
83
+ assert_equal %{<select id="elt-1" onchange="handle('change', this.options[this.selectedIndex].value)"} +
84
+ %{ style="width:150;height:75"><option value="dog">dog</option>} +
85
+ %{<option value="cat">cat</option><option value="bird">bird</option></select>},
86
+ @calzini.render("list_box", { "height" => "75", "width" => "150", "items" => ["dog", "cat", "bird"] })
87
+ end
88
+
89
+ def test_list_box_just_items
90
+ assert_equal %{<select id="elt-1" onchange="handle('change', this.options[this.selectedIndex].value)">} +
91
+ %{<option value="dog">dog</option>} +
92
+ %{<option value="cat">cat</option><option value="bird">bird</option></select>},
93
+ @calzini.render("list_box", { "items" => ["dog", "cat", "bird"] })
94
+ end
95
+
96
+ def test_radio_minimal
97
+ assert_equal %{<input type="radio" id="elt-1" onclick="handle('click')" name="no_group" />},
98
+ @calzini.render("radio", {})
99
+ end
100
+
101
+ def test_radio_group
102
+ assert_equal %{<input type="radio" id="elt-1" onclick="handle('click')" name="boba" />},
103
+ @calzini.render("radio", { "group" => "boba" })
104
+ end
105
+
106
+ def test_radio_checked
107
+ assert_equal %{<input type="radio" id="elt-1" onclick="handle('click')" name="boba" checked="true" />},
108
+ @calzini.render("radio", { "group" => "boba", "checked" => true })
109
+ end
110
+
111
+ def test_video_simple
112
+ assert_equal %{<video id="elt-1" controls="true"><source type="video/mp4" /></video>},
113
+ @calzini.render("video", { "url" => "http://techslides.com/demos/sample-videos/small.mp4", "format" => "video/mp4" })
114
+ end
115
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ class TestCalziniPara < Minitest::Test
6
+ def setup
7
+ @calzini = CalziniRenderer.new
8
+ end
9
+
10
+ def test_para_simple
11
+ assert_equal %{<p id="elt-1">OK</p>},
12
+ @calzini.render("para", {}) { "OK" }
13
+ end
14
+
15
+ def test_para_with_align
16
+ assert_equal %{<div id=\"elt-1\" style=\"text-align:right;width:100%\"><p>OK</p></div>},
17
+ @calzini.render("para", { "align" => "right" }) { "OK" }
18
+ end
19
+
20
+ def test_para_with_stroke_and_font
21
+ assert_equal %{<p id="elt-1" style="color:#FF0000;font-family:Lucida">OK</p>},
22
+ @calzini.render("para", { "stroke" => [1.0, 0.0, 0.0], "family" => "Lucida" }) { "OK" }
23
+ end
24
+
25
+ def test_para_with_string_banner
26
+ assert_equal %{<p id="elt-1" style="font-size:48px"></p>},
27
+ @calzini.render("para", { "size" => "banner" })
28
+ end
29
+
30
+ def test_para_with_symbol_banner
31
+ assert_equal %{<p id="elt-1" style="font-size:48px"></p>},
32
+ @calzini.render("para", { "size" => :banner })
33
+ end
34
+ end
@@ -0,0 +1,85 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ class TestCalziniSlots < Minitest::Test
6
+ def setup
7
+ @calzini = CalziniRenderer.new
8
+ @stack_default_style = %{display:flex;flex-direction:column;align-content:flex-start;justify-content:flex-start;align-items:flex-start}
9
+ @flow_default_style = %{display:flex;flex-direction:row;flex-wrap:wrap;align-content:flex-start;justify-content:flex-start;align-items:flex-start}
10
+ @inner_div_tag = %{<div style="height:100%;width:100%;position:relative">}
11
+ end
12
+
13
+ def test_stack_simple
14
+ assert_equal %{<div id="elt-1" } +
15
+ %{style="#{@stack_default_style}">} +
16
+ %{#{@inner_div_tag}contents</div></div>},
17
+ @calzini.render("stack", {}) { "contents" }
18
+ end
19
+
20
+ def test_flow_simple
21
+ assert_equal %{<div id="elt-1" } +
22
+ %{style="#{@flow_default_style}">} +
23
+ %{#{@inner_div_tag}contents</div></div>},
24
+ @calzini.render("flow", {}) { "contents" }
25
+ end
26
+
27
+ def test_docroot_simple
28
+ assert_equal %{<div id="elt-1" } +
29
+ %{style="#{@flow_default_style}">} +
30
+ %{#{@inner_div_tag}contents</div></div>},
31
+ @calzini.render("documentroot", {}) { "contents" }
32
+ end
33
+
34
+ def test_stack_border_plain_color
35
+ assert_equal %{<div id="elt-1" } +
36
+ %{style="#{@stack_default_style};border-style:solid;border-width:1px;border-radius:0px;border-color:red">} +
37
+ %{#{@inner_div_tag}contents</div></div>},
38
+ @calzini.render("stack", { "border_color" => "red" }) { "contents" }
39
+ end
40
+
41
+ def test_stack_border_gradient
42
+ assert_equal %{<div id="elt-1" } +
43
+ %{style="#{@stack_default_style};border-style:solid;border-width:1px;border-radius:0px;border-image:linear-gradient(45deg, red, green)">} +
44
+ %{#{@inner_div_tag}contents</div></div>},
45
+ @calzini.render("stack", { "border_color" => ("red".."green") }) { "contents" }
46
+ end
47
+
48
+ def test_stack_border_rgba
49
+ assert_equal %{<div id="elt-1" } +
50
+ %{style="#{@stack_default_style};border-style:solid;border-width:1px;border-radius:0px;border-color:rgba(1.0, 0.0, 0.0, 1.0)">} +
51
+ %{#{@inner_div_tag}contents</div></div>},
52
+ @calzini.render("stack", { "border_color" => [1.0, 0.0, 0.0, 1.0] }) { "contents" }
53
+ end
54
+
55
+ def test_stack_border_attrs
56
+ assert_equal %{<div id="elt-1" } +
57
+ %{style="#{@stack_default_style};border-style:solid;border-width:3px;border-radius:2px;border-color:red">} +
58
+ %{#{@inner_div_tag}contents</div></div>},
59
+ @calzini.render("stack", { "border_color" => "red", "options" => { "strokewidth" => 3, "curve" => 2 } }) { "contents" }
60
+ end
61
+
62
+
63
+ def test_stack_padding
64
+ assert_equal %{<div id="elt-1" } +
65
+ %{style="#{@stack_default_style};padding:25px">} +
66
+ %{#{@inner_div_tag}contents</div></div>},
67
+ @calzini.render("stack", { "padding" => 25 }) { "contents" }
68
+ end
69
+
70
+ def test_stack_options_padding
71
+ assert_equal %{<div id="elt-1" } +
72
+ %{style="#{@stack_default_style};padding:15px">} +
73
+ %{#{@inner_div_tag}contents</div></div>},
74
+ @calzini.render("stack", { "options" => { "padding" => 15 } }) { "contents" }
75
+ end
76
+
77
+ def test_stack_padding_overrides_options
78
+ assert_equal %{<div id="elt-1" } +
79
+ %{style="#{@stack_default_style};padding:25px">} +
80
+ %{#{@inner_div_tag}contents</div></div>},
81
+ @calzini.render("stack", { "padding" => 25, "options" => { "padding" => 15 } }) { "contents" }
82
+ end
83
+
84
+
85
+ end
@@ -0,0 +1,106 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ class TestCalziniTextDrawables < Minitest::Test
6
+ def setup
7
+ @calzini = CalziniRenderer.new
8
+ end
9
+
10
+ def trim_html_ids(s)
11
+ s.gsub(/ class="id_\d+"/, "")
12
+ end
13
+
14
+ def test_text_only_drawable
15
+ assert_equal %{this is text},
16
+ @calzini.render("text_drawable", ["this ", "is", " text"])
17
+ end
18
+
19
+ def test_simple_text_drawable_with_em
20
+ assert_equal %{this <em class="id_1">is</em> text},
21
+ @calzini.render("text_drawable",
22
+ ["this ", { tag: "em", html_id: "1", items: ["is"], props: {}}, " text"])
23
+ end
24
+
25
+ # Span doesn't have default properties, so it's good for testing how a property is rendered
26
+ def test_simple_text_drawable_with_span_styles
27
+ assert_equal %{this <span style="color:#FF00FF;background-color:#0000FF;font-size:13px;font-family:Lucida">is</span> text},
28
+ trim_html_ids(@calzini.render("text_drawable",
29
+ ["this ", {
30
+ tag: "span",
31
+ html_id: "1",
32
+ items: ["is"],
33
+ props: {
34
+ "family" => "Lucida",
35
+ "size" => 13,
36
+ "stroke" => "#FF00FF",
37
+ "fill" => "#0000FF"
38
+ }
39
+ }, " text"]))
40
+ end
41
+
42
+ def test_link_with_has_block
43
+ assert_equal %{this <a onclick="handle('click')">is</a> text},
44
+ trim_html_ids(@calzini.render("text_drawable",
45
+ ["this ", {
46
+ tag: "a",
47
+ html_id: "1",
48
+ items: ["is"],
49
+ props: {
50
+ "has_block" => true,
51
+ }
52
+ }, " text"]))
53
+ end
54
+
55
+ def test_link_with_click
56
+ assert_equal %{this <a href="#" onclick="handle('click')">is</a> text},
57
+ trim_html_ids(@calzini.render("text_drawable",
58
+ ["this ", {
59
+ tag: "a",
60
+ html_id: "1",
61
+ items: ["is"],
62
+ props: {
63
+ "has_block" => true,
64
+ "click" => "#",
65
+ }
66
+ }, " text"]))
67
+ end
68
+
69
+ def test_del_tag
70
+ assert_equal %{this <del>is</del> text},
71
+ trim_html_ids(@calzini.render("text_drawable",
72
+ ["this ", {
73
+ tag: "del",
74
+ html_id: "1",
75
+ items: ["is"],
76
+ props: {
77
+ }
78
+ }, " text"]))
79
+ end
80
+
81
+ def test_single_strikethrough
82
+ assert_equal %{this <span style="text-decoration-line:line-through">is</span> text},
83
+ trim_html_ids(@calzini.render("text_drawable",
84
+ ["this ", {
85
+ tag: "span",
86
+ html_id: "1",
87
+ items: ["is"],
88
+ props: {
89
+ "strikethrough" => "single",
90
+ }
91
+ }, " text"]))
92
+ end
93
+
94
+ def test_single_strikethrough_none
95
+ assert_equal %{this <span>is</span> text},
96
+ trim_html_ids(@calzini.render("text_drawable",
97
+ ["this ", {
98
+ tag: "span",
99
+ html_id: "1",
100
+ items: ["is"],
101
+ props: {
102
+ "strikethrough" => "none",
103
+ }
104
+ }, " text"]))
105
+ end
106
+ end
@@ -0,0 +1,133 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "../test_helper"
4
+
5
+ # Some tests don't cover just a single drawable.
6
+ class TestVariousCalzini < Minitest::Test
7
+ def setup
8
+ @calzini = CalziniRenderer.new
9
+ end
10
+
11
+ # Test data. For each drawable, include
12
+ # a minimal set of properties to create something
13
+ # basic and default. Then we can add to it and
14
+ # test the resulting HTML.
15
+ #
16
+ # In Shoes3, the vast majority of drawables support
17
+ # both stroke and fill. Here's the list from the
18
+ # Shoes manual minus the ones we already test here:
19
+ #
20
+ # background, banner, caption,
21
+ # code, del, em, flow, image, ins, inscription,
22
+ # link, mask, para, shape, span, stack,
23
+ # strong, sub, sup, subtitle, tagline, title
24
+ #
25
+ # Scarpe doesn't yet support the property on everything.
26
+ # but as we support it, we should add the drawables
27
+ # here.
28
+ #
29
+ CALZINI_ART_DRAWABLES = {
30
+ arc: {
31
+ has_stroke: false,
32
+ has_fill: false,
33
+ props: {
34
+ "width" => 200,
35
+ "height" => 150,
36
+ "left" => 17,
37
+ "top" => 42,
38
+ "angle1" => 3.14 / 2,
39
+ "angle2" => 3.14 / 4,
40
+ },
41
+ },
42
+ arrow: {
43
+ has_stroke: true,
44
+ has_fill: true,
45
+ props: {
46
+ "left" => 10,
47
+ "top" => 20,
48
+ "width" => 5,
49
+ },
50
+ },
51
+ line: {
52
+ has_stroke: true,
53
+ has_fill: false,
54
+ props: {
55
+ "top" => "4",
56
+ "left" => "7",
57
+ "x1" => "20",
58
+ "y1" => "17",
59
+ "x2" => "100",
60
+ "y2" => "104",
61
+ },
62
+ },
63
+ rect: {
64
+ has_stroke: true,
65
+ has_fill: true,
66
+ props: {
67
+ "top" => "9",
68
+ "left" => "12",
69
+ "width" => "147",
70
+ "height" => "91",
71
+ "draw_context" => {},
72
+ },
73
+ },
74
+ star: {
75
+ has_stroke: true,
76
+ has_fill: true,
77
+ props: {
78
+ "points" => 5,
79
+ "outer" => 2.0,
80
+ "inner" => 1.0,
81
+ },
82
+ },
83
+ oval: {
84
+ has_stroke: true,
85
+ has_fill: true,
86
+ props: {
87
+ "left" => 10,
88
+ "top" => 7,
89
+ "radius" => 5,
90
+ },
91
+ },
92
+ }
93
+
94
+ # This method tests some basic ways of setting strokes and fills and makes sure they
95
+ # work for different drawables. TODO: add more drawables. TODO: either add testing for
96
+ # setting stroke and fill directly vs. draw-context, or remove draw-context.
97
+ def test_color_conversion
98
+ CALZINI_ART_DRAWABLES.each do |name, h|
99
+ basic = @calzini.render(name.to_s, h[:props])
100
+ assert !basic.include?("#FF0000"), "Un-colored #{name} shouldn't already have red or we'll get a false positive!"
101
+
102
+ if h[:has_stroke]
103
+ red_stroke = @calzini.render(name.to_s, h[:props].merge("stroke" => [255, 0, 0, 255]))
104
+ assert_includes red_stroke, "#FF0000", "With integer-array red stroke, #{name} should contain red color!"
105
+
106
+ red_stroke = @calzini.render(name.to_s, h[:props].merge("draw_context" => { "stroke" => [255, 0, 0, 255] }))
107
+ assert_includes red_stroke, "#FF0000", "With integer-array red stroke, #{name} should contain red color!"
108
+
109
+ red_stroke = @calzini.render(name.to_s, h[:props].merge("stroke" => [255, 0, 0, 255], "draw_context" => { "stroke" => [0, 255, 0, 255] }))
110
+ assert_includes red_stroke, "#FF0000", "Red stroke should take precedence over green, #{name} should contain red color!"
111
+
112
+ # TODO: later, after issue #504 is fixed, colors should turn into their hex equivalent
113
+ red_stroke = @calzini.render(name.to_s, h[:props].merge("stroke" => "red"))
114
+ assert_includes red_stroke, "red", "With integer-array red stroke, #{name} should contain red color!"
115
+ end
116
+
117
+ if h[:has_fill]
118
+ red_fill = @calzini.render(name.to_s, h[:props].merge("fill" => [255, 0, 0, 255]))
119
+ assert_includes red_fill, "#FF0000", "With integer-array red fill, #{name} should contain red color!"
120
+
121
+ red_fill = @calzini.render(name.to_s, h[:props].merge("draw_context" => { "fill" => [255, 0, 0, 255] }))
122
+ assert_includes red_fill, "#FF0000", "With integer-array red fill, #{name} should contain red color!"
123
+
124
+ red_fill = @calzini.render(name.to_s, h[:props].merge("fill" => [255, 0, 0, 255], "draw_context" => { "fill" => [0, 255, 0, 255] }))
125
+ assert_includes red_fill, "#FF0000", "Red fill should take precedence over green, #{name} should contain red color!"
126
+
127
+ # TODO: later, after issue #504 is fixed, colors should turn into their hex equivalent
128
+ red_fill = @calzini.render(name.to_s, h[:props].merge("fill" => "red"))
129
+ assert_includes red_fill, "red", "With integer-array red fill, #{name} should contain red color!"
130
+ end
131
+ end
132
+ end
133
+ end
@@ -0,0 +1 @@
1
+ [{"name":"test_sspec","klass":"TestListBoxShoesSpecIntegration","assertions":0,"failures":[["unexpected","{\"json_class\":\"Minitest::UnexpectedError\",\"m\":\"RuntimeError: This is an exception\\n (eval):1:in `block in run_shoes_spec_test_code'\\n /Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `eval'\\n /Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `block in run_shoes_spec_test_code'\",\"b\":[\"(eval):1:in `block in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `block in run_shoes_spec_test_code'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:102:in `block (3 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:199:in `capture_exceptions'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:97:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:296:in `time_it'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:96:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:247:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:95:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-reporters-1.6.0/lib/minitest/reporters.rb:48:in `run_with_hooks'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:1051:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:365:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:352:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `each'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:378:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:350:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `block in __run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `map'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `__run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:159:in `run'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:51:in `block (2 levels) in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `instance_eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `block in on_event'\"]}","{\"json_class\":\"RuntimeError\",\"m\":\"This is an exception\",\"b\":[\"(eval):1:in `block in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:62:in `block in run_shoes_spec_test_code'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:102:in `block (3 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:199:in `capture_exceptions'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:97:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:296:in `time_it'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:96:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:247:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest/test.rb:95:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-reporters-1.6.0/lib/minitest/reporters.rb:48:in `run_with_hooks'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:1051:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:365:in `run_one_method'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:352:in `block (2 levels) in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `each'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:351:in `block in run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:391:in `on_signal'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:378:in `with_info_handler'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:350:in `run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `block in __run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `map'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:182:in `__run'\",\"/Users/noah/.gem/ruby/3.2.2/gems/minitest-5.18.0/lib/minitest.rb:159:in `run'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb:51:in `block (2 levels) in run_shoes_spec_test_code'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `instance_eval'\",\"/Users/noah/src/shoes/scarpe/lib/scarpe/cats_cradle.rb:164:in `block in on_event'\"]}"]],"time":0.00011800043284893036,"metadata":{},"source_location":["/Users/noah/src/shoes/scarpe/lib/scarpe/shoes_spec.rb",61]}]