reflexion 0.5.3 → 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 +56 -7
- data/.doc/ext/reflex/capture_event.cpp +1 -1
- data/.doc/ext/reflex/chase_constraint.cpp +84 -0
- data/.doc/ext/reflex/clipboard.cpp +65 -0
- data/.doc/ext/reflex/color_event.cpp +76 -0
- data/.doc/ext/reflex/color_picker.cpp +113 -0
- data/.doc/ext/reflex/constraint.cpp +135 -0
- 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 +178 -0
- data/.doc/ext/reflex/menu.cpp +303 -0
- 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 +40 -10
- data/.doc/ext/reflex/note_event.cpp +1 -1
- data/.doc/ext/reflex/pin.cpp +156 -0
- data/.doc/ext/reflex/pointer.cpp +3 -1
- data/.doc/ext/reflex/pointer_event.cpp +3 -3
- data/.doc/ext/reflex/polygon_shape.cpp +1 -1
- data/.doc/ext/reflex/rect_shape.cpp +1 -1
- data/.doc/ext/reflex/reflex.cpp +606 -237
- data/.doc/ext/reflex/screen.cpp +27 -1
- data/.doc/ext/reflex/scroll_event.cpp +1 -1
- data/.doc/ext/reflex/selector.cpp +5 -5
- data/.doc/ext/reflex/shape.cpp +1 -1
- data/.doc/ext/reflex/snap_constraint.cpp +125 -0
- data/.doc/ext/reflex/style.cpp +1 -1
- data/.doc/ext/reflex/style_length.cpp +4 -3
- 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 +206 -79
- data/.doc/ext/reflex/wheel_constraint.cpp +142 -0
- data/.doc/ext/reflex/wheel_event.cpp +1 -1
- data/.doc/ext/reflex/window.cpp +282 -31
- data/.github/workflows/release-gem.yml +2 -40
- data/.github/workflows/tag.yml +5 -28
- data/.github/workflows/test.yml +1 -28
- data/ChangeLog.md +79 -0
- data/Gemfile.lock +13 -8
- data/README.md +1 -0
- data/Rakefile +13 -2
- data/Reflex.podspec +2 -2
- data/VERSION +1 -1
- data/ext/reflex/application.cpp +62 -7
- data/ext/reflex/capture_event.cpp +1 -1
- data/ext/reflex/chase_constraint.cpp +89 -0
- data/ext/reflex/clipboard.cpp +69 -0
- data/ext/reflex/color_event.cpp +80 -0
- data/ext/reflex/color_picker.cpp +121 -0
- data/ext/reflex/constraint.cpp +146 -0
- 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 +194 -0
- data/ext/reflex/menu.cpp +331 -0
- 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 +40 -10
- data/ext/reflex/note_event.cpp +1 -1
- data/ext/reflex/pin.cpp +165 -0
- data/ext/reflex/pointer.cpp +3 -1
- data/ext/reflex/pointer_event.cpp +3 -3
- data/ext/reflex/polygon_shape.cpp +1 -1
- data/ext/reflex/rect_shape.cpp +1 -1
- data/ext/reflex/reflex.cpp +608 -237
- data/ext/reflex/screen.cpp +31 -2
- data/ext/reflex/scroll_event.cpp +1 -1
- data/ext/reflex/selector.cpp +5 -5
- data/ext/reflex/selector.h +10 -10
- data/ext/reflex/shape.cpp +1 -1
- data/ext/reflex/snap_constraint.cpp +135 -0
- data/ext/reflex/style.cpp +1 -1
- data/ext/reflex/style_length.cpp +4 -3
- 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 +236 -96
- data/ext/reflex/wheel_constraint.cpp +154 -0
- data/ext/reflex/wheel_event.cpp +1 -1
- data/ext/reflex/window.cpp +318 -40
- data/include/reflex/application.h +19 -0
- data/include/reflex/clipboard.h +53 -0
- data/include/reflex/color_picker.h +65 -0
- data/include/reflex/constraint.h +275 -0
- data/include/reflex/defs.h +204 -195
- data/include/reflex/event.h +180 -88
- data/include/reflex/file_dialog.h +73 -0
- data/include/reflex/gamepad.h +3 -0
- data/include/reflex/menu.h +120 -0
- data/include/reflex/midi.h +3 -0
- data/include/reflex/pin.h +68 -0
- data/include/reflex/pointer.h +4 -0
- data/include/reflex/reflex.h +2 -0
- data/include/reflex/ruby/application.h +6 -1
- data/include/reflex/ruby/clipboard.h +23 -0
- data/include/reflex/ruby/color_picker.h +89 -0
- data/include/reflex/ruby/constraint.h +94 -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/menu.h +103 -0
- data/include/reflex/ruby/pin.h +40 -0
- data/include/reflex/ruby/reflex.h +3 -0
- data/include/reflex/ruby/view.h +123 -39
- data/include/reflex/ruby/window.h +96 -19
- data/include/reflex/ruby.h +3 -0
- data/include/reflex/screen.h +11 -2
- data/include/reflex/view.h +66 -27
- data/include/reflex/window.h +57 -12
- data/include/reflex.h +8 -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/chase_constraint.rb +15 -0
- data/lib/reflex/clipboard.rb +19 -0
- data/lib/reflex/color_event.rb +16 -0
- data/lib/reflex/color_picker.rb +45 -0
- data/lib/reflex/constraint.rb +29 -0
- data/lib/reflex/control_change_event.rb +17 -0
- data/lib/reflex/extension.rb +1 -1
- data/lib/reflex/file_dialog.rb +70 -0
- data/lib/reflex/file_event.rb +37 -0
- data/lib/reflex/helper.rb +79 -0
- data/lib/reflex/key_event.rb +14 -14
- data/lib/reflex/link_constraint.rb +31 -0
- data/lib/reflex/menu.rb +92 -0
- data/lib/reflex/model.rb +19 -19
- data/lib/reflex/note_event.rb +1 -1
- data/lib/reflex/pin.rb +39 -0
- data/lib/reflex/pointer.rb +30 -1
- data/lib/reflex/pointer_event.rb +13 -2
- data/lib/reflex/reflex.rb +5 -0
- data/lib/reflex/shape.rb +14 -14
- data/lib/reflex/snap_constraint.rb +28 -0
- 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 +85 -18
- data/lib/reflex/wheel_constraint.rb +28 -0
- data/lib/reflex/wheel_event.rb +19 -1
- data/lib/reflex/window.rb +25 -13
- data/lib/reflex.rb +23 -8
- data/pod.rake +1 -1
- data/reflex.gemspec +4 -4
- data/samples/constraint.rb +152 -0
- data/samples/ime.rb +100 -0
- data/samples/ios/hello/hello.xcodeproj/project.pbxproj +236 -224
- data/samples/menu.rb +32 -0
- 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 +180 -20
- data/src/application.h +95 -5
- data/src/clipboard.cpp +81 -0
- data/src/color_picker.cpp +113 -0
- data/src/color_picker.h +36 -0
- data/src/constraint.cpp +1662 -0
- data/src/constraint.h +64 -0
- data/src/event.cpp +416 -252
- data/src/event.h +13 -2
- 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 +29 -0
- data/src/ios/clipboard.mm +44 -0
- data/src/ios/color_picker.mm +19 -0
- data/src/ios/event.h +6 -2
- data/src/ios/event.mm +31 -12
- data/src/ios/file_dialog.mm +21 -0
- data/src/ios/gamepad.mm +4 -4
- data/src/ios/menu.mm +41 -0
- data/src/ios/reflex.mm +8 -0
- data/src/ios/screen.mm +26 -0
- data/src/ios/view_controller.mm +47 -42
- data/src/ios/window.mm +44 -9
- data/src/menu.cpp +387 -0
- data/src/menu.h +81 -0
- data/src/midi.cpp +61 -31
- data/src/osx/app_delegate.h +4 -0
- data/src/osx/app_delegate.mm +168 -139
- data/src/osx/application.mm +103 -5
- data/src/osx/clipboard.mm +45 -0
- data/src/osx/color_picker.mm +112 -0
- data/src/osx/event.h +10 -0
- data/src/osx/event.mm +114 -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.h +25 -0
- data/src/osx/menu.mm +516 -0
- data/src/osx/native_window.h +16 -2
- data/src/osx/native_window.mm +141 -57
- data/src/osx/opengl_view.h +2 -1
- data/src/osx/opengl_view.mm +229 -37
- data/src/osx/reflex.mm +38 -0
- data/src/osx/screen.mm +36 -0
- data/src/osx/window.mm +117 -24
- data/src/pin.cpp +137 -0
- data/src/pointer.cpp +36 -16
- data/src/pointer.h +10 -0
- data/src/rays.h +46 -0
- data/src/sdl/application.cpp +73 -8
- data/src/sdl/clipboard.cpp +39 -0
- data/src/sdl/color_picker.cpp +18 -0
- data/src/sdl/event.cpp +44 -6
- data/src/sdl/event.h +18 -3
- data/src/sdl/file_dialog.cpp +20 -0
- data/src/sdl/gamepad.cpp +3 -7
- data/src/sdl/menu.cpp +40 -0
- data/src/sdl/reflex.cpp +20 -0
- data/src/sdl/screen.cpp +36 -0
- data/src/sdl/window.cpp +168 -37
- data/src/shape.cpp +15 -10
- data/src/view.cpp +583 -233
- data/src/view.h +22 -4
- data/src/vk.h +416 -0
- data/src/win32/application.cpp +167 -12
- data/src/win32/application.h +20 -0
- data/src/win32/clipboard.cpp +210 -0
- data/src/win32/color_picker.cpp +82 -0
- data/src/win32/event.cpp +123 -11
- data/src/win32/event.h +22 -3
- data/src/win32/file_dialog.cpp +226 -0
- data/src/win32/gamepad.cpp +9 -2
- data/src/win32/menu.cpp +490 -0
- data/src/win32/menu.h +35 -0
- 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 +858 -135
- data/src/win32/window.h +9 -0
- data/src/window.cpp +929 -183
- data/src/window.h +77 -33
- data/src/world.cpp +86 -15
- data/src/world.h +9 -2
- data/test/helper.rb +24 -0
- data/test/test_application.rb +101 -1
- data/test/test_chase_constraint.rb +122 -0
- data/test/test_clipboard.rb +54 -0
- data/test/test_color_event.rb +36 -0
- data/test/test_color_picker.rb +62 -0
- data/test/test_constraint.rb +184 -0
- 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 +23 -2
- data/test/test_link_constraint.rb +237 -0
- data/test/test_menu.rb +237 -0
- data/test/test_pin.rb +65 -0
- data/test/test_pointer.rb +50 -26
- data/test/test_pointer_event.rb +25 -10
- data/test/test_reflex.rb +36 -0
- data/test/test_screen.rb +24 -2
- data/test/test_snap_constraint.rb +140 -0
- data/test/test_text_event.rb +54 -0
- data/test/test_view.rb +152 -25
- data/test/test_wheel_constraint.rb +125 -0
- data/test/test_wheel_event.rb +24 -10
- data/test/test_window.rb +205 -43
- metadata +154 -10
- data/.github/workflows/utils.rb +0 -127
data/test/test_wheel_event.rb
CHANGED
|
@@ -3,8 +3,10 @@ require_relative 'helper'
|
|
|
3
3
|
|
|
4
4
|
class TestWheelEvent < Test::Unit::TestCase
|
|
5
5
|
|
|
6
|
+
R = Reflex
|
|
7
|
+
|
|
6
8
|
def event(*args)
|
|
7
|
-
|
|
9
|
+
R::WheelEvent.new(*args)
|
|
8
10
|
end
|
|
9
11
|
|
|
10
12
|
def point(*args)
|
|
@@ -13,15 +15,15 @@ class TestWheelEvent < Test::Unit::TestCase
|
|
|
13
15
|
|
|
14
16
|
def test_initialize()
|
|
15
17
|
e = event 1, 2, 3, 4, 5, 6, 7
|
|
16
|
-
assert_equal 1,
|
|
17
|
-
assert_equal 2,
|
|
18
|
-
assert_equal 3,
|
|
19
|
-
assert_equal 4,
|
|
20
|
-
assert_equal 5,
|
|
21
|
-
assert_equal 6,
|
|
22
|
-
assert_equal
|
|
23
|
-
assert_equal point(1, 2, 3),
|
|
24
|
-
assert_equal point(4, 5, 6),
|
|
18
|
+
assert_equal 1, e.x
|
|
19
|
+
assert_equal 2, e.y
|
|
20
|
+
assert_equal 3, e.z
|
|
21
|
+
assert_equal 4, e.dx
|
|
22
|
+
assert_equal 5, e.dy
|
|
23
|
+
assert_equal 6, e.dz
|
|
24
|
+
assert_equal [:shift, :control, :alt], e.modifiers
|
|
25
|
+
assert_equal point(1, 2, 3), e. position
|
|
26
|
+
assert_equal point(4, 5, 6), e.dposition
|
|
25
27
|
end
|
|
26
28
|
|
|
27
29
|
def test_dup()
|
|
@@ -34,4 +36,16 @@ class TestWheelEvent < Test::Unit::TestCase
|
|
|
34
36
|
assert_true e3.blocked?
|
|
35
37
|
end
|
|
36
38
|
|
|
39
|
+
def test_modifiers()
|
|
40
|
+
e = event 0, 0, 0, 0, 0, 0, R::MOD_CONTROL | R::MOD_SCROLL
|
|
41
|
+
assert_equal [:control], e.modifiers
|
|
42
|
+
assert_equal [:control, :scroll], e.modifiers(all: true)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def test_inspect()
|
|
46
|
+
assert_equal(
|
|
47
|
+
"#<Reflex::WheelEvent x:1.0 y:2.0 z:3.0 dx:4.0 dy:5.0 dz:6.79 mod:[:control, :scroll]>",
|
|
48
|
+
event(1, 2, 3, 4, 5, 6.789, R::MOD_CONTROL | R::MOD_SCROLL).inspect)
|
|
49
|
+
end
|
|
50
|
+
|
|
37
51
|
end# TestWheelEvent
|
data/test/test_window.rb
CHANGED
|
@@ -3,78 +3,94 @@ 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
|
|
70
|
+
|
|
71
|
+
def test_frame_without_titlebar()
|
|
72
|
+
w = window titlebar: []
|
|
73
|
+
b = [100, 100, 300, 400]
|
|
52
74
|
|
|
53
|
-
w.frame =
|
|
54
|
-
|
|
55
|
-
w.frame = [1, 2]; assert_equal [0, 0, minw[1], 2], w.frame.to_a
|
|
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)
|
|
75
|
+
w.frame = b
|
|
76
|
+
assert_equal b, w.frame.to_a
|
|
62
77
|
|
|
63
|
-
w.frame =
|
|
64
|
-
|
|
65
|
-
|
|
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)
|
|
78
|
+
w.frame = w.frame
|
|
79
|
+
assert_equal b, w.frame.to_a
|
|
80
|
+
end
|
|
71
81
|
|
|
72
|
-
|
|
73
|
-
w
|
|
82
|
+
def test_menu()
|
|
83
|
+
w = window
|
|
84
|
+
m = Reflex::Menu.new
|
|
85
|
+
assert_nil w.menu
|
|
86
|
+
w.menu = m
|
|
87
|
+
assert_equal m, w.menu
|
|
88
|
+
w.menu = nil
|
|
89
|
+
assert_nil w.menu
|
|
74
90
|
end
|
|
75
91
|
|
|
76
92
|
def test_closable?()
|
|
77
|
-
w =
|
|
93
|
+
w = window
|
|
78
94
|
assert_true w.closable?
|
|
79
95
|
|
|
80
96
|
w.closable = false
|
|
@@ -91,7 +107,7 @@ class TestWindow < Test::Unit::TestCase
|
|
|
91
107
|
end
|
|
92
108
|
|
|
93
109
|
def test_minimizable?()
|
|
94
|
-
w =
|
|
110
|
+
w = window
|
|
95
111
|
assert_true w.minimizable?
|
|
96
112
|
|
|
97
113
|
w.minimizable = false
|
|
@@ -108,7 +124,7 @@ class TestWindow < Test::Unit::TestCase
|
|
|
108
124
|
end
|
|
109
125
|
|
|
110
126
|
def test_resizable?()
|
|
111
|
-
w =
|
|
127
|
+
w = window
|
|
112
128
|
assert_true w.resizable?
|
|
113
129
|
|
|
114
130
|
w.resizable = false
|
|
@@ -124,8 +140,87 @@ class TestWindow < Test::Unit::TestCase
|
|
|
124
140
|
assert_true w.resizable?
|
|
125
141
|
end
|
|
126
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
|
+
|
|
127
222
|
def test_fullscreen?()
|
|
128
|
-
w =
|
|
223
|
+
w = window
|
|
129
224
|
assert_false w.fullscreen?
|
|
130
225
|
|
|
131
226
|
w.fullscreen = true
|
|
@@ -141,8 +236,75 @@ class TestWindow < Test::Unit::TestCase
|
|
|
141
236
|
assert_false w.fullscreen?
|
|
142
237
|
end
|
|
143
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
|
+
|
|
144
306
|
def test_orientations()
|
|
145
|
-
w =
|
|
307
|
+
w = window
|
|
146
308
|
assert_equal [], w.orientations
|
|
147
309
|
|
|
148
310
|
assert_raise(ArgumentError) {w.orientations = [:portrait]}.then do |e|
|
|
@@ -154,11 +316,11 @@ class TestWindow < Test::Unit::TestCase
|
|
|
154
316
|
end
|
|
155
317
|
|
|
156
318
|
def test_screen()
|
|
157
|
-
assert_not_nil
|
|
319
|
+
assert_not_nil window.screen
|
|
158
320
|
end
|
|
159
321
|
|
|
160
322
|
def test_root()
|
|
161
|
-
w =
|
|
323
|
+
w = window
|
|
162
324
|
assert_not_nil w.root
|
|
163
325
|
assert_nil w.root.parent
|
|
164
326
|
assert_equal 'ROOT', w.root.name
|
|
@@ -166,7 +328,7 @@ class TestWindow < Test::Unit::TestCase
|
|
|
166
328
|
end
|
|
167
329
|
|
|
168
330
|
def test_inspect()
|
|
169
|
-
assert_match %r|#<Reflex::Window:0x\w{16}>|,
|
|
331
|
+
assert_match %r|#<Reflex::Window:0x\w{16}>|, window.inspect
|
|
170
332
|
end
|
|
171
333
|
|
|
172
334
|
end# TestWindow
|