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
@@ -1,74 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- describe Shoes::ListBox do
4
- include_context "dsl app"
5
- let(:input_opts) { { items: items, left: left, top: top, width: width,
6
- height: height } }
7
-
8
- let(:items) {["Wine", "Vodka", "Water"]}
9
-
10
- let(:left) { 10 }
11
- let(:top) { 20 }
12
- let(:width) { 100 }
13
- let(:height) { 200 }
14
-
15
- subject(:list_box) { Shoes::ListBox.new(app, parent, input_opts, input_block) }
16
-
17
- it_behaves_like "an element that can respond to change"
18
- it_behaves_like "object with style" do
19
- let(:subject_without_style) { Shoes::ListBox.new(app, parent) }
20
- let(:subject_with_style) { Shoes::ListBox.new(app, parent, arg_styles) }
21
- end
22
- it_behaves_like "object with state"
23
- it_behaves_like "object with dimensions"
24
-
25
- describe "relative dimensions from parent" do
26
- subject { Shoes::ListBox.new(app, parent, relative_opts, input_block) }
27
- it_behaves_like "object with relative dimensions"
28
- end
29
-
30
- describe "negative dimensions" do
31
- subject { Shoes::ListBox.new(app, parent, negative_opts, input_block) }
32
- it_behaves_like "object with negative dimensions"
33
- end
34
-
35
- it "contains the correct items" do
36
- expect(subject.items).to eq(["Wine", "Vodka", "Water"])
37
- end
38
-
39
- it "changes the items" do
40
- list_box.items = ["Pie", "Apple", "Pig"]
41
- expect(list_box.items).to eq(["Pie", "Apple", "Pig"])
42
- end
43
-
44
- describe 'Choosing' do
45
- it "allows us to choose an option" do
46
- expect(list_box).to respond_to(:choose)
47
- end
48
-
49
- def expect_gui_choose_with(string)
50
- expect_any_instance_of(Shoes.configuration.backend::ListBox).
51
- to receive(:choose).with string
52
- end
53
-
54
- it "should call @gui.choose when we choose something" do
55
- expect_gui_choose_with "Wine"
56
- list_box.choose "Wine"
57
- end
58
-
59
- it 'should call @gui.choose when the choose option is passed' do
60
- expect_gui_choose_with 'Wine'
61
- Shoes::ListBox.new app, parent, input_opts.merge(choose: 'Wine')
62
- end
63
- end
64
-
65
- it "should delegate #text to the backend" do
66
- expect_any_instance_of(Shoes.configuration.backend::ListBox).
67
- to receive(:text).and_return("Sneakers & Sandals")
68
- expect(list_box.text).to eq("Sneakers & Sandals")
69
- end
70
-
71
- it 'has the initialized text elements' do
72
- expect(subject.items).to eq items
73
- end
74
- end
@@ -1,8 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Shoes::Logger::Ruby do
4
- it "delegates to a Logger instance" do
5
- expect_any_instance_of(::Logger).to receive(:debug).with("Foo bar baz!")
6
- subject.debug("Foo bar baz!")
7
- end
8
- end
@@ -1,45 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Shoes::Logger do
4
- let(:awesome_logger) { Class.new }
5
- after { Shoes::Logger.unregister(:awesome_logger) }
6
-
7
- describe ".register" do
8
- it "allows new loggers to be registered" do
9
- Shoes::Logger.register(:awesome_logger, awesome_logger)
10
- end
11
- end
12
-
13
- describe ".get" do
14
- before { Shoes::Logger.register(:awesome_logger, awesome_logger) }
15
-
16
- it "retrieves a registered logger" do
17
- expect(Shoes::Logger.get(:awesome_logger)).to equal(awesome_logger)
18
- end
19
- end
20
-
21
- describe "default logger" do
22
- let(:logger) { Shoes.logger }
23
-
24
- it "is a ruby logger" do
25
- expect(logger).to be_an_instance_of(Shoes::Logger::Ruby)
26
- end
27
- end
28
- end
29
-
30
- describe Shoes::Logger::Ruby do
31
- let(:logdevice) { StringIO.new }
32
- subject(:logger) { Shoes::Logger::Ruby.new logdevice }
33
-
34
- it "logs messages with format 'LEVEL: Message'" do
35
- logger.info "Message"
36
- expect(logdevice.string).to eq("INFO: Message\n")
37
- end
38
-
39
- it "defaults to STDERR" do
40
- allow(STDERR).to receive(:write)
41
- logger = Shoes::Logger::Ruby.new
42
- logger.error "Message"
43
- expect(STDERR).to have_received(:write)
44
- end
45
- end
@@ -1,24 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- describe Shoes::Oval do
4
- include_context "dsl app"
5
-
6
- let(:left) { 20 }
7
- let(:top) { 30 }
8
- let(:width) { 100 }
9
- let(:height) { 200 }
10
-
11
- describe "basic" do
12
- subject { Shoes::Oval.new(app, parent, left, top, width, height) }
13
- it_behaves_like "object with style" do
14
- let(:subject_without_style) { Shoes::Oval.new(app, parent, left, top, width, height) }
15
- let(:subject_with_style) { Shoes::Oval.new(app, parent, left, top, width, height, arg_styles) }
16
- end
17
- it_behaves_like "object with dimensions"
18
- it_behaves_like "movable object"
19
- it_behaves_like "left, top as center"
20
- it_behaves_like "object with parent"
21
-
22
- #it_styles_with :art_styles, :center, :dimensions, :radius
23
- end
24
- end
@@ -1,71 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- describe Shoes::Point do
4
- subject { Shoes::Point.new(40, 50) }
5
- let(:other_point) { Shoes::Point.new(10, 60) }
6
-
7
- its(:x) { should eq(40) }
8
- its(:y) { should eq(50) }
9
-
10
- it "#left works on either point" do
11
- expect(subject.left(other_point)).to eq(10)
12
- expect(other_point.left(subject)).to eq(10)
13
- end
14
-
15
- it "#top works on either point" do
16
- expect(subject.top(other_point)).to eq(50)
17
- expect(other_point.top(subject)).to eq(50)
18
- end
19
-
20
- describe "equality" do
21
- it "requires x and y to be equal" do
22
- expect(subject).to eq(Shoes::Point.new 40, 50)
23
- expect(subject).not_to eq(Shoes::Point.new 41, 50)
24
- expect(subject).not_to eq(Shoes::Point.new 40, 51)
25
- end
26
-
27
- it "works with other (x,y) objects" do
28
- expect(subject).to eq(Struct.new(:x, :y).new(40, 50))
29
- end
30
- end
31
-
32
- describe "#to" do
33
- it "positive" do
34
- expect(subject.to(24, 166)).to eq(Shoes::Point.new(64, 216))
35
- end
36
-
37
- it "negative" do
38
- expect(subject.to(-24, -166)).to eq(Shoes::Point.new(16, -116))
39
- end
40
- end
41
-
42
- it "calculates width of rectangle created with other point" do
43
- expect(subject.width(other_point)).to eq(30)
44
- expect(other_point.width(subject)).to eq(30)
45
- end
46
-
47
- it "calculates height of rectangle created with other point" do
48
- expect(subject.height(other_point)).to eq(10)
49
- expect(other_point.height(subject)).to eq(10)
50
- end
51
-
52
- describe "converting to string" do
53
- include InspectHelpers
54
-
55
- it "looks like (x,y)" do
56
- expect(subject.to_s).to eq("(40,50)")
57
- end
58
-
59
- it "inspects like (Shoes::Point:0x01234567 (x,y))" do
60
- expect(subject.inspect).to match(/[(]Shoes::Point:#{shoes_object_id_pattern} [(]40,50[)][)]/)
61
- end
62
-
63
- describe "with nil values" do
64
- subject { Shoes::Point.new(nil, nil) }
65
-
66
- it "looks like (nil,nil)" do
67
- expect(subject.to_s).to eq("(_,_)")
68
- end
69
- end
70
- end
71
- end
@@ -1,54 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- describe Shoes::Progress do
4
- include_context "dsl app"
5
- let(:input_opts) { { left: left, top: top, width: width, height: height } }
6
-
7
- let(:left) { 10 }
8
- let(:top) { 20 }
9
- let(:width) { 100 }
10
- let(:height) { 200 }
11
-
12
- subject(:progress) { Shoes::Progress.new(app, parent, input_opts, input_block) }
13
-
14
- it { is_expected.to respond_to :fraction }
15
- it { is_expected.to respond_to :fraction= }
16
-
17
- it_behaves_like "object with dimensions"
18
-
19
- it_behaves_like "object with style" do
20
- let(:subject_without_style) { Shoes::Progress.new(app, parent) }
21
- let(:subject_with_style) { Shoes::Progress.new(app, parent, arg_styles) }
22
- end
23
-
24
- context "initialize" do
25
- let(:input_opts) { { fraction: 50 } }
26
-
27
- it "sets fraction" do
28
- expect_any_instance_of(Shoes.configuration.backend::Progress).to receive(:fraction=).with(50)
29
- expect(progress).not_to be_nil
30
- end
31
- end
32
-
33
- context "setting fraction" do
34
- it "sets on gui" do
35
- expect(progress.gui).to receive(:fraction=).with(0.5)
36
- progress.fraction = 0.5
37
- end
38
-
39
- it "sets on self" do
40
- progress.fraction = 0.5
41
- expect(progress.fraction).to eq(0.5)
42
- end
43
- end
44
-
45
- describe "relative dimensions from parent" do
46
- subject { Shoes::Progress.new(app, parent, relative_opts, input_block) }
47
- it_behaves_like "object with relative dimensions"
48
- end
49
-
50
- describe "negative dimensions" do
51
- subject { Shoes::Progress.new(app, parent, negative_opts, input_block) }
52
- it_behaves_like "object with negative dimensions"
53
- end
54
- end
@@ -1,32 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- describe Shoes::Radio do
4
- include_context "dsl app"
5
-
6
- subject(:radio) { Shoes::Radio.new(app, parent, group, input_opts, input_block) }
7
- let(:group) { :a_group }
8
-
9
- it_behaves_like "checkable"
10
- it_behaves_like "object with state"
11
-
12
- it_behaves_like "object with style" do
13
- let(:subject_without_style) { Shoes::Radio.new(app, parent, group) }
14
- let(:subject_with_style) { Shoes::Radio.new(app, parent, group, arg_styles) }
15
- end
16
-
17
- # only one radio in a group can be checked
18
-
19
- describe "#initialize" do
20
- it "sets accessors" do
21
- expect(radio.parent).to eq(parent)
22
- expect(radio.group).to eq(group)
23
- end
24
- end
25
-
26
- describe "#group=" do
27
- it "changes the group" do
28
- radio.group = "New Group"
29
- expect(radio.group).to eq("New Group")
30
- end
31
- end
32
- end
@@ -1,39 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- shared_examples_for "basic rect" do
4
- it "retains app" do
5
- expect(rect.app).to eq(app)
6
- end
7
-
8
- it "creates gui object" do
9
- expect(rect.gui).not_to be_nil
10
- end
11
- end
12
-
13
- describe Shoes::Rect do
14
- include_context "dsl app"
15
-
16
- let(:parent) { app }
17
- let(:left) { 44 }
18
- let(:top) { 66 }
19
- let(:width) { 111 }
20
- let(:height) { 333 }
21
- subject(:rect) { Shoes::Rect.new(app, parent, left, top, width, height) }
22
-
23
- describe '#style' do
24
- it 'restyles handed in fill colors (even the weird ones)' do
25
- subject.style fill: 'fff'
26
- expect(subject.style[:fill]).to eq Shoes::Color.new 255, 255, 255
27
- end
28
- end
29
-
30
- it_behaves_like "basic rect"
31
- it_behaves_like "object with style" do
32
- let(:subject_without_style) { Shoes::Rect.new(app, parent, left, top, width, height) }
33
- let(:subject_with_style) { Shoes::Rect.new(app, parent, left, top, width, height, arg_styles) }
34
- end
35
- it_behaves_like "object with dimensions"
36
- it_behaves_like "movable object"
37
- it_behaves_like "left, top as center"
38
- it_behaves_like 'object with parent'
39
- end
@@ -1,70 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe RenamedDelegate do
4
-
5
- class ToDelegate
6
- def method_key
7
- end
8
-
9
- def abcd
10
- end
11
-
12
- def key
13
- end
14
-
15
- def bla_key
16
- end
17
-
18
- def method_something
19
- end
20
-
21
- def key_something
22
- end
23
- end
24
-
25
- class TestClass
26
- extend RenamedDelegate
27
-
28
- attr_reader :delegate
29
-
30
- def initialize(delegate)
31
- @delegate = delegate
32
- end
33
- end
34
-
35
- TestClass.renamed_delegate_to :delegate,
36
- ToDelegate.public_instance_methods(false),
37
- {'key' => 'shoes', 'something' => 'awesome'}
38
-
39
- let(:delegate) {double('delegate').as_null_object}
40
- subject {TestClass.new delegate}
41
-
42
- def test_renaming(new_name, old_name)
43
- subject.public_send new_name
44
- expect(delegate).to have_received old_name
45
- end
46
-
47
- it 'delegates method_shoes to method_key' do
48
- test_renaming :method_shoes, :method_key
49
- end
50
-
51
- it 'delegates shoes to key' do
52
- test_renaming :shoes, :key
53
- end
54
-
55
- it 'delegates bla_shoes to bla_key' do
56
- test_renaming :bla_shoes, :bla_key
57
- end
58
-
59
- it 'delegates method_awesome to method_something' do
60
- test_renaming :method_awesome, :method_something
61
- end
62
-
63
- it 'also applies multiple renamings' do
64
- test_renaming :shoes_awesome, :key_something
65
- end
66
-
67
- it 'does not define a method for methods without renamings' do
68
- expect(subject).not_to respond_to :abcd
69
- end
70
- end
@@ -1,95 +0,0 @@
1
- require 'shoes/spec_helper'
2
-
3
- describe Shoes::Shape do
4
- include_context "dsl app"
5
-
6
- let(:style) { Hash.new }
7
- let(:draw) { Proc.new { } }
8
-
9
- subject { Shoes::Shape.new app, parent, style, draw }
10
-
11
- it_behaves_like "object with style" do
12
- let(:subject_without_style) { Shoes::Shape.new(app, parent) }
13
- let(:subject_with_style) { Shoes::Shape.new(app, parent, arg_styles) }
14
- end
15
-
16
- it_behaves_like "movable object"
17
-
18
- describe "octagon" do
19
- let(:draw) {
20
- Proc.new {
21
- xs = [200, 300, 370, 370, 300, 200, 130, 130]
22
- ys = [100, 100, 170, 270, 340, 340, 270, 170]
23
- move_to xs.first, ys.first
24
- xs.zip(ys).each do |x, y|
25
- line_to(x, y)
26
- end
27
- line_to xs.first, ys.first
28
- }
29
- }
30
-
31
- its(:left) { should be_nil }
32
- its(:top) { should be_nil }
33
- its(:left_bound) { should eq(130) }
34
- its(:top_bound) { should eq(100) }
35
- its(:right_bound) { should eq(370) }
36
- its(:bottom_bound) { should eq(340) }
37
- its(:width) { should eq(app.width) }
38
- its(:height) { should eq app.height }
39
-
40
- it_behaves_like "movable object"
41
-
42
- describe "when created with left and top values" do
43
- let(:style) { {left: 10, top: 100} }
44
-
45
- its(:left) { should eq(10) }
46
- its(:top) { should eq(100) }
47
- its(:left_bound) { should eq(130) }
48
- its(:top_bound) { should eq(100) }
49
- its(:right_bound) { should eq(370) }
50
- its(:bottom_bound) { should eq(340) }
51
- its(:width) { should eq(app.width) }
52
- its(:height) { should eq app.height }
53
- end
54
- end
55
-
56
- describe "curve" do
57
- let(:draw) {
58
- Proc.new {
59
- move_to 10, 10
60
- curve_to 20, 30, 100, 200, 50, 50
61
- }
62
- }
63
-
64
- its(:left_bound) { should eq(10) }
65
- its(:top_bound) { should eq(10) }
66
- its(:right_bound) { should eq(100) }
67
- its(:bottom_bound) { should eq(200) }
68
- its(:width) { should eq(app.width) }
69
- its(:height) { should eq app.height }
70
-
71
- it_behaves_like "movable object"
72
- end
73
-
74
- describe "arc" do
75
- let(:draw) {
76
- Proc.new {
77
- arc 10, 10, 100, 100, Shoes::PI, Shoes::TWO_PI
78
- }
79
- }
80
-
81
- it_behaves_like "movable object"
82
- end
83
-
84
- describe "accesses app" do
85
- let(:draw) {
86
- Proc.new {
87
- background Shoes::COLORS[:red]
88
- stroke Shoes::COLORS[:blue]
89
- rect 10, 10, 100, 100
90
- }
91
- }
92
-
93
- it_behaves_like "movable object"
94
- end
95
- end