shoes-swt 4.0.0.pre2 → 4.0.0.pre3

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 (227) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +5 -200
  3. data/Rakefile +1 -0
  4. data/bin/shoes-swt +11 -0
  5. data/lib/shoes/swt.rb +5 -2
  6. data/lib/shoes/swt/animation.rb +2 -2
  7. data/lib/shoes/swt/app.rb +45 -50
  8. data/lib/shoes/swt/arc.rb +7 -7
  9. data/lib/shoes/swt/background.rb +1 -1
  10. data/lib/shoes/swt/border.rb +1 -2
  11. data/lib/shoes/swt/click_listener.rb +70 -0
  12. data/lib/shoes/swt/color.rb +5 -5
  13. data/lib/shoes/swt/common/clickable.rb +2 -53
  14. data/lib/shoes/swt/common/fill.rb +1 -1
  15. data/lib/shoes/swt/common/painter.rb +7 -7
  16. data/lib/shoes/swt/common/painter_updates_position.rb +2 -2
  17. data/lib/shoes/swt/common/remove.rb +2 -3
  18. data/lib/shoes/swt/common/resource.rb +1 -1
  19. data/lib/shoes/swt/common/selection_listener.rb +14 -14
  20. data/lib/shoes/swt/common/stroke.rb +1 -2
  21. data/lib/shoes/swt/common/update_position.rb +1 -1
  22. data/lib/shoes/swt/dialog.rb +3 -45
  23. data/lib/shoes/swt/disposed_protection.rb +1 -1
  24. data/lib/shoes/swt/download.rb +0 -1
  25. data/lib/shoes/swt/font.rb +4 -4
  26. data/lib/shoes/swt/generate-backend.rb +9 -0
  27. data/lib/shoes/swt/gradient.rb +17 -16
  28. data/lib/shoes/swt/image.rb +3 -5
  29. data/lib/shoes/swt/image_pattern.rb +2 -2
  30. data/lib/shoes/swt/input_box.rb +3 -3
  31. data/lib/shoes/swt/key_listener.rb +6 -6
  32. data/lib/shoes/swt/line.rb +4 -24
  33. data/lib/shoes/swt/link.rb +2 -2
  34. data/lib/shoes/swt/link_segment.rb +3 -3
  35. data/lib/shoes/swt/list_box.rb +4 -4
  36. data/lib/shoes/swt/mouse_move_listener.rb +6 -5
  37. data/lib/shoes/swt/oval.rb +2 -3
  38. data/lib/shoes/swt/packager.rb +82 -0
  39. data/lib/shoes/swt/progress.rb +2 -2
  40. data/lib/shoes/swt/radio.rb +0 -2
  41. data/lib/shoes/swt/radio_group.rb +54 -54
  42. data/lib/shoes/swt/rect_painter.rb +7 -7
  43. data/lib/shoes/swt/redrawing_aspect.rb +32 -34
  44. data/lib/shoes/swt/shape.rb +1 -1
  45. data/lib/shoes/swt/shoes_layout.rb +5 -2
  46. data/lib/shoes/swt/slot.rb +2 -3
  47. data/lib/shoes/swt/sound.rb +17 -22
  48. data/lib/shoes/swt/star.rb +30 -8
  49. data/lib/shoes/swt/swt_button.rb +3 -2
  50. data/lib/shoes/swt/text_block.rb +3 -3
  51. data/lib/shoes/swt/text_block/cursor_painter.rb +2 -2
  52. data/lib/shoes/swt/text_block/fitter.rb +5 -3
  53. data/lib/shoes/swt/text_block/painter.rb +9 -9
  54. data/lib/shoes/swt/text_block/text_font_factory.rb +3 -3
  55. data/lib/shoes/swt/text_block/text_segment.rb +9 -9
  56. data/lib/shoes/swt/text_block/text_segment_collection.rb +2 -0
  57. data/lib/shoes/swt/text_block/text_style_factory.rb +9 -3
  58. data/lib/shoes/swt/timer.rb +1 -1
  59. data/lib/shoes/swt/version.rb +1 -1
  60. data/shoes-swt.gemspec +7 -6
  61. data/spec/shoes/cli_spec.rb +2 -2
  62. data/spec/{swt_shoes → shoes/swt}/animation_spec.rb +1 -1
  63. data/spec/{swt_shoes → shoes/swt}/app_spec.rb +36 -3
  64. data/spec/{swt_shoes → shoes/swt}/arc_spec.rb +1 -1
  65. data/spec/{swt_shoes → shoes/swt}/background_spec.rb +1 -1
  66. data/spec/{swt_shoes → shoes/swt}/border_spec.rb +1 -1
  67. data/spec/{swt_shoes → shoes/swt}/button_spec.rb +1 -1
  68. data/spec/{swt_shoes → shoes/swt}/check_spec.rb +1 -1
  69. data/spec/shoes/swt/click_listener_spec.rb +162 -0
  70. data/spec/{swt_shoes → shoes/swt}/color_factory_spec.rb +1 -1
  71. data/spec/{swt_shoes → shoes/swt}/color_spec.rb +1 -1
  72. data/spec/{swt_shoes → shoes/swt}/common/painter_spec.rb +1 -1
  73. data/spec/{swt_shoes → shoes/swt}/common/remove_spec.rb +4 -11
  74. data/spec/{swt_shoes → shoes/swt}/configuration_spec.rb +1 -1
  75. data/spec/{swt_shoes → shoes/swt}/dialog_spec.rb +1 -7
  76. data/spec/{swt_shoes → shoes/swt}/disposed_protection_spec.rb +0 -0
  77. data/spec/{swt_shoes → shoes/swt}/flow_spec.rb +1 -1
  78. data/spec/{swt_shoes → shoes/swt}/font_spec.rb +1 -1
  79. data/spec/{swt_shoes → shoes/swt}/gradient_spec.rb +1 -1
  80. data/spec/{swt_shoes → shoes/swt}/image_pattern_spec.rb +1 -1
  81. data/spec/{swt_shoes → shoes/swt}/image_spec.rb +4 -3
  82. data/spec/{swt_shoes → shoes/swt}/input_box_spec.rb +1 -1
  83. data/spec/{swt_shoes → shoes/swt}/integration_spec.rb +1 -1
  84. data/spec/{swt_shoes → shoes/swt}/key_listener_spec.rb +1 -1
  85. data/spec/{swt_shoes → shoes/swt}/line_spec.rb +4 -8
  86. data/spec/{swt_shoes → shoes/swt}/link_segment_spec.rb +1 -1
  87. data/spec/{swt_shoes → shoes/swt}/link_spec.rb +3 -10
  88. data/spec/{swt_shoes → shoes/swt}/list_box_spec.rb +5 -3
  89. data/spec/{swt_shoes → shoes/swt}/minimal.png +0 -0
  90. data/spec/{swt_shoes → shoes/swt}/mouse_move_listener_spec.rb +1 -1
  91. data/spec/{swt_shoes → shoes/swt}/oval_spec.rb +1 -1
  92. data/spec/{swt_shoes → shoes/swt}/progress_spec.rb +1 -1
  93. data/spec/{swt_shoes → shoes/swt}/radio_group_spec.rb +1 -1
  94. data/spec/{swt_shoes → shoes/swt}/radio_spec.rb +1 -1
  95. data/spec/{swt_shoes → shoes/swt}/rect_painter_spec.rb +1 -1
  96. data/spec/{swt_shoes → shoes/swt}/rect_spec.rb +1 -1
  97. data/spec/{swt_shoes → shoes/swt}/shape_spec.rb +1 -1
  98. data/spec/{swt_shoes → shoes/swt}/shared_examples/button.rb +0 -0
  99. data/spec/shoes/swt/shared_examples/clickable.rb +13 -0
  100. data/spec/{swt_shoes → shoes/swt}/shared_examples/movable.rb +0 -0
  101. data/spec/{swt_shoes → shoes/swt}/shared_examples/paintable.rb +0 -0
  102. data/spec/{swt_shoes → shoes/swt}/shared_examples/painter.rb +0 -0
  103. data/spec/{swt_shoes → shoes/swt}/shared_examples/pattern.rb +0 -0
  104. data/spec/{swt_shoes → shoes/swt}/shared_examples/removable.rb +1 -3
  105. data/spec/{swt_shoes → shoes/swt}/shared_examples/swt_app_context.rb +11 -3
  106. data/spec/{swt_shoes → shoes/swt}/shared_examples/visibility.rb +0 -0
  107. data/spec/{swt_shoes → shoes/swt}/shell_control_listener_spec.rb +1 -1
  108. data/spec/{swt_shoes → shoes/swt}/slot_spec.rb +1 -1
  109. data/spec/{swt_shoes → shoes/swt}/spec_helper.rb +0 -1
  110. data/spec/{swt_shoes → shoes/swt}/star_spec.rb +1 -1
  111. data/spec/{swt_shoes → shoes/swt}/text_block/centered_text_segment_spec.rb +1 -1
  112. data/spec/{swt_shoes → shoes/swt}/text_block/cursor_painter_spec.rb +8 -4
  113. data/spec/{swt_shoes → shoes/swt}/text_block/fitter_spec.rb +5 -5
  114. data/spec/{swt_shoes → shoes/swt}/text_block/painter_spec.rb +1 -1
  115. data/spec/{swt_shoes → shoes/swt}/text_block/text_font_factory_spec.rb +1 -1
  116. data/spec/{swt_shoes → shoes/swt}/text_block/text_segment_collection_spec.rb +7 -2
  117. data/spec/{swt_shoes → shoes/swt}/text_block/text_segment_spec.rb +1 -1
  118. data/spec/{swt_shoes → shoes/swt}/text_block_spec.rb +2 -5
  119. data/spec/spec_helper.rb +7 -3
  120. metadata +132 -331
  121. data/CHANGELOG +0 -84
  122. data/Gemfile +0 -24
  123. data/Guardfile +0 -11
  124. data/manifests/common.rb +0 -34
  125. data/manifests/shoes-swt.rb +0 -29
  126. data/spec/code_coverage.rb +0 -14
  127. data/spec/shoes/animation_spec.rb +0 -65
  128. data/spec/shoes/app_spec.rb +0 -484
  129. data/spec/shoes/arc_spec.rb +0 -51
  130. data/spec/shoes/background_spec.rb +0 -53
  131. data/spec/shoes/border_spec.rb +0 -47
  132. data/spec/shoes/builtin_methods_spec.rb +0 -110
  133. data/spec/shoes/button_spec.rb +0 -44
  134. data/spec/shoes/check_spec.rb +0 -35
  135. data/spec/shoes/color_spec.rb +0 -408
  136. data/spec/shoes/common/inspect_spec.rb +0 -26
  137. data/spec/shoes/common/remove_spec.rb +0 -38
  138. data/spec/shoes/common/style_normalizer_spec.rb +0 -28
  139. data/spec/shoes/common/style_spec.rb +0 -147
  140. data/spec/shoes/configuration_spec.rb +0 -36
  141. data/spec/shoes/constants_spec.rb +0 -38
  142. data/spec/shoes/dialog_spec.rb +0 -163
  143. data/spec/shoes/dimension_spec.rb +0 -407
  144. data/spec/shoes/dimensions_spec.rb +0 -837
  145. data/spec/shoes/download_spec.rb +0 -142
  146. data/spec/shoes/flow_spec.rb +0 -133
  147. data/spec/shoes/font_spec.rb +0 -37
  148. data/spec/shoes/framework_learning_spec.rb +0 -30
  149. data/spec/shoes/gradient_spec.rb +0 -32
  150. data/spec/shoes/helpers/fake_element.rb +0 -17
  151. data/spec/shoes/helpers/inspect_helpers.rb +0 -5
  152. data/spec/shoes/helpers/sample17_helper.rb +0 -66
  153. data/spec/shoes/image_spec.rb +0 -49
  154. data/spec/shoes/images/shoe.jpg +0 -0
  155. data/spec/shoes/input_box_spec.rb +0 -80
  156. data/spec/shoes/integration_spec.rb +0 -20
  157. data/spec/shoes/internal_app_spec.rb +0 -141
  158. data/spec/shoes/keypress_spec.rb +0 -11
  159. data/spec/shoes/keyrelease_spec.rb +0 -12
  160. data/spec/shoes/line_spec.rb +0 -49
  161. data/spec/shoes/link_spec.rb +0 -105
  162. data/spec/shoes/list_box_spec.rb +0 -74
  163. data/spec/shoes/logger/ruby_spec.rb +0 -8
  164. data/spec/shoes/logger_spec.rb +0 -45
  165. data/spec/shoes/oval_spec.rb +0 -24
  166. data/spec/shoes/point_spec.rb +0 -71
  167. data/spec/shoes/progress_spec.rb +0 -54
  168. data/spec/shoes/radio_spec.rb +0 -32
  169. data/spec/shoes/rect_spec.rb +0 -39
  170. data/spec/shoes/renamed_delegate_spec.rb +0 -70
  171. data/spec/shoes/shape_spec.rb +0 -95
  172. data/spec/shoes/shared_examples/button.rb +0 -6
  173. data/spec/shoes/shared_examples/changeable.rb +0 -26
  174. data/spec/shoes/shared_examples/clickable.rb +0 -5
  175. data/spec/shoes/shared_examples/common_methods.rb +0 -35
  176. data/spec/shoes/shared_examples/dimensions.rb +0 -32
  177. data/spec/shoes/shared_examples/dsl.rb +0 -44
  178. data/spec/shoes/shared_examples/dsl/animate.rb +0 -29
  179. data/spec/shoes/shared_examples/dsl/arc.rb +0 -45
  180. data/spec/shoes/shared_examples/dsl/background.rb +0 -26
  181. data/spec/shoes/shared_examples/dsl/border.rb +0 -10
  182. data/spec/shoes/shared_examples/dsl/button.rb +0 -5
  183. data/spec/shoes/shared_examples/dsl/cap.rb +0 -6
  184. data/spec/shoes/shared_examples/dsl/check.rb +0 -11
  185. data/spec/shoes/shared_examples/dsl/edit_box.rb +0 -8
  186. data/spec/shoes/shared_examples/dsl/edit_line.rb +0 -8
  187. data/spec/shoes/shared_examples/dsl/editable_element.rb +0 -29
  188. data/spec/shoes/shared_examples/dsl/fill.rb +0 -27
  189. data/spec/shoes/shared_examples/dsl/flow.rb +0 -15
  190. data/spec/shoes/shared_examples/dsl/gradient.rb +0 -62
  191. data/spec/shoes/shared_examples/dsl/image.rb +0 -21
  192. data/spec/shoes/shared_examples/dsl/line.rb +0 -9
  193. data/spec/shoes/shared_examples/dsl/nofill.rb +0 -6
  194. data/spec/shoes/shared_examples/dsl/nostroke.rb +0 -6
  195. data/spec/shoes/shared_examples/dsl/oval.rb +0 -88
  196. data/spec/shoes/shared_examples/dsl/pattern.rb +0 -34
  197. data/spec/shoes/shared_examples/dsl/progress.rb +0 -7
  198. data/spec/shoes/shared_examples/dsl/rect.rb +0 -92
  199. data/spec/shoes/shared_examples/dsl/rgb.rb +0 -26
  200. data/spec/shoes/shared_examples/dsl/shape.rb +0 -21
  201. data/spec/shoes/shared_examples/dsl/star.rb +0 -48
  202. data/spec/shoes/shared_examples/dsl/stroke.rb +0 -30
  203. data/spec/shoes/shared_examples/dsl/strokewidth.rb +0 -19
  204. data/spec/shoes/shared_examples/dsl/style.rb +0 -32
  205. data/spec/shoes/shared_examples/dsl/text_elements.rb +0 -81
  206. data/spec/shoes/shared_examples/dsl/video.rb +0 -5
  207. data/spec/shoes/shared_examples/dsl_app_context.rb +0 -8
  208. data/spec/shoes/shared_examples/hover_leave.rb +0 -11
  209. data/spec/shoes/shared_examples/parent.rb +0 -6
  210. data/spec/shoes/shared_examples/scroll.rb +0 -41
  211. data/spec/shoes/shared_examples/shared_element_method.rb +0 -60
  212. data/spec/shoes/shared_examples/slot.rb +0 -331
  213. data/spec/shoes/shared_examples/state.rb +0 -19
  214. data/spec/shoes/shared_examples/style.rb +0 -82
  215. data/spec/shoes/slot_spec.rb +0 -130
  216. data/spec/shoes/sound_spec.rb +0 -15
  217. data/spec/shoes/span_spec.rb +0 -112
  218. data/spec/shoes/spec_helper.rb +0 -24
  219. data/spec/shoes/stack_spec.rb +0 -79
  220. data/spec/shoes/star_spec.rb +0 -31
  221. data/spec/shoes/text_block_dimensions_spec.rb +0 -75
  222. data/spec/shoes/text_block_spec.rb +0 -270
  223. data/spec/shoes/url_spec.rb +0 -68
  224. data/spec/shoes/widget_spec.rb +0 -70
  225. data/spec/shoes_spec.rb +0 -44
  226. data/spec/swt_shoes/shared_examples/clickable.rb +0 -85
  227. data/spec/swt_shoes/sound.rb +0 -10
