shoes 4.0.0.pre1 → 4.0.0.pre2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +84 -32
- data/Gemfile +22 -1
- data/README.md +28 -13
- data/Rakefile +7 -210
- data/bin/ruby-shoes +2 -2
- data/ext/install/shoes.bat +4 -1
- data/lib/shoes.rb +1 -121
- data/lib/shoes/{cli.rb → ui/cli.rb} +7 -1
- data/lib/shoes/{help.rb → ui/help.rb} +2 -2
- data/lib/shoes/{manual.rb → ui/manual.rb} +1 -1
- data/lib/shoes/version.rb +1 -1
- data/manifests/common.rb +34 -0
- data/manifests/shoes.rb +44 -0
- data/samples/Gemfile +3 -0
- data/samples/Gemfile.lock +35 -0
- data/samples/README +16 -5
- data/samples/boom.rb +239 -0
- data/samples/clicky.rb +24 -0
- data/samples/flow.rb +63 -0
- data/samples/gray.rb +11 -0
- data/samples/nks_booklist.rb +24 -0
- data/samples/nks_breadsticks.rb +7 -0
- data/samples/nks_dancing_circle.rb +13 -0
- data/samples/nks_dictionary.rb +23 -0
- data/samples/nks_edit_box.rb +4 -0
- data/samples/nks_edit_line.rb +6 -0
- data/samples/nks_notes.rb +16 -0
- data/samples/nks_self.rb +6 -0
- data/samples/nks_text_sizes.rb +10 -0
- data/samples/nks_trurl.rb +5 -0
- data/samples/packaging/package_me.rb +6 -0
- data/samples/present.rb +27 -0
- data/samples/progress.rb +10 -0
- data/samples/sample31.rb +1 -1
- data/samples/simple-calc.rb +1 -1
- data/samples/simple-tictactoe.rb +238 -0
- data/samples/simple-visibility.rb +11 -0
- data/samples/simple-widget.rb +9 -0
- data/samples/swt-raw.rb +20 -0
- data/samples/troll.rb +22 -0
- data/shoes.gemspec +10 -22
- data/snapshots/sample56.png +0 -0
- data/static/manual-en.txt +16 -7
- data/tasks/changelog.rb +92 -0
- data/tasks/gem.rb +38 -0
- data/tasks/rspec.rb +106 -0
- data/tasks/sample.rb +66 -0
- data/tasks/yard.rb +13 -0
- metadata +55 -488
- data/.gitignore +0 -53
- data/.rspec +0 -3
- data/.ruby-gemset +0 -1
- data/.ruby-version +0 -1
- data/.travis.yml +0 -31
- data/bin/shoes +0 -59
- data/bin/shoes.bat +0 -6
- data/fonts/Coolvetica.ttf +0 -0
- data/fonts/Lacuna.ttf +0 -0
- data/lib/ext/highlighter.rb +0 -2
- data/lib/ext/highlighter/common.rb +0 -197
- data/lib/ext/highlighter/lang/ruby.rb +0 -316
- data/lib/ext/highlighter/markup.rb +0 -222
- data/lib/rubygems_plugin.rb +0 -19
- data/lib/shoes/animation.rb +0 -55
- data/lib/shoes/app.rb +0 -320
- data/lib/shoes/arc.rb +0 -35
- data/lib/shoes/background.rb +0 -30
- data/lib/shoes/border.rb +0 -33
- data/lib/shoes/builtin_methods.rb +0 -73
- data/lib/shoes/button.rb +0 -32
- data/lib/shoes/check_button.rb +0 -43
- data/lib/shoes/color.rb +0 -375
- data/lib/shoes/common/background_element.rb +0 -9
- data/lib/shoes/common/changeable.rb +0 -34
- data/lib/shoes/common/clickable.rb +0 -17
- data/lib/shoes/common/common_methods.rb +0 -70
- data/lib/shoes/common/fill.rb +0 -21
- data/lib/shoes/common/registration.rb +0 -33
- data/lib/shoes/common/state.rb +0 -18
- data/lib/shoes/common/stroke.rb +0 -28
- data/lib/shoes/common/style.rb +0 -34
- data/lib/shoes/common/style_normalizer.rb +0 -16
- data/lib/shoes/configuration.rb +0 -96
- data/lib/shoes/dialog.rb +0 -27
- data/lib/shoes/dimension.rb +0 -237
- data/lib/shoes/dimensions.rb +0 -194
- data/lib/shoes/download.rb +0 -117
- data/lib/shoes/dsl.rb +0 -478
- data/lib/shoes/font.rb +0 -49
- data/lib/shoes/gradient.rb +0 -18
- data/lib/shoes/image.rb +0 -33
- data/lib/shoes/image_pattern.rb +0 -10
- data/lib/shoes/input_box.rb +0 -68
- data/lib/shoes/key_event.rb +0 -17
- data/lib/shoes/line.rb +0 -38
- data/lib/shoes/link.rb +0 -49
- data/lib/shoes/link_hover.rb +0 -5
- data/lib/shoes/list_box.rb +0 -44
- data/lib/shoes/logger.rb +0 -66
- data/lib/shoes/logger/ruby.rb +0 -18
- data/lib/shoes/mock.rb +0 -30
- data/lib/shoes/mock/animation.rb +0 -8
- data/lib/shoes/mock/app.rb +0 -44
- data/lib/shoes/mock/arc.rb +0 -8
- data/lib/shoes/mock/background.rb +0 -10
- data/lib/shoes/mock/border.rb +0 -7
- data/lib/shoes/mock/button.rb +0 -10
- data/lib/shoes/mock/check.rb +0 -24
- data/lib/shoes/mock/common_methods.rb +0 -11
- data/lib/shoes/mock/dialog.rb +0 -13
- data/lib/shoes/mock/download.rb +0 -18
- data/lib/shoes/mock/font.rb +0 -17
- data/lib/shoes/mock/image.rb +0 -12
- data/lib/shoes/mock/image_pattern.rb +0 -9
- data/lib/shoes/mock/input_box.rb +0 -23
- data/lib/shoes/mock/keypress.rb +0 -8
- data/lib/shoes/mock/keyrelease.rb +0 -8
- data/lib/shoes/mock/line.rb +0 -14
- data/lib/shoes/mock/link.rb +0 -11
- data/lib/shoes/mock/list_box.rb +0 -16
- data/lib/shoes/mock/oval.rb +0 -11
- data/lib/shoes/mock/progress.rb +0 -10
- data/lib/shoes/mock/radio.rb +0 -26
- data/lib/shoes/mock/rect.rb +0 -13
- data/lib/shoes/mock/shape.rb +0 -19
- data/lib/shoes/mock/slot.rb +0 -14
- data/lib/shoes/mock/sound.rb +0 -8
- data/lib/shoes/mock/star.rb +0 -13
- data/lib/shoes/mock/text_block.rb +0 -29
- data/lib/shoes/mock/timer.rb +0 -8
- data/lib/shoes/oval.rb +0 -28
- data/lib/shoes/point.rb +0 -43
- data/lib/shoes/progress.rb +0 -26
- data/lib/shoes/radio.rb +0 -15
- data/lib/shoes/rect.rb +0 -28
- data/lib/shoes/renamed_delegate.rb +0 -15
- data/lib/shoes/shape.rb +0 -175
- data/lib/shoes/slot.rb +0 -232
- data/lib/shoes/slot_contents.rb +0 -56
- data/lib/shoes/sound.rb +0 -16
- data/lib/shoes/span.rb +0 -16
- data/lib/shoes/star.rb +0 -49
- data/lib/shoes/swt.rb +0 -114
- data/lib/shoes/swt/animation.rb +0 -46
- data/lib/shoes/swt/app.rb +0 -300
- data/lib/shoes/swt/arc.rb +0 -70
- data/lib/shoes/swt/background.rb +0 -31
- data/lib/shoes/swt/border.rb +0 -37
- data/lib/shoes/swt/button.rb +0 -18
- data/lib/shoes/swt/check.rb +0 -14
- data/lib/shoes/swt/check_button.rb +0 -19
- data/lib/shoes/swt/color.rb +0 -45
- data/lib/shoes/swt/common/child.rb +0 -16
- data/lib/shoes/swt/common/clear.rb +0 -24
- data/lib/shoes/swt/common/clickable.rb +0 -62
- data/lib/shoes/swt/common/container.rb +0 -28
- data/lib/shoes/swt/common/fill.rb +0 -37
- data/lib/shoes/swt/common/painter.rb +0 -83
- data/lib/shoes/swt/common/painter_updates_position.rb +0 -12
- data/lib/shoes/swt/common/resource.rb +0 -14
- data/lib/shoes/swt/common/selection_listener.rb +0 -14
- data/lib/shoes/swt/common/stroke.rb +0 -41
- data/lib/shoes/swt/common/toggle.rb +0 -13
- data/lib/shoes/swt/common/update_position.rb +0 -15
- data/lib/shoes/swt/dialog.rb +0 -89
- data/lib/shoes/swt/disposed_protection.rb +0 -23
- data/lib/shoes/swt/download.rb +0 -24
- data/lib/shoes/swt/fitted_text_layout.rb +0 -94
- data/lib/shoes/swt/fitted_text_layout_collection.rb +0 -108
- data/lib/shoes/swt/font.rb +0 -32
- data/lib/shoes/swt/gradient.rb +0 -77
- data/lib/shoes/swt/image.rb +0 -130
- data/lib/shoes/swt/image_pattern.rb +0 -19
- data/lib/shoes/swt/input_box.rb +0 -73
- data/lib/shoes/swt/key_listener.rb +0 -145
- data/lib/shoes/swt/line.rb +0 -57
- data/lib/shoes/swt/link.rb +0 -37
- data/lib/shoes/swt/link_segment.rb +0 -108
- data/lib/shoes/swt/list_box.rb +0 -49
- data/lib/shoes/swt/mouse_move_listener.rb +0 -61
- data/lib/shoes/swt/oval.rb +0 -53
- data/lib/shoes/swt/progress.rb +0 -35
- data/lib/shoes/swt/radio.rb +0 -29
- data/lib/shoes/swt/radio_group.rb +0 -54
- data/lib/shoes/swt/rect.rb +0 -31
- data/lib/shoes/swt/rect_painter.rb +0 -23
- data/lib/shoes/swt/redrawing_aspect.rb +0 -122
- data/lib/shoes/swt/shape.rb +0 -101
- data/lib/shoes/swt/shoes_layout.rb +0 -43
- data/lib/shoes/swt/slot.rb +0 -25
- data/lib/shoes/swt/sound.rb +0 -119
- data/lib/shoes/swt/star.rb +0 -51
- data/lib/shoes/swt/swt_button.rb +0 -49
- data/lib/shoes/swt/text_block.rb +0 -133
- data/lib/shoes/swt/text_block_cursor_painter.rb +0 -112
- data/lib/shoes/swt/text_block_fitter.rb +0 -180
- data/lib/shoes/swt/text_block_painter.rb +0 -49
- data/lib/shoes/swt/text_font_factory.rb +0 -27
- data/lib/shoes/swt/text_style_factory.rb +0 -88
- data/lib/shoes/swt/timer.rb +0 -19
- data/lib/shoes/swt/tooling/leak_hunter.rb +0 -84
- data/lib/shoes/text.rb +0 -14
- data/lib/shoes/text_block.rb +0 -162
- data/lib/shoes/timer.rb +0 -10
- data/lib/shoes/url.rb +0 -47
- data/lib/shoes/widget.rb +0 -73
- data/lib/support/jl1.0.1.jar +0 -0
- data/lib/support/jogg-0.0.7.jar +0 -0
- data/lib/support/jorbis-0.0.15.jar +0 -0
- data/lib/support/log4j-1.2.16.jar +0 -0
- data/lib/support/mp3spi1.9.5.jar +0 -0
- data/lib/support/tritonus_share.jar +0 -0
- data/lib/support/vorbisspi1.0.3.jar +0 -0
- data/samples/good-clock-adjusted.rb +0 -49
- data/spec/async_helper.rb +0 -21
- data/spec/code_coverage.rb +0 -11
- data/spec/shoes/animation_spec.rb +0 -65
- data/spec/shoes/app_spec.rb +0 -411
- data/spec/shoes/arc_spec.rb +0 -53
- data/spec/shoes/background_spec.rb +0 -48
- data/spec/shoes/border_spec.rb +0 -43
- data/spec/shoes/builtin_methods_spec.rb +0 -84
- data/spec/shoes/button_spec.rb +0 -41
- data/spec/shoes/check_spec.rb +0 -31
- data/spec/shoes/cli_spec.rb +0 -16
- data/spec/shoes/color_spec.rb +0 -396
- data/spec/shoes/common/style_normalizer_spec.rb +0 -28
- data/spec/shoes/common/style_spec.rb +0 -58
- data/spec/shoes/configuration_spec.rb +0 -37
- data/spec/shoes/constants_spec.rb +0 -38
- data/spec/shoes/dialog_spec.rb +0 -163
- data/spec/shoes/dimension_spec.rb +0 -381
- data/spec/shoes/dimensions_spec.rb +0 -831
- data/spec/shoes/download_spec.rb +0 -133
- data/spec/shoes/flow_spec.rb +0 -92
- data/spec/shoes/font_spec.rb +0 -38
- data/spec/shoes/framework_learning_spec.rb +0 -30
- data/spec/shoes/helpers/fake_element.rb +0 -11
- data/spec/shoes/helpers/sample17_helper.rb +0 -66
- data/spec/shoes/image_spec.rb +0 -45
- data/spec/shoes/images/shoe.jpg +0 -0
- data/spec/shoes/input_box_spec.rb +0 -44
- data/spec/shoes/integration_spec.rb +0 -20
- data/spec/shoes/keypress_spec.rb +0 -11
- data/spec/shoes/keyrelease_spec.rb +0 -12
- data/spec/shoes/line_spec.rb +0 -47
- data/spec/shoes/link_spec.rb +0 -89
- data/spec/shoes/list_box_spec.rb +0 -63
- data/spec/shoes/logger/ruby_spec.rb +0 -9
- data/spec/shoes/logger_spec.rb +0 -45
- data/spec/shoes/oval_spec.rb +0 -20
- data/spec/shoes/point_spec.rb +0 -51
- data/spec/shoes/progress_spec.rb +0 -40
- data/spec/shoes/radio_spec.rb +0 -28
- data/spec/shoes/rect_spec.rb +0 -38
- data/spec/shoes/renamed_delegate_spec.rb +0 -70
- data/spec/shoes/shape_spec.rb +0 -54
- data/spec/shoes/shared_examples/button.rb +0 -6
- data/spec/shoes/shared_examples/changeable.rb +0 -26
- data/spec/shoes/shared_examples/clickable.rb +0 -5
- data/spec/shoes/shared_examples/common_methods.rb +0 -42
- data/spec/shoes/shared_examples/dimensions.rb +0 -32
- data/spec/shoes/shared_examples/dsl.rb +0 -42
- data/spec/shoes/shared_examples/dsl/animate.rb +0 -29
- data/spec/shoes/shared_examples/dsl/arc.rb +0 -45
- data/spec/shoes/shared_examples/dsl/background.rb +0 -26
- data/spec/shoes/shared_examples/dsl/border.rb +0 -10
- data/spec/shoes/shared_examples/dsl/cap.rb +0 -6
- data/spec/shoes/shared_examples/dsl/check.rb +0 -11
- data/spec/shoes/shared_examples/dsl/edit_box.rb +0 -8
- data/spec/shoes/shared_examples/dsl/edit_line.rb +0 -8
- data/spec/shoes/shared_examples/dsl/editable_element.rb +0 -29
- data/spec/shoes/shared_examples/dsl/fill.rb +0 -27
- data/spec/shoes/shared_examples/dsl/flow.rb +0 -15
- data/spec/shoes/shared_examples/dsl/gradient.rb +0 -52
- data/spec/shoes/shared_examples/dsl/image.rb +0 -21
- data/spec/shoes/shared_examples/dsl/line.rb +0 -9
- data/spec/shoes/shared_examples/dsl/nofill.rb +0 -6
- data/spec/shoes/shared_examples/dsl/nostroke.rb +0 -6
- data/spec/shoes/shared_examples/dsl/oval.rb +0 -60
- data/spec/shoes/shared_examples/dsl/pattern.rb +0 -34
- data/spec/shoes/shared_examples/dsl/progress.rb +0 -7
- data/spec/shoes/shared_examples/dsl/rect.rb +0 -92
- data/spec/shoes/shared_examples/dsl/rgb.rb +0 -26
- data/spec/shoes/shared_examples/dsl/shape.rb +0 -21
- data/spec/shoes/shared_examples/dsl/star.rb +0 -48
- data/spec/shoes/shared_examples/dsl/stroke.rb +0 -30
- data/spec/shoes/shared_examples/dsl/strokewidth.rb +0 -19
- data/spec/shoes/shared_examples/dsl/style.rb +0 -32
- data/spec/shoes/shared_examples/dsl/text_elements.rb +0 -81
- data/spec/shoes/shared_examples/dsl_app_context.rb +0 -8
- data/spec/shoes/shared_examples/hover_leave.rb +0 -11
- data/spec/shoes/shared_examples/parent.rb +0 -6
- data/spec/shoes/shared_examples/shared_element_method.rb +0 -52
- data/spec/shoes/shared_examples/slot.rb +0 -272
- data/spec/shoes/shared_examples/state.rb +0 -19
- data/spec/shoes/shared_examples/style.rb +0 -24
- data/spec/shoes/slot_spec.rb +0 -60
- data/spec/shoes/sound_spec.rb +0 -15
- data/spec/shoes/span_spec.rb +0 -94
- data/spec/shoes/spec_helper.rb +0 -1
- data/spec/shoes/stack_spec.rb +0 -53
- data/spec/shoes/star_spec.rb +0 -30
- data/spec/shoes/text_block_spec.rb +0 -242
- data/spec/shoes/url_spec.rb +0 -66
- data/spec/shoes/widget_spec.rb +0 -34
- data/spec/shoes_spec.rb +0 -44
- data/spec/spec_helper.rb +0 -16
- data/spec/swt_shoes/animation_spec.rb +0 -86
- data/spec/swt_shoes/app_spec.rb +0 -75
- data/spec/swt_shoes/arc_spec.rb +0 -101
- data/spec/swt_shoes/background_spec.rb +0 -56
- data/spec/swt_shoes/border_spec.rb +0 -51
- data/spec/swt_shoes/button_spec.rb +0 -101
- data/spec/swt_shoes/check_spec.rb +0 -28
- data/spec/swt_shoes/color_spec.rb +0 -67
- data/spec/swt_shoes/common/painter_spec.rb +0 -29
- data/spec/swt_shoes/configuration_spec.rb +0 -12
- data/spec/swt_shoes/dialog_spec.rb +0 -106
- data/spec/swt_shoes/disposed_protection_spec.rb +0 -49
- data/spec/swt_shoes/fitted_text_layout_collection_spec.rb +0 -174
- data/spec/swt_shoes/fitted_text_layout_spec.rb +0 -130
- data/spec/swt_shoes/flow_spec.rb +0 -26
- data/spec/swt_shoes/font_spec.rb +0 -33
- data/spec/swt_shoes/gradient_spec.rb +0 -20
- data/spec/swt_shoes/image_pattern_spec.rb +0 -19
- data/spec/swt_shoes/image_spec.rb +0 -100
- data/spec/swt_shoes/input_box_spec.rb +0 -110
- data/spec/swt_shoes/integration_spec.rb +0 -18
- data/spec/swt_shoes/key_listener_spec.rb +0 -320
- data/spec/swt_shoes/line_spec.rb +0 -43
- data/spec/swt_shoes/link_segment_spec.rb +0 -103
- data/spec/swt_shoes/link_spec.rb +0 -59
- data/spec/swt_shoes/list_box_spec.rb +0 -51
- data/spec/swt_shoes/minimal.png +0 -0
- data/spec/swt_shoes/mouse_move_listener_spec.rb +0 -129
- data/spec/swt_shoes/oval_spec.rb +0 -51
- data/spec/swt_shoes/progress_spec.rb +0 -44
- data/spec/swt_shoes/radio_group_spec.rb +0 -73
- data/spec/swt_shoes/radio_spec.rb +0 -56
- data/spec/swt_shoes/rect_painter_spec.rb +0 -45
- data/spec/swt_shoes/rect_spec.rb +0 -19
- data/spec/swt_shoes/shape_spec.rb +0 -81
- data/spec/swt_shoes/shared_examples/button.rb +0 -24
- data/spec/swt_shoes/shared_examples/clearable.rb +0 -32
- data/spec/swt_shoes/shared_examples/clickable.rb +0 -60
- data/spec/swt_shoes/shared_examples/movable.rb +0 -36
- data/spec/swt_shoes/shared_examples/paintable_spec.rb +0 -7
- data/spec/swt_shoes/shared_examples/painter.rb +0 -83
- data/spec/swt_shoes/shared_examples/pattern.rb +0 -32
- data/spec/swt_shoes/shared_examples/swt_app_context.rb +0 -17
- data/spec/swt_shoes/shared_examples/togglable.rb +0 -15
- data/spec/swt_shoes/shell_control_listener_spec.rb +0 -23
- data/spec/swt_shoes/sound.rb +0 -10
- data/spec/swt_shoes/spec_helper.rb +0 -31
- data/spec/swt_shoes/star_spec.rb +0 -47
- data/spec/swt_shoes/text_block_cursor_painter_spec.rb +0 -202
- data/spec/swt_shoes/text_block_fitter_spec.rb +0 -181
- data/spec/swt_shoes/text_block_painter_spec.rb +0 -221
- data/spec/swt_shoes/text_block_spec.rb +0 -183
@@ -1,48 +0,0 @@
|
|
1
|
-
shared_examples_for "star DSL method" do
|
2
|
-
it "creates a Shoes::Star" do
|
3
|
-
expect(dsl.star(30, 20)).to be_an_instance_of(Shoes::Star)
|
4
|
-
end
|
5
|
-
|
6
|
-
it "raises an ArgumentError with just one argument" do
|
7
|
-
lambda { dsl.star(30) }.should raise_error(ArgumentError)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe 'instantiation' do
|
11
|
-
let(:left) {10}
|
12
|
-
let(:top) {20}
|
13
|
-
let(:points) {15}
|
14
|
-
let(:outer) {27}
|
15
|
-
let(:inner) {33}
|
16
|
-
DEFAULT_POINTS = 10
|
17
|
-
DEFAULT_OUTER = 100.0
|
18
|
-
DEFAULT_INNER = 50.0
|
19
|
-
|
20
|
-
describe '2 arguments' do
|
21
|
-
subject {dsl.star left, top}
|
22
|
-
its(:left) {should eq left}
|
23
|
-
its(:top) {should eq top}
|
24
|
-
its(:points) {should eq DEFAULT_POINTS}
|
25
|
-
its(:outer) {should eq DEFAULT_OUTER}
|
26
|
-
its(:inner) {should eq DEFAULT_INNER}
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '4 arguments' do
|
30
|
-
subject {dsl.star left, top, points, outer}
|
31
|
-
its(:left) {should eq left}
|
32
|
-
its(:top) {should eq top}
|
33
|
-
its(:points) {should eq points}
|
34
|
-
its(:outer) {should eq outer}
|
35
|
-
its(:inner) {should eq DEFAULT_INNER}
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '5 arguments' do
|
39
|
-
subject {dsl.star left, top, points, outer, inner}
|
40
|
-
its(:left) {should eq left}
|
41
|
-
its(:top) {should eq top}
|
42
|
-
its(:points) {should eq points}
|
43
|
-
its(:outer) {should eq outer}
|
44
|
-
its(:inner) {should eq inner}
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
shared_examples_for "stroke DSL method" do
|
2
|
-
let(:color) { Shoes::COLORS.fetch :tomato }
|
3
|
-
|
4
|
-
it "returns a color" do
|
5
|
-
dsl.stroke(color).class.should eq(Shoes::Color)
|
6
|
-
end
|
7
|
-
|
8
|
-
# This works differently on a container than on a normal element
|
9
|
-
it "sets on receiver" do
|
10
|
-
dsl.stroke color
|
11
|
-
dsl.style[:stroke].should eq(color)
|
12
|
-
end
|
13
|
-
|
14
|
-
it "applies to subsequently created objects" do
|
15
|
-
dsl.stroke color
|
16
|
-
Shoes::Oval.should_receive(:new).with do |*args|
|
17
|
-
style = args.pop
|
18
|
-
style[:stroke].should eq(color)
|
19
|
-
end
|
20
|
-
dsl.oval(10, 10, 100, 100)
|
21
|
-
end
|
22
|
-
|
23
|
-
context "with hex string" do
|
24
|
-
let(:color) { "#fff" }
|
25
|
-
|
26
|
-
it "sets the color" do
|
27
|
-
dsl.stroke(color).should eq(Shoes::COLORS[:white])
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
shared_examples_for "strokewidth DSL method" do
|
2
|
-
it "returns a number" do
|
3
|
-
dsl.strokewidth(4).should eq(4)
|
4
|
-
end
|
5
|
-
|
6
|
-
it "sets on receiver" do
|
7
|
-
dsl.strokewidth 4
|
8
|
-
dsl.style[:strokewidth].should eq(4)
|
9
|
-
end
|
10
|
-
|
11
|
-
it "applies to subsequently created objects" do
|
12
|
-
dsl.strokewidth 6
|
13
|
-
Shoes::Oval.should_receive(:new).with do |*args|
|
14
|
-
style = args.pop
|
15
|
-
style[:strokewidth].should eq(6)
|
16
|
-
end
|
17
|
-
dsl.oval(10, 10, 100, 100)
|
18
|
-
end
|
19
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
shared_examples_for "style DSL method" do
|
2
|
-
describe "setting new defaults for text block" do
|
3
|
-
let(:stroke) { Shoes::COLORS[:chartreuse] }
|
4
|
-
let(:size) { 42 }
|
5
|
-
let(:fill) { Shoes::COLORS[:peru] }
|
6
|
-
let(:font ) { "SOME FONT" }
|
7
|
-
let(:style) { {:stroke => stroke, :size => size, :fill => fill, :font => font} }
|
8
|
-
|
9
|
-
%w(Banner Title Subtitle Tagline Caption Para Inscription).each do |text_block|
|
10
|
-
describe text_block do
|
11
|
-
let(:element) { dsl.public_send text_block.downcase, "Hello!" }
|
12
|
-
let(:klass) { Shoes.const_get(text_block) }
|
13
|
-
|
14
|
-
before :each do
|
15
|
-
dsl.style klass, style
|
16
|
-
end
|
17
|
-
|
18
|
-
it "creates element with appropriate class" do
|
19
|
-
element.class.should eq(klass)
|
20
|
-
end
|
21
|
-
|
22
|
-
it "sets size" do
|
23
|
-
element.font_size.should eq(size)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "sets font" do
|
27
|
-
element.font.should eq(font)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
@@ -1,81 +0,0 @@
|
|
1
|
-
shared_examples_for "text element DSL methods" do
|
2
|
-
it "should set banner font size to 48" do
|
3
|
-
text_block = dsl.banner("hello!")
|
4
|
-
expect(text_block.font_size).to eql 48
|
5
|
-
end
|
6
|
-
|
7
|
-
it "should set title font size to 34" do
|
8
|
-
text_block = dsl.title("hello!")
|
9
|
-
expect(text_block.font_size).to eql 34
|
10
|
-
end
|
11
|
-
|
12
|
-
it "should set subtitle font size to 26" do
|
13
|
-
text_block = dsl.subtitle("hello!")
|
14
|
-
expect(text_block.font_size).to eql 26
|
15
|
-
end
|
16
|
-
|
17
|
-
it "should set tagline font size to 18" do
|
18
|
-
text_block = dsl.tagline("hello!")
|
19
|
-
expect(text_block.font_size).to eql 18
|
20
|
-
end
|
21
|
-
|
22
|
-
it "should set caption font size to 14" do
|
23
|
-
text_block = dsl.caption("hello!")
|
24
|
-
expect(text_block.font_size).to eql 14
|
25
|
-
end
|
26
|
-
|
27
|
-
it "should set para font size to 12" do
|
28
|
-
text_block = dsl.para("hello!")
|
29
|
-
expect(text_block.font_size).to eql 12
|
30
|
-
end
|
31
|
-
|
32
|
-
it "should set inscription font size to 10" do
|
33
|
-
text_block = dsl.inscription("hello!")
|
34
|
-
expect(text_block.font_size).to eql 10
|
35
|
-
end
|
36
|
-
|
37
|
-
describe 'span' do
|
38
|
-
it 'should parse the color' do
|
39
|
-
span = dsl.span 'Hello', stroke: '#ccc'
|
40
|
-
expect(span.opts[:stroke]).to eq Shoes::Color.new 204, 204, 204
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should handle a splatted array of links' do
|
44
|
-
expect{dsl.span *[dsl.link('foo'), dsl.link('foo')]}.not_to raise_error
|
45
|
-
end
|
46
|
-
|
47
|
-
it 'should handle a splatted array of links and parse the color' do
|
48
|
-
span = dsl.span *[dsl.link('foo'), dsl.link('foo')], stroke: '#ccc'
|
49
|
-
expect(span.opts[:stroke]).to eq Shoes::Color.new 204, 204, 204
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'should handle a splatted array of links with a block' do
|
53
|
-
link = dsl.link('foo') { "Bar" }
|
54
|
-
expect{dsl.span *[link, link]}.not_to raise_error
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe 'link' do
|
59
|
-
it 'handles multiple texts' do
|
60
|
-
link = dsl.link('one', 'two')
|
61
|
-
expect(link.to_s).to eql('onetwo')
|
62
|
-
end
|
63
|
-
|
64
|
-
it 'handles trailing options' do
|
65
|
-
link = dsl.link('one', 'two', stroke: '#ccc')
|
66
|
-
expect(link.to_s).to eql('onetwo')
|
67
|
-
expect(link.opts[:stroke]).to eq Shoes::Color.new 204, 204, 204
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
describe 'para' do
|
72
|
-
context "with nested text fragments with parameters" do
|
73
|
-
Shoes::DSL::TEXT_STYLES.keys.each do |style|
|
74
|
-
it "handles opts properly for #{style}" do
|
75
|
-
para = dsl.para(dsl.send(style, style, stroke: '#ccc'))
|
76
|
-
expect(para.text).to eq(style.to_s)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
@@ -1,8 +0,0 @@
|
|
1
|
-
shared_context "dsl app" do
|
2
|
-
let(:input_block) { Proc.new {} }
|
3
|
-
let(:input_opts) { Hash.new }
|
4
|
-
let(:user_facing_app) { Shoes::App.new input_opts &input_block }
|
5
|
-
let(:app) { user_facing_app.instance_variable_get(:@__app__) }
|
6
|
-
let(:parent) { Shoes::Flow.new app, app }
|
7
|
-
end
|
8
|
-
|
@@ -1,11 +0,0 @@
|
|
1
|
-
shared_examples "hover and leave events" do
|
2
|
-
let(:proc) {Proc.new do end}
|
3
|
-
|
4
|
-
it 'can execute hover without raising an error' do
|
5
|
-
expect{subject.hover proc}.not_to raise_error
|
6
|
-
end
|
7
|
-
|
8
|
-
it 'can execute leave without raising an error' do
|
9
|
-
expect{subject.leave proc}.not_to raise_error
|
10
|
-
end
|
11
|
-
end
|
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'shoes/color'
|
2
|
-
|
3
|
-
shared_examples_for "object with stroke" do
|
4
|
-
let(:color) { Shoes::COLORS.fetch :tomato }
|
5
|
-
|
6
|
-
specify "returns a color" do
|
7
|
-
c = subject.stroke = color
|
8
|
-
c.class.should eq(Shoes::Color)
|
9
|
-
end
|
10
|
-
|
11
|
-
specify "sets on receiver" do
|
12
|
-
subject.stroke = color
|
13
|
-
subject.stroke.should eq(color)
|
14
|
-
subject.style[:stroke].should eq(color)
|
15
|
-
end
|
16
|
-
|
17
|
-
# Be sure the subject does *not* have the stroke set previously
|
18
|
-
specify "defaults to black" do
|
19
|
-
subject.stroke.should eq(Shoes::COLORS.fetch :black)
|
20
|
-
end
|
21
|
-
|
22
|
-
describe "strokewidth" do
|
23
|
-
specify "defaults to 1" do
|
24
|
-
subject.strokewidth.should eq(1)
|
25
|
-
end
|
26
|
-
|
27
|
-
specify "sets" do
|
28
|
-
subject.strokewidth = 2
|
29
|
-
subject.strokewidth.should eq(2)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
shared_examples_for "object with fill" do
|
35
|
-
let(:color) { Shoes::COLORS.fetch :honeydew }
|
36
|
-
|
37
|
-
specify "returns a color" do
|
38
|
-
c = subject.fill = color
|
39
|
-
c.class.should eq(Shoes::Color)
|
40
|
-
end
|
41
|
-
|
42
|
-
specify "sets on receiver" do
|
43
|
-
subject.fill = color
|
44
|
-
subject.fill.should eq(color)
|
45
|
-
subject.style[:fill].should eq(color)
|
46
|
-
end
|
47
|
-
|
48
|
-
# Be sure the subject does *not* have the stroke set previously
|
49
|
-
specify "defaults to black" do
|
50
|
-
subject.fill.should eq(Shoes::COLORS.fetch :black)
|
51
|
-
end
|
52
|
-
end
|
@@ -1,272 +0,0 @@
|
|
1
|
-
require 'shoes/spec_helper'
|
2
|
-
|
3
|
-
shared_examples_for "Slot" do
|
4
|
-
it "should be able to append" do
|
5
|
-
subject.contents.should be_empty
|
6
|
-
our_subject = subject
|
7
|
-
app.execute_block Proc.new { our_subject.append {para "foo"} }
|
8
|
-
subject.contents.size.should eq(1)
|
9
|
-
end
|
10
|
-
|
11
|
-
it_behaves_like 'prepending'
|
12
|
-
it_behaves_like 'clearing'
|
13
|
-
it_behaves_like 'element one positioned with bottom and right'
|
14
|
-
end
|
15
|
-
|
16
|
-
shared_context 'one slot child' do
|
17
|
-
let(:ele_opts) {Hash.new}
|
18
|
-
let(:element) {Shoes::FakeElement.new(nil, {height: 100,width: 50}.merge(ele_opts))}
|
19
|
-
|
20
|
-
before :each do
|
21
|
-
subject.add_child element
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
shared_context 'two slot children' do
|
26
|
-
include_context 'one slot child'
|
27
|
-
let(:element2) {Shoes::FakeElement.new nil, height: 200, width: 70}
|
28
|
-
|
29
|
-
before :each do
|
30
|
-
subject.add_child element2
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
shared_context 'contents_alignment' do
|
35
|
-
before :each do
|
36
|
-
subject.contents_alignment
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
shared_context 'element one with top and left' do
|
41
|
-
let(:ele_top) {22}
|
42
|
-
let(:ele_left) {47}
|
43
|
-
let(:ele_opts) {{left: ele_left, top: ele_top}}
|
44
|
-
end
|
45
|
-
|
46
|
-
shared_context 'element one with bottom and right' do
|
47
|
-
let(:ele_bottom) {24}
|
48
|
-
let(:ele_right) {49}
|
49
|
-
let(:ele_opts) {{right: ele_right, bottom: ele_bottom}}
|
50
|
-
end
|
51
|
-
|
52
|
-
shared_examples_for 'positioning through :_position' do
|
53
|
-
|
54
|
-
let(:element) {Shoes::FakeElement.new nil, height: 100, width: 50}
|
55
|
-
|
56
|
-
def add_child_and_align
|
57
|
-
subject.add_child element
|
58
|
-
subject.contents_alignment
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'sends the child the :_position method to position it' do
|
62
|
-
expect(element).to receive(:_position).and_call_original
|
63
|
-
add_child_and_align
|
64
|
-
end
|
65
|
-
|
66
|
-
it 'does not send _position again if the position did not change' do
|
67
|
-
add_child_and_align
|
68
|
-
expect(element).not_to receive(:_position)
|
69
|
-
subject.contents_alignment
|
70
|
-
end
|
71
|
-
|
72
|
-
it 'does not position an element if it does not need positioning' do
|
73
|
-
my_element = element
|
74
|
-
my_element.stub needs_to_be_positioned?: false
|
75
|
-
expect(my_element).not_to receive :_position
|
76
|
-
subject.add_child my_element
|
77
|
-
subject.contents_alignment
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
shared_examples_for 'element one positioned with top and left' do
|
82
|
-
it 'positions the element at its left value' do
|
83
|
-
element.absolute_left.should eq subject.absolute_left + ele_left
|
84
|
-
end
|
85
|
-
|
86
|
-
it 'positions the element at its top value' do
|
87
|
-
element.absolute_top.should eq subject.absolute_top + ele_top
|
88
|
-
end
|
89
|
-
end
|
90
|
-
|
91
|
-
shared_examples_for 'element one positioned with bottom and right' do
|
92
|
-
include_context 'one slot child'
|
93
|
-
include_context 'contents_alignment'
|
94
|
-
include_context 'element one with bottom and right'
|
95
|
-
|
96
|
-
it 'positions the element from its right' do
|
97
|
-
expect(element.absolute_right).to eq (subject.absolute_right - ele_right - 1)
|
98
|
-
end
|
99
|
-
|
100
|
-
it 'positions the element from its bottom' do
|
101
|
-
expect(element.absolute_bottom).to eq (subject.absolute_bottom - ele_bottom - 1)
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
shared_examples_for 'positions the first element in the top left' do
|
106
|
-
include_context 'one slot child'
|
107
|
-
include_context 'contents_alignment'
|
108
|
-
it 'positions a single object at the same top as self' do
|
109
|
-
element.absolute_top.should eq subject.element_top
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'positions a single object at the same left as self' do
|
113
|
-
element.absolute_left.should eq subject.element_left
|
114
|
-
end
|
115
|
-
|
116
|
-
it 'has a slot height of the element height' do
|
117
|
-
subject.height.should eq element.height
|
118
|
-
end
|
119
|
-
|
120
|
-
describe 'top and left' do
|
121
|
-
include_context 'element one with top and left'
|
122
|
-
it_behaves_like 'element one positioned with top and left'
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
shared_examples_for 'arranges elements underneath each other' do
|
127
|
-
include_context 'two slot children'
|
128
|
-
include_context 'contents_alignment'
|
129
|
-
|
130
|
-
it 'positions an element beneath a previous element' do
|
131
|
-
element2.absolute_top.should eq element.absolute_bottom + 1
|
132
|
-
end
|
133
|
-
|
134
|
-
it 'still positions it at the start of the line (e.g. self.left)' do
|
135
|
-
element2.absolute_left.should eq subject.absolute_left
|
136
|
-
end
|
137
|
-
|
138
|
-
it 'has a stack height according to its contents' do
|
139
|
-
subject.height.should eq (element.height + element2.height)
|
140
|
-
end
|
141
|
-
|
142
|
-
it 'has an absolute_bottom of top + height' do
|
143
|
-
subject.absolute_bottom.should eq (subject.absolute_top + subject.height - 1)
|
144
|
-
end
|
145
|
-
|
146
|
-
describe 'element one with top and left' do
|
147
|
-
include_context 'element one with top and left'
|
148
|
-
it_behaves_like 'element one positioned with top and left'
|
149
|
-
|
150
|
-
describe 'positions element2 disregarding element1' do
|
151
|
-
it 'has the same absolute left as the slot' do
|
152
|
-
element2.absolute_left.should eq subject.absolute_left
|
153
|
-
end
|
154
|
-
|
155
|
-
it 'has the same absolute top as the slot' do
|
156
|
-
element2.absolute_top.should eq subject.absolute_top
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
160
|
-
end
|
161
|
-
|
162
|
-
shared_examples_for 'set height and contents alignment' do
|
163
|
-
include_context 'two slot children'
|
164
|
-
|
165
|
-
it 'contents_alignment returns the height of the content' do
|
166
|
-
subject.contents_alignment.should eq (element.height + element2.height)
|
167
|
-
end
|
168
|
-
|
169
|
-
it 'still has the same height though' do
|
170
|
-
old_height = subject.height
|
171
|
-
subject.contents_alignment
|
172
|
-
subject.height.should eq old_height
|
173
|
-
end
|
174
|
-
end
|
175
|
-
|
176
|
-
shared_examples_for 'taking care of margin' do
|
177
|
-
include_context 'two slot children'
|
178
|
-
include_context 'contents_alignment'
|
179
|
-
|
180
|
-
it 'respects the left margin for the first element' do
|
181
|
-
element.absolute_left.should eq input_opts[:margin]
|
182
|
-
end
|
183
|
-
|
184
|
-
it 'respects the left margin for the second element' do
|
185
|
-
element2.absolute_left.should eq input_opts[:margin]
|
186
|
-
end
|
187
|
-
|
188
|
-
it 'respects the top margin for the first element' do
|
189
|
-
element.absolute_top.should eq input_opts[:margin]
|
190
|
-
end
|
191
|
-
end
|
192
|
-
|
193
|
-
shared_examples_for 'prepending' do
|
194
|
-
include_context 'two slot children'
|
195
|
-
let(:prepend1) {double 'prepend1'}
|
196
|
-
let(:prepend2) {double 'prepend2'}
|
197
|
-
|
198
|
-
describe 'one element' do
|
199
|
-
before :each do
|
200
|
-
subject.prepend do
|
201
|
-
subject.add_child prepend1
|
202
|
-
end
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'as the first' do
|
206
|
-
subject.contents.first.should eq prepend1
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'has a total of 3 elements then' do
|
210
|
-
subject.contents.size.should == 3
|
211
|
-
end
|
212
|
-
end
|
213
|
-
|
214
|
-
describe 'two elements' do
|
215
|
-
before :each do
|
216
|
-
subject.prepend do
|
217
|
-
subject.add_child prepend1
|
218
|
-
subject.add_child prepend2
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
it 'has prepend1 as the first child' do
|
223
|
-
subject.contents.first.should eq prepend1
|
224
|
-
end
|
225
|
-
|
226
|
-
it 'has prepend2 as the second child' do
|
227
|
-
subject.contents[1].should eq prepend2
|
228
|
-
end
|
229
|
-
|
230
|
-
it 'has a total of 4 children' do
|
231
|
-
subject.contents.size.should == 4
|
232
|
-
end
|
233
|
-
end
|
234
|
-
|
235
|
-
describe 'two times' do
|
236
|
-
before :each do
|
237
|
-
subject.prepend { subject.add_child prepend1 }
|
238
|
-
subject.prepend {subject.add_child prepend2 }
|
239
|
-
end
|
240
|
-
|
241
|
-
it 'has the last prepended element as the first' do
|
242
|
-
subject.contents.first.should eq prepend2
|
243
|
-
end
|
244
|
-
|
245
|
-
it 'has the first prepended element as the second' do
|
246
|
-
subject.contents[1].should eq prepend1
|
247
|
-
end
|
248
|
-
|
249
|
-
it 'has a total of 4 children' do
|
250
|
-
subject.contents.size.should == 4
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
|
255
|
-
shared_examples_for 'clearing' do
|
256
|
-
include_context 'two slot children'
|
257
|
-
|
258
|
-
describe '#clear' do
|
259
|
-
it 'removes all contents' do
|
260
|
-
subject.clear
|
261
|
-
subject.contents.should be_empty
|
262
|
-
end
|
263
|
-
end
|
264
|
-
|
265
|
-
describe 'Element#remove' do
|
266
|
-
it 'removees the element' do
|
267
|
-
element.parent = subject
|
268
|
-
element.remove
|
269
|
-
subject.contents.should_not include element
|
270
|
-
end
|
271
|
-
end
|
272
|
-
end
|