reflexion 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.doc/ext/reflex/application.cpp +37 -6
- data/.doc/ext/reflex/capture_event.cpp +1 -1
- data/.doc/ext/reflex/chase_constraint.cpp +1 -1
- data/.doc/ext/reflex/clipboard.cpp +1 -1
- data/.doc/ext/reflex/color_event.cpp +76 -0
- data/.doc/ext/reflex/color_picker.cpp +113 -0
- data/.doc/ext/reflex/constraint.cpp +1 -1
- data/.doc/ext/reflex/contact_event.cpp +1 -1
- data/.doc/ext/reflex/control_change_event.cpp +1 -1
- data/.doc/ext/reflex/device.cpp +1 -1
- data/.doc/ext/reflex/device_event.cpp +1 -1
- data/.doc/ext/reflex/draw_event.cpp +1 -1
- data/.doc/ext/reflex/ellipse_shape.cpp +1 -1
- data/.doc/ext/reflex/event.cpp +1 -1
- data/.doc/ext/reflex/file_dialog.cpp +181 -0
- data/.doc/ext/reflex/file_event.cpp +103 -0
- data/.doc/ext/reflex/filter.cpp +1 -1
- data/.doc/ext/reflex/focus_event.cpp +1 -1
- data/.doc/ext/reflex/frame_event.cpp +1 -1
- data/.doc/ext/reflex/gamepad.cpp +48 -0
- data/.doc/ext/reflex/image_view.cpp +1 -1
- data/.doc/ext/reflex/key_event.cpp +1 -274
- data/.doc/ext/reflex/line_shape.cpp +1 -1
- data/.doc/ext/reflex/link_constraint.cpp +1 -1
- data/.doc/ext/reflex/menu.cpp +6 -5
- data/.doc/ext/reflex/midi.cpp +9 -2
- data/.doc/ext/reflex/midi_event.cpp +1 -1
- data/.doc/ext/reflex/motion_event.cpp +1 -1
- data/.doc/ext/reflex/native.cpp +18 -6
- data/.doc/ext/reflex/note_event.cpp +1 -1
- data/.doc/ext/reflex/pin.cpp +1 -1
- data/.doc/ext/reflex/pointer.cpp +1 -1
- data/.doc/ext/reflex/pointer_event.cpp +2 -2
- data/.doc/ext/reflex/polygon_shape.cpp +1 -1
- data/.doc/ext/reflex/rect_shape.cpp +1 -1
- data/.doc/ext/reflex/reflex.cpp +566 -232
- data/.doc/ext/reflex/screen.cpp +27 -1
- data/.doc/ext/reflex/scroll_event.cpp +1 -1
- data/.doc/ext/reflex/selector.cpp +1 -1
- data/.doc/ext/reflex/shape.cpp +1 -1
- data/.doc/ext/reflex/snap_constraint.cpp +1 -1
- data/.doc/ext/reflex/style.cpp +1 -1
- data/.doc/ext/reflex/style_length.cpp +1 -1
- data/.doc/ext/reflex/text_event.cpp +104 -0
- data/.doc/ext/reflex/timer.cpp +1 -1
- data/.doc/ext/reflex/timer_event.cpp +1 -1
- data/.doc/ext/reflex/update_event.cpp +1 -1
- data/.doc/ext/reflex/view.cpp +110 -56
- data/.doc/ext/reflex/wheel_constraint.cpp +1 -1
- data/.doc/ext/reflex/wheel_event.cpp +1 -1
- data/.doc/ext/reflex/window.cpp +226 -17
- data/.github/workflows/release-gem.yml +2 -49
- data/.github/workflows/tag.yml +5 -28
- data/.github/workflows/test.yml +1 -37
- data/ChangeLog.md +54 -0
- data/Gemfile.lock +13 -8
- data/Rakefile +13 -2
- data/Reflex.podspec +2 -2
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +41 -6
- data/ext/reflex/capture_event.cpp +1 -1
- data/ext/reflex/chase_constraint.cpp +1 -1
- data/ext/reflex/clipboard.cpp +1 -1
- data/ext/reflex/color_event.cpp +80 -0
- data/ext/reflex/color_picker.cpp +121 -0
- data/ext/reflex/constraint.cpp +1 -1
- data/ext/reflex/contact_event.cpp +1 -1
- data/ext/reflex/control_change_event.cpp +1 -1
- data/ext/reflex/device.cpp +1 -1
- data/ext/reflex/device_event.cpp +1 -1
- data/ext/reflex/draw_event.cpp +1 -1
- data/ext/reflex/ellipse_shape.cpp +1 -1
- data/ext/reflex/event.cpp +1 -1
- data/ext/reflex/extconf.rb +4 -2
- data/ext/reflex/file_dialog.cpp +194 -0
- data/ext/reflex/file_event.cpp +108 -0
- data/ext/reflex/filter.cpp +1 -1
- data/ext/reflex/focus_event.cpp +1 -1
- data/ext/reflex/frame_event.cpp +1 -1
- data/ext/reflex/gamepad.cpp +50 -0
- data/ext/reflex/image_view.cpp +1 -1
- data/ext/reflex/key_event.cpp +1 -275
- data/ext/reflex/line_shape.cpp +1 -1
- data/ext/reflex/link_constraint.cpp +1 -1
- data/ext/reflex/menu.cpp +8 -7
- data/ext/reflex/midi.cpp +11 -3
- data/ext/reflex/midi_event.cpp +1 -1
- data/ext/reflex/motion_event.cpp +1 -1
- data/ext/reflex/native.cpp +18 -6
- data/ext/reflex/note_event.cpp +1 -1
- data/ext/reflex/pin.cpp +1 -1
- data/ext/reflex/pointer.cpp +1 -1
- data/ext/reflex/pointer_event.cpp +2 -2
- data/ext/reflex/polygon_shape.cpp +1 -1
- data/ext/reflex/rect_shape.cpp +1 -1
- data/ext/reflex/reflex.cpp +568 -232
- data/ext/reflex/screen.cpp +31 -2
- data/ext/reflex/scroll_event.cpp +1 -1
- data/ext/reflex/selector.cpp +1 -1
- data/ext/reflex/selector.h +9 -9
- data/ext/reflex/shape.cpp +1 -1
- data/ext/reflex/snap_constraint.cpp +1 -1
- data/ext/reflex/style.cpp +1 -1
- data/ext/reflex/style_length.cpp +1 -1
- data/ext/reflex/text_event.cpp +111 -0
- data/ext/reflex/timer.cpp +1 -1
- data/ext/reflex/timer_event.cpp +1 -1
- data/ext/reflex/update_event.cpp +1 -1
- data/ext/reflex/view.cpp +121 -61
- data/ext/reflex/wheel_constraint.cpp +1 -1
- data/ext/reflex/wheel_event.cpp +1 -1
- data/ext/reflex/window.cpp +256 -25
- data/include/reflex/application.h +10 -0
- data/include/reflex/color_picker.h +65 -0
- data/include/reflex/event.h +178 -88
- data/include/reflex/file_dialog.h +73 -0
- data/include/reflex/gamepad.h +3 -0
- data/include/reflex/menu.h +3 -3
- data/include/reflex/midi.h +3 -0
- data/include/reflex/reflex.h +2 -0
- data/include/reflex/ruby/application.h +6 -1
- data/include/reflex/ruby/color_picker.h +89 -0
- data/include/reflex/ruby/event.h +62 -29
- data/include/reflex/ruby/file_dialog.h +89 -0
- data/include/reflex/ruby/gamepad.h +46 -0
- data/include/reflex/ruby/reflex.h +3 -0
- data/include/reflex/ruby/view.h +92 -44
- data/include/reflex/ruby/window.h +60 -1
- data/include/reflex/ruby.h +3 -0
- data/include/reflex/screen.h +11 -2
- data/include/reflex/view.h +28 -16
- data/include/reflex/window.h +40 -8
- data/include/reflex.h +3 -0
- data/lib/reflex/application.rb +5 -5
- data/lib/reflex/autoinit.rb +3 -1
- data/lib/reflex/button.rb +3 -3
- data/lib/reflex/color_event.rb +16 -0
- data/lib/reflex/color_picker.rb +45 -0
- data/lib/reflex/control_change_event.rb +17 -0
- data/lib/reflex/file_dialog.rb +70 -0
- data/lib/reflex/file_event.rb +37 -0
- data/lib/reflex/helper.rb +58 -7
- data/lib/reflex/key_event.rb +9 -4
- data/lib/reflex/menu.rb +17 -1
- data/lib/reflex/model.rb +19 -19
- data/lib/reflex/note_event.rb +1 -1
- data/lib/reflex/pointer.rb +14 -3
- data/lib/reflex/pointer_event.rb +12 -1
- data/lib/reflex/reflex.rb +5 -0
- data/lib/reflex/shape.rb +14 -14
- data/lib/reflex/style.rb +16 -16
- data/lib/reflex/text_event.rb +40 -0
- data/lib/reflex/timer.rb +3 -3
- data/lib/reflex/view.rb +29 -14
- data/lib/reflex/wheel_event.rb +12 -3
- data/lib/reflex/window.rb +25 -13
- data/lib/reflex.rb +8 -2
- data/reflex.gemspec +4 -4
- data/samples/ime.rb +100 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +236 -224
- data/samples/menu.rb +4 -1
- data/samples/model.rb +3 -3
- data/samples/test/alert.rb +93 -0
- data/samples/test/always_on.rb +76 -0
- data/samples/test/app_background.rb +51 -0
- data/samples/test/boundary.rb +75 -0
- data/samples/test/callback_exception.rb +101 -0
- data/samples/test/cancel.rb +53 -0
- data/samples/test/color_picker.rb +63 -0
- data/samples/test/file_dialog.rb +102 -0
- data/samples/window_style.rb +156 -0
- data/src/application.cpp +159 -18
- data/src/application.h +92 -7
- data/src/color_picker.cpp +113 -0
- data/src/color_picker.h +36 -0
- data/src/event.cpp +410 -252
- data/src/event.h +12 -0
- data/src/file_dialog.cpp +163 -0
- data/src/file_dialog.h +52 -0
- data/src/gamepad.cpp +42 -5
- data/src/gamepad.h +4 -0
- data/src/ios/app_delegate.mm +5 -3
- data/src/ios/application.mm +24 -0
- data/src/ios/color_picker.mm +19 -0
- data/src/ios/file_dialog.mm +21 -0
- data/src/ios/gamepad.mm +4 -4
- data/src/ios/menu.mm +5 -0
- data/src/ios/reflex.mm +8 -0
- data/src/ios/screen.mm +26 -0
- data/src/ios/view_controller.mm +2 -30
- data/src/ios/window.mm +38 -9
- data/src/menu.cpp +66 -4
- data/src/menu.h +17 -1
- data/src/midi.cpp +61 -31
- data/src/osx/app_delegate.h +4 -0
- data/src/osx/app_delegate.mm +102 -22
- data/src/osx/application.mm +88 -6
- data/src/osx/color_picker.mm +112 -0
- data/src/osx/event.h +10 -0
- data/src/osx/event.mm +84 -30
- data/src/osx/file_dialog.mm +168 -0
- data/src/osx/gamepad.mm +2 -2
- data/src/osx/gamepad_hid.mm +1 -1
- data/src/osx/menu.mm +177 -33
- data/src/osx/native_window.h +16 -2
- data/src/osx/native_window.mm +114 -57
- data/src/osx/opengl_view.h +2 -1
- data/src/osx/opengl_view.mm +184 -43
- data/src/osx/reflex.mm +38 -0
- data/src/osx/screen.mm +36 -0
- data/src/osx/window.mm +106 -24
- data/src/pointer.cpp +13 -4
- data/src/pointer.h +4 -0
- data/src/rays.h +46 -0
- data/src/sdl/application.cpp +68 -8
- data/src/sdl/color_picker.cpp +18 -0
- data/src/sdl/event.cpp +24 -3
- data/src/sdl/event.h +12 -0
- data/src/sdl/file_dialog.cpp +20 -0
- data/src/sdl/gamepad.cpp +3 -7
- data/src/sdl/menu.cpp +5 -0
- data/src/sdl/reflex.cpp +20 -0
- data/src/sdl/screen.cpp +36 -0
- data/src/sdl/window.cpp +142 -29
- data/src/shape.cpp +15 -10
- data/src/view.cpp +287 -198
- data/src/view.h +4 -2
- data/src/vk.h +416 -0
- data/src/win32/application.cpp +162 -12
- data/src/win32/application.h +20 -0
- data/src/win32/color_picker.cpp +82 -0
- data/src/win32/event.cpp +114 -12
- data/src/win32/event.h +21 -4
- data/src/win32/file_dialog.cpp +226 -0
- data/src/win32/gamepad.cpp +9 -2
- data/src/win32/menu.cpp +191 -53
- data/src/win32/menu.h +9 -1
- data/src/win32/opengl.cpp +2 -9
- data/src/win32/reflex.cpp +44 -3
- data/src/win32/screen.cpp +164 -3
- data/src/win32/screen.h +8 -0
- data/src/win32/tray.cpp +191 -0
- data/src/win32/tray.h +22 -0
- data/src/win32/vk.cpp +11 -0
- data/src/win32/window.cpp +809 -148
- data/src/win32/window.h +6 -0
- data/src/window.cpp +718 -185
- data/src/window.h +66 -33
- data/src/world.cpp +9 -1
- data/test/helper.rb +17 -0
- data/test/test_application.rb +90 -1
- data/test/test_chase_constraint.rb +1 -3
- data/test/test_color_event.rb +36 -0
- data/test/test_color_picker.rb +62 -0
- data/test/test_constraint.rb +2 -4
- data/test/test_event.rb +1 -1
- data/test/test_file_dialog.rb +48 -0
- data/test/test_file_event.rb +43 -0
- data/test/test_has_text_preedit.rb +54 -0
- data/test/test_key_event.rb +20 -5
- data/test/test_link_constraint.rb +1 -3
- data/test/test_menu.rb +40 -10
- data/test/test_pointer.rb +33 -23
- data/test/test_pointer_event.rb +24 -9
- data/test/test_reflex.rb +36 -0
- data/test/test_screen.rb +24 -2
- data/test/test_snap_constraint.rb +1 -3
- data/test/test_text_event.rb +54 -0
- data/test/test_view.rb +41 -4
- data/test/test_wheel_constraint.rb +1 -3
- data/test/test_wheel_event.rb +13 -5
- data/test/test_window.rb +196 -44
- metadata +80 -10
- data/.github/workflows/utils.rb +0 -127
data/test/test_window.rb
CHANGED
|
@@ -3,78 +3,84 @@ require_relative 'helper'
|
|
|
3
3
|
|
|
4
4
|
class TestWindow < Test::Unit::TestCase
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
Reflex::Window.new(*a, **k, &b)
|
|
8
|
-
end
|
|
6
|
+
include HasWindow
|
|
9
7
|
|
|
10
8
|
def point(*a) Reflex::Point.new(*a) end
|
|
11
9
|
def bounds(*a) Reflex::Bounds.new(*a) end
|
|
12
10
|
|
|
13
11
|
def test_show_hide_hidden()
|
|
14
|
-
w =
|
|
15
|
-
assert_true w.hidden
|
|
12
|
+
w = window
|
|
13
|
+
assert_true w.hidden?
|
|
16
14
|
w.show
|
|
17
|
-
assert_false w.hidden
|
|
15
|
+
assert_false w.hidden?
|
|
18
16
|
w.hide
|
|
19
|
-
assert_true w.hidden
|
|
17
|
+
assert_true w.hidden?
|
|
20
18
|
end
|
|
21
19
|
|
|
22
20
|
def test_hidden_count()
|
|
23
|
-
w =
|
|
21
|
+
w = window
|
|
24
22
|
w.hide
|
|
25
|
-
assert_true w.hidden
|
|
23
|
+
assert_true w.hidden?
|
|
26
24
|
w.show
|
|
27
|
-
assert_true w.hidden
|
|
25
|
+
assert_true w.hidden?
|
|
28
26
|
w.show
|
|
29
|
-
assert_false w.hidden
|
|
27
|
+
assert_false w.hidden?
|
|
30
28
|
end
|
|
31
29
|
|
|
32
30
|
def test_coord_conversion()
|
|
33
|
-
w =
|
|
31
|
+
w = window x: 100, y: 200
|
|
34
32
|
assert_equal [400, 300], w.from_screen(500).to_a
|
|
35
33
|
assert_equal [600, 700], w. to_screen(500).to_a
|
|
36
34
|
end
|
|
37
35
|
|
|
38
36
|
def test_title()
|
|
39
|
-
w =
|
|
37
|
+
w = window
|
|
40
38
|
assert_equal '', w.title
|
|
41
39
|
w.title = 'A'
|
|
42
40
|
assert_equal 'A', w.title
|
|
43
41
|
end
|
|
44
42
|
|
|
45
43
|
def test_frame()
|
|
46
|
-
w =
|
|
44
|
+
w = window
|
|
47
45
|
b = w.frame.dup
|
|
48
46
|
assert_equal b, w.frame
|
|
49
47
|
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
w.frame = 1; assert_equal [0, 0, 1, 1], w.frame.to_a
|
|
49
|
+
w.frame = [1]; assert_equal [0, 0, 1, 1], w.frame.to_a
|
|
50
|
+
w.frame = [1, 2]; assert_equal [0, 0, 1, 2], w.frame.to_a
|
|
51
|
+
w.frame = [1, 2, 3]; assert_equal [0, 0, 1, 2], w.frame.to_a
|
|
52
|
+
w.frame = [1, 2, 3]; assert_equal [0, 0, 0, 1, 2, 0], w.frame.to_a(3)
|
|
53
|
+
w.frame = [1, 2, 3, 4]; assert_equal [1, 2, 3, 4], w.frame.to_a
|
|
54
|
+
w.frame = [1, 2, 3, 4]; assert_equal [1, 2, 0, 3, 4, 0], w.frame.to_a(3)
|
|
55
|
+
w.frame = [1, 2, 3, 4, 5, 6]; assert_equal [1, 2, 4, 5], w.frame.to_a
|
|
56
|
+
w.frame = [1, 2, 3, 4, 5, 6]; assert_equal [1, 2, 0, 4, 5, 0], w.frame.to_a(3)
|
|
57
|
+
|
|
58
|
+
w.frame = point(1); assert_equal [0, 0, 1, 1], w.frame.to_a
|
|
59
|
+
w.frame = [point(1)]; assert_equal [0, 0, 1, 1], w.frame.to_a
|
|
60
|
+
w.frame = point(1, 2); assert_equal [0, 0, 1, 2], w.frame.to_a
|
|
61
|
+
w.frame = [point(1, 2)]; assert_equal [0, 0, 1, 2], w.frame.to_a
|
|
62
|
+
w.frame = [point(1, 2), point(3, 4)]; assert_equal [1, 2, 3, 4], w.frame.to_a
|
|
63
|
+
w.frame = [point(1, 2), point(3, 4)]; assert_equal [1, 2, 0, 3, 4, 0], w.frame.to_a(3)
|
|
64
|
+
w.frame = [point(1, 2, 3), point(4, 5, 6)]; assert_equal [1, 2, 4, 5], w.frame.to_a
|
|
65
|
+
w.frame = [point(1, 2, 3), point(4, 5, 6)]; assert_equal [1, 2, 0, 4, 5, 0], w.frame.to_a(3)
|
|
66
|
+
|
|
67
|
+
w.frame = bounds(1, 2, 3, 4, 5, 6); assert_equal [1, 2, 0, 4, 5, 0], w.frame.to_a(3)
|
|
68
|
+
w.frame = [bounds(1, 2, 3, 4, 5, 6)]; assert_equal [1, 2, 0, 4, 5, 0], w.frame.to_a(3)
|
|
69
|
+
end
|
|
52
70
|
|
|
53
|
-
|
|
54
|
-
w
|
|
55
|
-
|
|
56
|
-
w.frame = [1, 2, 3]; assert_equal [0, 0, minw[1], 2], w.frame.to_a
|
|
57
|
-
w.frame = [1, 2, 3]; assert_equal [0, 0, 0, minw[1], 2, 0], w.frame.to_a(3)
|
|
58
|
-
w.frame = [1, 2, 3, 4]; assert_equal [1, 2, minw[3], 4], w.frame.to_a
|
|
59
|
-
w.frame = [1, 2, 3, 4]; assert_equal [1, 2, 0, minw[3], 4, 0], w.frame.to_a(3)
|
|
60
|
-
w.frame = [1, 2, 3, 4, 5, 6]; assert_equal [1, 2, minw[4], 5], w.frame.to_a
|
|
61
|
-
w.frame = [1, 2, 3, 4, 5, 6]; assert_equal [1, 2, 0, minw[4], 5, 0], w.frame.to_a(3)
|
|
71
|
+
def test_frame_without_titlebar()
|
|
72
|
+
w = window titlebar: []
|
|
73
|
+
b = [100, 100, 300, 400]
|
|
62
74
|
|
|
63
|
-
w.frame =
|
|
64
|
-
|
|
65
|
-
w.frame = point(1, 2); assert_equal [0, 0, minw[1], 2], w.frame.to_a
|
|
66
|
-
w.frame = [point(1, 2)]; assert_equal [0, 0, minw[1], 2], w.frame.to_a
|
|
67
|
-
w.frame = [point(1, 2), point(3, 4)]; assert_equal [1, 2, minw[3], 4], w.frame.to_a
|
|
68
|
-
w.frame = [point(1, 2), point(3, 4)]; assert_equal [1, 2, 0, minw[3], 4, 0], w.frame.to_a(3)
|
|
69
|
-
w.frame = [point(1, 2, 3), point(4, 5, 6)]; assert_equal [1, 2, minw[4], 5], w.frame.to_a
|
|
70
|
-
w.frame = [point(1, 2, 3), point(4, 5, 6)]; assert_equal [1, 2, 0, minw[4], 5, 0], w.frame.to_a(3)
|
|
75
|
+
w.frame = b
|
|
76
|
+
assert_equal b, w.frame.to_a
|
|
71
77
|
|
|
72
|
-
w.frame =
|
|
73
|
-
|
|
78
|
+
w.frame = w.frame
|
|
79
|
+
assert_equal b, w.frame.to_a
|
|
74
80
|
end
|
|
75
81
|
|
|
76
82
|
def test_menu()
|
|
77
|
-
w =
|
|
83
|
+
w = window
|
|
78
84
|
m = Reflex::Menu.new
|
|
79
85
|
assert_nil w.menu
|
|
80
86
|
w.menu = m
|
|
@@ -84,7 +90,7 @@ class TestWindow < Test::Unit::TestCase
|
|
|
84
90
|
end
|
|
85
91
|
|
|
86
92
|
def test_closable?()
|
|
87
|
-
w =
|
|
93
|
+
w = window
|
|
88
94
|
assert_true w.closable?
|
|
89
95
|
|
|
90
96
|
w.closable = false
|
|
@@ -101,7 +107,7 @@ class TestWindow < Test::Unit::TestCase
|
|
|
101
107
|
end
|
|
102
108
|
|
|
103
109
|
def test_minimizable?()
|
|
104
|
-
w =
|
|
110
|
+
w = window
|
|
105
111
|
assert_true w.minimizable?
|
|
106
112
|
|
|
107
113
|
w.minimizable = false
|
|
@@ -118,7 +124,7 @@ class TestWindow < Test::Unit::TestCase
|
|
|
118
124
|
end
|
|
119
125
|
|
|
120
126
|
def test_resizable?()
|
|
121
|
-
w =
|
|
127
|
+
w = window
|
|
122
128
|
assert_true w.resizable?
|
|
123
129
|
|
|
124
130
|
w.resizable = false
|
|
@@ -134,8 +140,87 @@ class TestWindow < Test::Unit::TestCase
|
|
|
134
140
|
assert_true w.resizable?
|
|
135
141
|
end
|
|
136
142
|
|
|
143
|
+
def test_titlebar()
|
|
144
|
+
w = window
|
|
145
|
+
assert_equal [:buttons, :background], w.titlebar
|
|
146
|
+
|
|
147
|
+
w.titlebar = [:background]
|
|
148
|
+
assert_equal [:background], w.titlebar
|
|
149
|
+
|
|
150
|
+
if win32?
|
|
151
|
+
assert_raise(ArgumentError) {w.titlebar = [:buttons]}.then do |e|
|
|
152
|
+
assert_match(/buttons.*needs.*background/i, e.message)
|
|
153
|
+
end
|
|
154
|
+
else
|
|
155
|
+
w.titlebar = [:buttons]
|
|
156
|
+
assert_equal [:buttons], w.titlebar
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
w.titlebar = []
|
|
160
|
+
assert_equal [], w.titlebar
|
|
161
|
+
|
|
162
|
+
w.titlebar = [:buttons, :background]
|
|
163
|
+
assert_equal [:buttons, :background], w.titlebar
|
|
164
|
+
|
|
165
|
+
assert_equal [], window(titlebar: []).titlebar
|
|
166
|
+
|
|
167
|
+
assert_raise(ArgumentError) {w.titlebar = [:unknown]}
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
def test_unlisted?()
|
|
171
|
+
w = window
|
|
172
|
+
assert_false w.unlisted?
|
|
173
|
+
|
|
174
|
+
w.unlisted = true
|
|
175
|
+
assert_true w.unlisted?
|
|
176
|
+
|
|
177
|
+
w.unlisted = false
|
|
178
|
+
assert_false w.unlisted?
|
|
179
|
+
|
|
180
|
+
assert_true window(unlisted: true).unlisted?
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
def test_shadow?()
|
|
184
|
+
titlebar = win32? ? [] : [:buttons, :background]
|
|
185
|
+
w = window titlebar: titlebar
|
|
186
|
+
assert_true w.shadow?
|
|
187
|
+
|
|
188
|
+
w.shadow = false
|
|
189
|
+
assert_false w.shadow?
|
|
190
|
+
|
|
191
|
+
w.shadow = true
|
|
192
|
+
assert_true w.shadow?
|
|
193
|
+
|
|
194
|
+
w.shadow false
|
|
195
|
+
assert_false w.shadow?
|
|
196
|
+
|
|
197
|
+
w.shadow true
|
|
198
|
+
assert_true w.shadow?
|
|
199
|
+
|
|
200
|
+
assert_false window(titlebar: titlebar, shadow: false).shadow?
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
def test_transparent?()
|
|
204
|
+
w = window
|
|
205
|
+
assert_false w.transparent?
|
|
206
|
+
|
|
207
|
+
w.transparent = true
|
|
208
|
+
assert_true w.transparent?
|
|
209
|
+
|
|
210
|
+
w.transparent = false
|
|
211
|
+
assert_false w.transparent?
|
|
212
|
+
|
|
213
|
+
w.transparent true
|
|
214
|
+
assert_true w.transparent?
|
|
215
|
+
|
|
216
|
+
w.transparent false
|
|
217
|
+
assert_false w.transparent?
|
|
218
|
+
|
|
219
|
+
assert_true window(transparent: true).transparent?
|
|
220
|
+
end
|
|
221
|
+
|
|
137
222
|
def test_fullscreen?()
|
|
138
|
-
w =
|
|
223
|
+
w = window
|
|
139
224
|
assert_false w.fullscreen?
|
|
140
225
|
|
|
141
226
|
w.fullscreen = true
|
|
@@ -151,8 +236,75 @@ class TestWindow < Test::Unit::TestCase
|
|
|
151
236
|
assert_false w.fullscreen?
|
|
152
237
|
end
|
|
153
238
|
|
|
239
|
+
def test_always_on_top_and_bottom?()
|
|
240
|
+
w = window
|
|
241
|
+
assert_false w.always_on_top?
|
|
242
|
+
assert_false w.always_on_bottom?
|
|
243
|
+
|
|
244
|
+
w.always_on_top = true
|
|
245
|
+
assert_true w.always_on_top?
|
|
246
|
+
assert_false w.always_on_bottom?
|
|
247
|
+
|
|
248
|
+
assert_true window(always_on_top: true).always_on_top?
|
|
249
|
+
|
|
250
|
+
if linux?
|
|
251
|
+
assert_raise(Rucy::NativeError) {w.always_on_bottom = true}
|
|
252
|
+
return
|
|
253
|
+
else
|
|
254
|
+
assert_true window(always_on_bottom: true).always_on_bottom?
|
|
255
|
+
end
|
|
256
|
+
|
|
257
|
+
w.always_on_bottom = true
|
|
258
|
+
assert_false w.always_on_top?
|
|
259
|
+
assert_true w.always_on_bottom?
|
|
260
|
+
|
|
261
|
+
w.always_on_bottom = false
|
|
262
|
+
assert_false w.always_on_top?
|
|
263
|
+
assert_false w.always_on_bottom?
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
def test_pointer_through?()
|
|
267
|
+
w = window
|
|
268
|
+
assert_false w.pointer_through?
|
|
269
|
+
|
|
270
|
+
if linux?
|
|
271
|
+
assert_raise(Rucy::NativeError) {w.pointer_through = true}
|
|
272
|
+
return
|
|
273
|
+
end
|
|
274
|
+
|
|
275
|
+
w.pointer_through = true
|
|
276
|
+
assert_true w.pointer_through?
|
|
277
|
+
|
|
278
|
+
w.pointer_through = false
|
|
279
|
+
assert_false w.pointer_through?
|
|
280
|
+
|
|
281
|
+
w.pointer_through true
|
|
282
|
+
assert_true w.pointer_through?
|
|
283
|
+
|
|
284
|
+
w.pointer_through false
|
|
285
|
+
assert_false w.pointer_through?
|
|
286
|
+
|
|
287
|
+
assert_true window(pointer_through: true).pointer_through?
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
def test_pointer_through_alpha()
|
|
291
|
+
w = window
|
|
292
|
+
assert_equal 1, w.pointer_through_alpha
|
|
293
|
+
|
|
294
|
+
w.pointer_through_alpha = 0.5
|
|
295
|
+
assert_equal 0.5, w.pointer_through_alpha
|
|
296
|
+
|
|
297
|
+
w.pointer_through_alpha 0
|
|
298
|
+
assert_equal 0, w.pointer_through_alpha
|
|
299
|
+
|
|
300
|
+
assert_raise(ArgumentError) {w.pointer_through_alpha = -0.1}
|
|
301
|
+
assert_raise(ArgumentError) {w.pointer_through_alpha = 1.1}
|
|
302
|
+
|
|
303
|
+
assert_equal 0.5, window(pointer_through_alpha: 0.5).pointer_through_alpha
|
|
304
|
+
end
|
|
305
|
+
|
|
154
306
|
def test_orientations()
|
|
155
|
-
w =
|
|
307
|
+
w = window
|
|
156
308
|
assert_equal [], w.orientations
|
|
157
309
|
|
|
158
310
|
assert_raise(ArgumentError) {w.orientations = [:portrait]}.then do |e|
|
|
@@ -164,11 +316,11 @@ class TestWindow < Test::Unit::TestCase
|
|
|
164
316
|
end
|
|
165
317
|
|
|
166
318
|
def test_screen()
|
|
167
|
-
assert_not_nil
|
|
319
|
+
assert_not_nil window.screen
|
|
168
320
|
end
|
|
169
321
|
|
|
170
322
|
def test_root()
|
|
171
|
-
w =
|
|
323
|
+
w = window
|
|
172
324
|
assert_not_nil w.root
|
|
173
325
|
assert_nil w.root.parent
|
|
174
326
|
assert_equal 'ROOT', w.root.name
|
|
@@ -176,7 +328,7 @@ class TestWindow < Test::Unit::TestCase
|
|
|
176
328
|
end
|
|
177
329
|
|
|
178
330
|
def test_inspect()
|
|
179
|
-
assert_match %r|#<Reflex::Window:0x\w{16}>|,
|
|
331
|
+
assert_match %r|#<Reflex::Window:0x\w{16}>|, window.inspect
|
|
180
332
|
end
|
|
181
333
|
|
|
182
334
|
end# TestWindow
|