data/CHANGELOG DELETED
@@ -1,84 +0,0 @@
1
- 4.0.0.pre2 (438 commits)
2
- ----------------
3
-
4
- New features (1)
5
- ----------------
6
-
7
- * Shoes 4.0.0.pre1 was a single gem. Now we ship as as three gems [e16a0c4]:
8
-
9
- * shoes -- Home to the shoes executable. Declares dependencies on other
10
- shoes gems for ease of installation.
11
- * shoes-dsl -- Code for the Shoes DSL. No direct UI rendering and will be
12
- reused with all future backends.
13
- * shoes-swt -- The first Shoes backend, implemented in JRuby on the SWT
14
- library via the swt gem.
15
-
16
- * Full style-setting functionality (element#style, setters, hash, app level) [56d91f8]
17
-
18
- Improvements (36)
19
- -----------------
20
-
21
- * Update SWT to 4.4 [536ffae]
22
- * Update packaging dependency to 0.2.0 now supporting rubyzip > 1.0 [c3dd289]
23
- * Update all elements to use new style methods [1b76aa3, 29498d1, d569a77, e6eec90, 54e5edf, 1238977, 2dc222f, dbeffff, 25b2ec6, cb865a6, 49fa0a1]
24
- * Update list of app level styles and partially fix rotate angle issues [2affdbb]
25
- * Shoes application context improved to avoid conflicts between user-defined and shoes-defined methods. [732108a]
26
- * Builtin methods are also available from the Shoes class [de37d59]
27
- * #gray, #rgb and #gradient builtin methods [8f7ee92]
28
- * Removed redrawing triggers after Dimension methods [61a55ba]
29
- * Apply fraction from progress initialize [b241240]
30
- * Trigger redraw on hover/leave for slot and image update [ae5dfb5]
31
- * Nobody Knows Shoes samples added [68e84e6]
32
- * Add sample56 snapshot [e7eb0d3]
33
- * Add scroll* methods to slots. Scrolling functionality not implemented yet. [6fb0e79]
34
- * Click passes element, not coordinates to most blocks [78ecb23]
35
- * Allow button calls without a button name [a315ef4]
36
- * Add common #to_s and #inspect methods for DSL objects [350c4dc]
37
- * Disposal for Images and Patterns. [ddcd9fb]
38
- * Move Swt::TextBlock related classes to subdirectory. [226e03f]
39
- * Revise TextBlock cursor to be more like other text functionality. [f016ee7]
40
- * Updated manual to show correct syntax for rect. [2fee530]
41
- * App#parent method to show the parent of the slot currently evaled [48e811f]
42
- * Add keypress to close app cleanly when running leak hunter and dispose of app-level resources. [af4d6bb]
43
-
44
- Bug Fixes (32)
45
- --------------
46
-
47
- * Fix running bin/shoes.bat from source [fe47075]
48
- * Move shoes executable from shoes-dsl to shoes [92583e6]
49
- * Fix for crash on empty link text [3da3159]
50
- * Hide only the elements of a slot, not its parent contents [f2ea17c]
51
- * Fix crash for Border when hiding [1c2ab74]
52
- * Methods defined in widgets are available in URL instances [3a94afb]
53
- * Make texts know their TextBlock and hence their visibility [7b4ea24]
54
- * Non resizable apps can not be maximized (fixes resizable on mac) #872 [b08b215]
55
- * Keypress#remove removes the keys listener and does not blow up [498588c]
56
- * Run shape blocks with app as self [dbb0a46]
57
- * When an element is removed or removed, cursor shouldn't change shape over that location. [918288f, 7fcd93a]
58
- * Removing children from slot should trigger redraw [be35743]
59
- * Fix for allowing widgets to use widget DSL methods [99d22e1]
60
- * Fix for secret on edit lines [79c4c98]
61
- * Fix crash computing height with hidden elements [41ebafe]
62
- * Fix for unbounded height crash on centering [11fc3ae]
63
- * Windows build requires shoes.bat from ext/install [232ec68]
64
- * Reuse created fonts in the factory [7959bd8]
65
- * Disposal of Shape SWT resources. [650365b]
66
- * Fix for offsetting of second text segments [97fe79b]
67
- * Consider relatively positioned elements for slot height [3e71126]
68
- * Fix fatal exceptions in samples/simple-calc.rb [d53d588]
69
- * Fix slot clearing [3697802]
70
- * Don't clear top_slot when clear is called, clear current_slot [a57778c]
71
- * Handling for text centering [87405f5]
72
- * Fix common remove to allow removal of slots [c25df7e]
73
- * Clear transform after painting each object, to avoid side effects on other painters [5a57ce3]
74
- * Fix off by one error in slot positioning. [baee69a]
75
- * Dispose of transform resources. [265600c]
76
- * Only report start/end relative to the parent if there is one [c82e763]
77
- * Links must be cleared on TextBlock#replace [4b90786]
78
-
79
- Contributors (16)
80
- -----------------
81
-
82
- Jason R. Clark, Eric Watson, Tobias Pfeiffer, KC Erb, Charles Chamberlain,
83
- George, Marcell Monteiro Cruz, Glenn Murray, Jason Clark, Tim Krajcar,
84
- glenn-murray-bse, KCErb, PeterWAWood, Suirtimed, ashbb, Carlos R Tirado
data/Gemfile DELETED
@@ -1,24 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec :name => 'shoes'
4
- gemspec :name => 'shoes-dsl'
5
- gemspec :name => 'shoes-swt'
6
-
7
- group :development do
8
- gem "guard"
9
- gem "guard-rspec"
10
- gem "pry"
11
-
12
- gem "rspec", "~>3.0.0"
13
- gem "rspec-its", "~>1.0.1"
14
- gem "rake"
15
-
16
- gem "yard"
17
- gem "kramdown"
18
- gem 'simplecov'
19
- gem 'coveralls'
20
- gem "codeclimate-test-reporter"
21
- gem 'jruby-lint'
22
- gem 'webmock'
23
- gem 'hometown'
24
- end
data/Guardfile DELETED
@@ -1,11 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'rspec' do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
7
- watch(%r{^lib/shoes/mock/(.+)\.rb$}) { |m| "spec/shoes/#{m[1]}_spec.rb" }
8
- watch(%r{^lib/shoes/swt/(.+)\.rb$}) { |m| "spec/swt_shoes/#{m[1]}_spec.rb" }
9
- watch('lib/shoes/dsl.rb') { |m| "spec/swt_shoes/dsl_spec.rb" }
10
- end
11
-
data/manifests/common.rb DELETED
@@ -1,34 +0,0 @@
1
- require 'rake/file_list'
2
-
3
- module ShoesManifestReport
4
- def report
5
- puts "Manifest of #{gem_name} gem"
6
- puts
7
- puts "files"
8
- puts "-----"
9
- puts files.sort.join("\n")
10
- puts
11
- puts "test_files"
12
- puts "----------"
13
- puts test_files.sort.join("\n")
14
- puts
15
- puts "#{files.length} files, #{test_files.length} test_files"
16
- end
17
- end
18
-
19
- class ShoesCommonManifest
20
- def self.files
21
- Rake::FileList[%w(
22
- CHANGELOG
23
- Gemfile
24
- Guardfile
25
- LICENSE
26
- README.md
27
- manifests/common.rb
28
- )]
29
- end
30
-
31
- def self.test_files
32
- []
33
- end
34
- end
@@ -1,29 +0,0 @@
1
- require_relative 'common'
2
-
3
- class ShoesSwtManifest
4
- extend ShoesManifestReport
5
-
6
- def self.gem_name
7
- 'shoes-swt'
8
- end
9
-
10
- def self.files
11
- @files = ShoesCommonManifest.files
12
- .include(%w[
13
- lib/shoes/swt.rb
14
- lib/shoes/swt/**/*
15
- manifests/shoes-swt.rb
16
- shoes-swt.gemspec
17
- ])
18
- .include(test_files)
19
- end
20
-
21
- def self.test_files
22
- @test_files = Rake::FileList['spec/**/*']
23
- end
24
- end
25
-
26
-
27
- if $0 == __FILE__
28
- puts ShoesSwtManifest.report
29
- end
@@ -1,14 +0,0 @@
1
- require 'simplecov'
2
- # using coveralls to publish test coverage statistics
3
- require 'coveralls'
4
- require "codeclimate-test-reporter"
5
-
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
7
- Coveralls::SimpleCov::Formatter,
8
- SimpleCov::Formatter::HTMLFormatter
9
- ]
10
- SimpleCov.start do
11
- add_filter '/spec/'
12
- end
13
-
14
- CodeClimate::TestReporter.start
@@ -1,65 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- shared_examples_for Shoes::Animation do
4
- it "should start" do
5
- subject.start
6
- expect(subject).not_to be_stopped
7
- end
8
-
9
- it "should stop" do
10
- subject.stop
11
- expect(subject).to be_stopped
12
- end
13
-
14
- it "should toggle on" do
15
- subject.stop
16
- subject.toggle
17
- expect(subject).not_to be_stopped
18
- end
19
-
20
- it "should toggle off" do
21
- subject.start
22
- subject.toggle
23
- expect(subject).to be_stopped
24
- end
25
-
26
- it "increments frame" do
27
- frame = subject.current_frame
28
- subject.increment_frame
29
- expect(subject.current_frame).to eq(frame + 1)
30
- end
31
- end
32
-
33
- describe Shoes::Animation do
34
- let(:app) { double('app') }
35
- let(:app_gui) { double('app gui') }
36
- let(:opts) { {} }
37
- let(:block) { double('block') }
38
- subject { Shoes::Animation.new( app, opts, block ) }
39
-
40
- before :each do
41
- expect(app).to receive(:gui) { app_gui }
42
- end
43
-
44
- it_behaves_like Shoes::Animation
45
-
46
- it "sets default framerate" do
47
- expect(subject.framerate).to eq(10)
48
- end
49
-
50
- it "sets current frame to 0" do
51
- expect(subject.current_frame).to eq(0)
52
- end
53
-
54
- it { is_expected.not_to be_stopped }
55
-
56
- describe "with framerate" do
57
- let(:opts) { {:framerate => 36, :app => app} }
58
-
59
- it "sets framerate" do
60
- expect(subject.framerate).to eq(36)
61
- end
62
-
63
- it_behaves_like Shoes::Animation
64
- end
65
- end
@@ -1,484 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- describe Shoes::App do
4
- let(:input_blk) { Proc.new {} }
5
- let(:opts) { Hash.new }
6
- subject(:app) { Shoes::App.new(opts, &input_blk) }
7
-
8
- after do
9
- Shoes.unregister_all
10
- end
11
-
12
- it_behaves_like "DSL container"
13
- it { is_expected.to respond_to :clipboard }
14
- it { is_expected.to respond_to :clipboard= }
15
- it { is_expected.to respond_to :owner }
16
-
17
- # For Shoes 3 compatibility
18
- it "exposes self as #app" do
19
- expect(app.app).to eq(app)
20
- end
21
-
22
- describe "initialize" do
23
- let(:input_blk) { Proc.new {} }
24
-
25
- it "initializes style hash", :qt do
26
- style = Shoes::App.new.style
27
- expect(style.class).to eq(Hash)
28
- end
29
-
30
- context "console" do
31
- end
32
-
33
- context "defaults" do
34
- let(:opts) { Hash.new }
35
- let(:defaults) { Shoes::InternalApp::DEFAULT_OPTIONS }
36
-
37
- it "sets width", :qt do
38
- expect(subject.width).to eq defaults[:width]
39
- end
40
-
41
- it "sets height", :qt do
42
- expect(subject.height).to eq defaults[:height]
43
- end
44
-
45
- it 'has an absolute_left of 0' do
46
- expect(subject.absolute_left).to eq 0
47
- end
48
-
49
- it 'has an absolute_top of 0' do
50
- expect(subject.absolute_top).to eq 0
51
- end
52
-
53
- describe "inspect" do
54
- include InspectHelpers
55
-
56
- it "shows title in #to_s" do
57
- expect(subject.to_s).to eq("(Shoes::App \"#{defaults.fetch :title}\")")
58
- end
59
-
60
- it "shows title in #inspect" do
61
- expect(subject.inspect).to match("(Shoes::App:#{shoes_object_id_pattern} \"#{defaults.fetch :title}\")")
62
- end
63
- end
64
- end
65
-
66
- context "from opts" do
67
- let(:opts) { {:width => 150, :height => 2, :title => "Shoes::App Spec", :resizable => false} }
68
-
69
- it "sets width", :qt do
70
- expect(subject.width).to eq opts[:width]
71
- end
72
-
73
- it "sets height", :qt do
74
- expect(subject.height).to eq opts[:height]
75
- end
76
-
77
- it "passes opts to InternalApp" do
78
- expect(Shoes::InternalApp).to receive(:new).with(kind_of(Shoes::App), opts).and_call_original
79
- subject
80
- end
81
-
82
- it 'initializes a flow with the right parameters' do
83
- expect(Shoes::Flow).to receive(:new).with(anything, anything,
84
- {width: opts[:width],
85
- height: opts[:height]}).
86
- and_call_original
87
- subject
88
- end
89
- end
90
-
91
- context "when registering" do
92
- before :each do
93
- Shoes.unregister_all
94
- end
95
-
96
- it "registers" do
97
- old_apps_length = Shoes.apps.length
98
- subject
99
- expect(Shoes.apps.length).to eq(old_apps_length + 1)
100
- expect(Shoes.apps).to include(subject)
101
- end
102
- end
103
- end
104
-
105
- describe "style with defaults" do
106
- let(:default_styles) { Shoes::Common::Style::DEFAULT_STYLES }
107
-
108
- it "sets app defaults" do
109
- expect(app.style).to eq(default_styles)
110
- end
111
-
112
- it "merges new styles with existing styles" do
113
- subject.style strokewidth: 4
114
- expect(subject.style).to eq(default_styles.merge(strokewidth: 4))
115
- end
116
-
117
- default_styles = Shoes::Common::Style::DEFAULT_STYLES
118
-
119
- default_styles.each do |key, value|
120
- describe "#{key}" do
121
- it "defaults to #{value}" do
122
- expect(subject.style[key]).to eq(value)
123
- end
124
-
125
- it "passes default to objects" do
126
- expect(subject.line(0, 100, 100, 0).style[key]).to eq(value)
127
- end
128
-
129
- end
130
- end
131
-
132
-
133
- describe "default styles" do
134
- it "are independent among Shoes::App instances" do
135
- app1 = Shoes::App.new
136
- app2 = Shoes::App.new
137
-
138
- app1.strokewidth 10
139
- expect(app1.line(0, 100, 100, 0).style[:strokewidth]).to eq(10)
140
-
141
- # .. but does not affect app2
142
- expect(app2.line(0, 100, 100, 0).style[:strokewidth]).not_to eq(10)
143
-
144
- end
145
- end
146
- end
147
-
148
- describe "app-level style setter" do
149
- let(:goldenrod) { Shoes::COLORS[:goldenrod] }
150
-
151
- pattern_styles = Shoes::DSL::PATTERN_APP_STYLES
152
- other_styles = Shoes::DSL::OTHER_APP_STYLES
153
-
154
- pattern_styles.each do |style|
155
- it "sets #{style} for objects" do
156
- subject.public_send(style, goldenrod)
157
- expect(subject.line(0, 100, 100, 0).style[style]).to eq(goldenrod)
158
- end
159
- end
160
-
161
- other_styles.each do |style|
162
- it "sets #{style} for objects" do
163
- subject.public_send(style, 'val')
164
- expect(subject.line(0, 100, 100, 0).style[style]).to eq('val')
165
- end
166
- end
167
-
168
- end
169
-
170
- describe "connecting with gui" do
171
- let(:gui) { app.instance_variable_get(:@__app__).gui }
172
-
173
- describe "clipboard" do
174
- it "gets clipboard" do
175
- expect(gui).to receive(:clipboard)
176
- subject.clipboard
177
- end
178
-
179
- it "sets clipboard" do
180
- expect(gui).to receive(:clipboard=).with("test")
181
- subject.clipboard = "test"
182
- end
183
- end
184
-
185
- describe "quitting" do
186
- it "#quit tells the GUI to quit" do
187
- expect(gui).to receive :quit
188
- subject.quit
189
- end
190
-
191
- it '#close tells the GUI to quit' do
192
- expect(gui).to receive :quit
193
- subject.close
194
- end
195
- end
196
- end
197
-
198
- describe "#started?" do
199
- it "checks the window has been displayed or not" do
200
- subject.started?
201
- end
202
- end
203
-
204
- describe 'Execution context' do
205
- it 'starts with self as the execution context' do
206
- my_self = nil
207
- app = Shoes.app do my_self = self end
208
- expect(my_self).to eq app
209
- end
210
- end
211
-
212
- describe '#append' do
213
- let(:input_blk) {Proc.new do append do para 'Hi' end end}
214
-
215
- it 'understands append' do
216
- expect(subject).to respond_to :append
217
- end
218
-
219
- it 'should receive a call to what is called in the append block' do
220
- expect_any_instance_of(Shoes::App).to receive :para
221
- subject
222
- end
223
- end
224
-
225
- describe '#resize' do
226
- it 'understands resize' do
227
- expect(subject).to respond_to :resize
228
- end
229
- end
230
-
231
- describe 'fullscreen' do
232
- context 'defaults' do
233
- it 'is not fullscreen' do
234
- expect(app).not_to be_fullscreen
235
- end
236
-
237
- it 'can enter fullscreen' do
238
- app.fullscreen = true
239
- expect(app).to be_fullscreen
240
- end
241
- end
242
-
243
- describe 'going into fullscreen and back out again' do
244
- let(:defaults) { Shoes::InternalApp::DEFAULT_OPTIONS }
245
-
246
- before :each do
247
- app.fullscreen = true
248
- app.fullscreen = false
249
- end
250
-
251
- # Failing on Mac fullscreen doesnt seem to work see #397
252
- it 'is not in fullscreen', :fails_on_osx do
253
- expect(app).not_to be_fullscreen
254
- end
255
-
256
- # Failing on Mac fullscreen doesnt seem to work see #397
257
- it 'has its origina', :fails_on_osx do
258
- expect(app.width).to eq(defaults[:width])
259
- end
260
-
261
- # Failing on Mac fullscreen doesnt seem to work see #397
262
- it 'has its original height', :fails_on_osx do
263
- expect(app.height).to eq(defaults[:height])
264
- end
265
- end
266
- end
267
-
268
- describe '#clear' do
269
- let(:input_blk) do
270
- Proc.new do
271
- para 'Hello'
272
- end
273
- end
274
- let(:internal_app) {subject.instance_variable_get(:@__app__)}
275
-
276
- it 'has initial contents' do
277
- expect(subject.contents).to_not be_empty
278
- end
279
-
280
- it 'removes everything (regression)' do
281
- subject.clear
282
- expect(subject.contents).to be_empty
283
- end
284
- end
285
-
286
- describe "#gutter" do
287
- context "when app has a scrollbar" do
288
- let(:input_opts) { {width: 100, height: 100} }
289
- let(:input_block) { Proc.new { para "Round peg, square hole" * 200 } }
290
-
291
- it "has gutter of 16" do
292
- expect(app.gutter).to be_within(1).of(16)
293
- end
294
- end
295
-
296
- context "when app has no scrollbar" do
297
- let(:input_block) { Proc.new { para "Round peg, square hole" } }
298
-
299
- it "has gutter of 16" do
300
- expect(app.gutter).to be_within(1).of(16)
301
- end
302
- end
303
- end
304
-
305
- describe "#parent" do
306
- context "for a top-level element (not explicitly in a slot)" do
307
- it "returns the top_slot" do
308
- my_parent = nil
309
- app = Shoes.app do
310
- flow do
311
- my_parent = parent
312
- end
313
- end
314
- expect(my_parent).to eq app.instance_variable_get(:@__app__).top_slot
315
- end
316
- end
317
-
318
- context "for an element within a slot" do
319
- it "returns the enclosing slot" do
320
- my_parent = nil
321
- my_stack = nil
322
- app = Shoes.app do
323
- my_stack = stack do
324
- flow do
325
- my_parent = parent
326
- end
327
- end
328
- end
329
-
330
- expect(my_parent).to eq my_stack
331
- end
332
- end
333
-
334
- end
335
-
336
- describe "additional context" do
337
- it "fails on unknown method" do
338
- expect { subject.asdf }.to raise_error(NoMethodError)
339
- end
340
-
341
- it "calls through to context if available" do
342
- context = double("context", asdf: nil)
343
- expect(context).to receive(:asdf)
344
-
345
- subject.eval_with_additional_context(context) do
346
- asdf
347
- end
348
- end
349
-
350
- it "clears context when finished" do
351
- context = double("context")
352
-
353
- captured_context = nil
354
- subject.eval_with_additional_context(context) do
355
- captured_context = @__additional_context__
356
- end
357
-
358
- expect(captured_context).to eq(context)
359
- expect(subject.instance_variable_get(:@__additional_context__)).to be_nil
360
- end
361
-
362
- it "still clears context when failure in eval" do
363
- context = double("context")
364
-
365
- expect do
366
- subject.eval_with_additional_context(context) { raise "O_o" }
367
- end.to raise_error(RuntimeError)
368
-
369
- expect(subject.instance_variable_get(:@__additional_context__)).to be_nil
370
- end
371
- end
372
-
373
- describe 'subscribing to DSL methods' do
374
-
375
- class TestSubscribeClass
376
- attr_reader :app
377
- def initialize(app)
378
- @app = app
379
- end
380
- Shoes::App.subscribe_to_dsl_methods(self)
381
- end
382
-
383
- let(:subscribed_instance) {TestSubscribeClass.new subject}
384
-
385
- AUTO_SUBSCRIBED_CLASSES = [Shoes::App, Shoes::URL, Shoes::Widget]
386
- SUBSCRIBED_CLASSES = AUTO_SUBSCRIBED_CLASSES + [TestSubscribeClass]
387
-
388
- describe '.subscribe_to_dsl_methods' do
389
- it 'has its instances respond to the dsl methods of the app' do
390
- expect(subscribed_instance).to respond_to :para, :image
391
- end
392
-
393
- it 'delegates does methods to the passed in app' do
394
- expect(subject).to receive(:para)
395
- subscribed_instance.para
396
- end
397
-
398
- SUBSCRIBED_CLASSES.each do |klazz|
399
- it "#{klazz} responds to a regular DSL method" do
400
- expect(klazz).to be_public_method_defined(:para)
401
- end
402
- end
403
- end
404
-
405
- describe '.new_dsl_method (for widget method notifications etc.)' do
406
-
407
- before :each do
408
- Shoes::App.new_dsl_method :widget_method do
409
- # noop
410
- end
411
- end
412
-
413
- SUBSCRIBED_CLASSES.each do |klazz|
414
- it "#{klazz} now responds to this method" do
415
- expect(klazz).to be_public_method_defined(:widget_method)
416
- end
417
- end
418
- end
419
-
420
- describe 'DELEGATE_METHODS' do
421
- subject {Shoes::App::DELEGATE_METHODS}
422
-
423
- describe 'does not include general ruby object methods' do
424
- it {is_expected.not_to include :new, :initialize}
425
- end
426
-
427
- describe 'it has access to Shoes app and DSL methods' do
428
- it {is_expected.to include :para, :rect, :stack, :flow, :image, :location}
429
- end
430
-
431
- describe 'it does not have access to private methods' do
432
- it {is_expected.not_to include :pop_style, :style_normalizer, :create}
433
- end
434
-
435
- describe 'there are blacklisted methods that wreck havoc' do
436
- it {is_expected.not_to include :parent, :app}
437
- end
438
- end
439
-
440
- end
441
- end
442
-
443
- describe "App registry" do
444
- subject { Shoes.apps }
445
-
446
- before :each do
447
- Shoes.unregister_all
448
- end
449
-
450
- it "only exposes a copy" do
451
- subject << double("app")
452
- expect(Shoes.apps.length).to eq(0)
453
- end
454
-
455
- context "with no apps" do
456
- it { is_expected.to be_empty }
457
- end
458
-
459
- context "with one app" do
460
- let(:app) { double('app') }
461
- before :each do
462
- Shoes.register(app)
463
- end
464
-
465
- its(:length) { should eq(1) }
466
- it "marks first app as main app" do
467
- expect(Shoes.main_app).to be(app)
468
- end
469
- end
470
-
471
- context "with two apps" do
472
- let(:app_1) { double("app 1") }
473
- let(:app_2) { double("app 2") }
474
-
475
- before :each do
476
- [app_1, app_2].each { |a| Shoes.register(a) }
477
- end
478
-
479
- its(:length) { should eq(2) }
480
- it "marks first app as main app" do
481
- expect(Shoes.main_app).to be(app_1)
482
- end
483
- end
484
- end