reflexion 0.1.40 → 0.1.42
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/native.cpp +2 -0
- data/.doc/ext/reflex/screen.cpp +53 -0
- data/.doc/ext/reflex/window.cpp +70 -12
- data/ChangeLog.md +15 -0
- data/VERSION +1 -1
- data/ext/reflex/native.cpp +2 -0
- data/ext/reflex/screen.cpp +55 -0
- data/ext/reflex/window.cpp +76 -13
- data/include/reflex/ruby/screen.h +40 -0
- data/include/reflex/screen.h +43 -0
- data/include/reflex/window.h +21 -3
- data/lib/reflex/screen.rb +21 -0
- data/lib/reflex/window.rb +3 -1
- data/lib/reflex.rb +1 -0
- data/reflex.gemspec +5 -8
- data/src/ios/screen.h +20 -0
- data/src/ios/screen.mm +62 -0
- data/src/ios/view_controller.h +2 -0
- data/src/ios/view_controller.mm +6 -0
- data/src/ios/window.h +1 -3
- data/src/ios/window.mm +38 -17
- data/src/osx/native_window.mm +10 -10
- data/src/osx/screen.h +21 -0
- data/src/osx/screen.mm +62 -0
- data/src/osx/window.h +5 -3
- data/src/osx/window.mm +46 -21
- data/src/window.cpp +40 -7
- data/src/window.h +8 -9
- data/test/test_event.rb +4 -0
- data/test/test_screen.rb +18 -0
- data/test/test_view.rb +6 -6
- data/test/test_window.rb +48 -6
- metadata +22 -10
data/src/ios/screen.mm
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
// -*- mode: objc -*-
|
2
|
+
#include "screen.h"
|
3
|
+
|
4
|
+
|
5
|
+
#include "reflex/exception.h"
|
6
|
+
|
7
|
+
|
8
|
+
namespace Reflex
|
9
|
+
{
|
10
|
+
|
11
|
+
|
12
|
+
struct Screen::Data
|
13
|
+
{
|
14
|
+
|
15
|
+
UIScreen* screen = nil;
|
16
|
+
|
17
|
+
~Data ()
|
18
|
+
{
|
19
|
+
if (screen) [screen release];
|
20
|
+
}
|
21
|
+
|
22
|
+
};// Screen::Data
|
23
|
+
|
24
|
+
|
25
|
+
void
|
26
|
+
Screen_initialize (Screen* pthis, UIScreen* screen)
|
27
|
+
{
|
28
|
+
pthis->self->screen = [screen retain];
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
Screen::Screen ()
|
33
|
+
{
|
34
|
+
}
|
35
|
+
|
36
|
+
Screen::~Screen ()
|
37
|
+
{
|
38
|
+
}
|
39
|
+
|
40
|
+
Bounds
|
41
|
+
Screen::frame () const
|
42
|
+
{
|
43
|
+
if (!*this)
|
44
|
+
invalid_state_error(__FILE__, __LINE__);
|
45
|
+
|
46
|
+
CGRect b = self->screen.bounds;
|
47
|
+
return Bounds(b.origin.x, b.origin.y, b.size.width, b.size.height);
|
48
|
+
}
|
49
|
+
|
50
|
+
Screen::operator bool () const
|
51
|
+
{
|
52
|
+
return self->screen;
|
53
|
+
}
|
54
|
+
|
55
|
+
bool
|
56
|
+
Screen::operator ! () const
|
57
|
+
{
|
58
|
+
return !operator bool();
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
}// Reflex
|
data/src/ios/view_controller.h
CHANGED
data/src/ios/view_controller.mm
CHANGED
@@ -293,6 +293,12 @@ ReflexViewController_get_show_fun ()
|
|
293
293
|
[super viewDidDisappear: animated];
|
294
294
|
}
|
295
295
|
|
296
|
+
- (void)viewDidLayoutSubviews
|
297
|
+
{
|
298
|
+
[super viewDidLayoutSubviews];
|
299
|
+
self.reflexView.frame = self.view.bounds;
|
300
|
+
}
|
301
|
+
|
296
302
|
- (void) startTimer
|
297
303
|
{
|
298
304
|
[self startTimer: 60];
|
data/src/ios/window.h
CHANGED
data/src/ios/window.mm
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
|
5
5
|
#include "reflex/exception.h"
|
6
|
+
#include "screen.h"
|
6
7
|
#import "view_controller.h"
|
7
8
|
|
8
9
|
|
@@ -48,6 +49,12 @@ namespace Reflex
|
|
48
49
|
return new WindowData();
|
49
50
|
}
|
50
51
|
|
52
|
+
uint
|
53
|
+
Window_default_flags ()
|
54
|
+
{
|
55
|
+
return 0;
|
56
|
+
}
|
57
|
+
|
51
58
|
void
|
52
59
|
Window_initialize (Window* window)
|
53
60
|
{
|
@@ -127,24 +134,44 @@ namespace Reflex
|
|
127
134
|
Bounds
|
128
135
|
Window_get_frame (const Window& window)
|
129
136
|
{
|
130
|
-
CGRect
|
131
|
-
return Bounds(
|
132
|
-
rect.origin.x,
|
133
|
-
rect.origin.y,
|
134
|
-
rect.size.width,
|
135
|
-
rect.size.height);
|
137
|
+
CGRect b = get_vc(&window).reflexView.bounds;
|
138
|
+
return Bounds(b.origin.x, b.origin.y, b.size.width, b.size.height);
|
136
139
|
}
|
137
140
|
|
138
141
|
void
|
139
|
-
|
142
|
+
Window_set_flags (Window* window, uint flags)
|
140
143
|
{
|
141
|
-
|
144
|
+
if (Xot::has_flag(flags, Window::FLAG_CLOSABLE))
|
145
|
+
argument_error(__FILE__, __LINE__, "FLAG_CLOSABLE is not supported");
|
146
|
+
|
147
|
+
if (Xot::has_flag(flags, Window::FLAG_MINIMIZABLE))
|
148
|
+
argument_error(__FILE__, __LINE__, "FLAG_MINIMIZABLE is not supported");
|
149
|
+
|
150
|
+
if (Xot::has_flag(flags, Window::FLAG_RESIZABLE))
|
151
|
+
argument_error(__FILE__, __LINE__, "FLAG_RESIZABLE is not supported");
|
152
|
+
}
|
153
|
+
|
154
|
+
static UIScreen*
|
155
|
+
get_screen (const Window& window)
|
156
|
+
{
|
157
|
+
UIWindow* w = get_vc(&window).view.window;
|
158
|
+
if (@available(iOS 13.0, *))
|
159
|
+
{
|
160
|
+
return w.windowScene.screen;
|
161
|
+
}
|
162
|
+
else
|
163
|
+
{
|
164
|
+
return w.screen;
|
165
|
+
}
|
142
166
|
}
|
143
167
|
|
144
|
-
|
145
|
-
|
168
|
+
Screen
|
169
|
+
Window_get_screen (const Window& window)
|
146
170
|
{
|
147
|
-
|
171
|
+
Screen s;
|
172
|
+
UIScreen* screen = get_screen(window);
|
173
|
+
Screen_initialize(&s, screen ? screen : UIScreen.mainScreen);
|
174
|
+
return s;
|
148
175
|
}
|
149
176
|
|
150
177
|
float
|
@@ -154,10 +181,4 @@ namespace Reflex
|
|
154
181
|
}
|
155
182
|
|
156
183
|
|
157
|
-
WindowData::WindowData ()
|
158
|
-
{
|
159
|
-
view_controller = nil;
|
160
|
-
}
|
161
|
-
|
162
|
-
|
163
184
|
}// Reflex
|
data/src/osx/native_window.mm
CHANGED
@@ -12,13 +12,13 @@
|
|
12
12
|
#import "opengl_view.h"
|
13
13
|
|
14
14
|
|
15
|
-
static
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
static NSWindowStyleMask
|
16
|
+
default_style_mask ()
|
17
|
+
{
|
18
|
+
return Reflex::Window_make_style_mask(
|
19
|
+
Reflex::Window_default_flags(),
|
20
|
+
NSTitledWindowMask | NSTexturedBackgroundWindowMask);
|
21
|
+
}
|
22
22
|
|
23
23
|
static int
|
24
24
|
count_mouse_buttons (const Reflex::PointerEvent& e)
|
@@ -67,7 +67,7 @@ update_pixel_density (Reflex::Window* window)
|
|
67
67
|
{
|
68
68
|
self = [super
|
69
69
|
initWithContentRect: NSMakeRect(0, 0, 0, 0)
|
70
|
-
styleMask:
|
70
|
+
styleMask: default_style_mask()
|
71
71
|
backing: NSBackingStoreBuffered
|
72
72
|
defer: NO];
|
73
73
|
if (!self) return nil;
|
@@ -368,7 +368,7 @@ update_pixel_density (Reflex::Window* window)
|
|
368
368
|
if (clicking_count == 0)
|
369
369
|
++pointer_id;
|
370
370
|
else if (clicking_count < 0)
|
371
|
-
Reflex::invalid_state_error(__FILE__, __LINE__);
|
371
|
+
return;//Reflex::invalid_state_error(__FILE__, __LINE__);
|
372
372
|
|
373
373
|
Window_call_pointer_event(win, &e);
|
374
374
|
}
|
@@ -420,7 +420,7 @@ update_pixel_density (Reflex::Window* window)
|
|
420
420
|
{
|
421
421
|
return [NSWindow
|
422
422
|
frameRectForContentRect: contentRect
|
423
|
-
styleMask:
|
423
|
+
styleMask: default_style_mask()];
|
424
424
|
}
|
425
425
|
|
426
426
|
@end// NativeWindow
|
data/src/osx/screen.h
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_SRC_OSX_SCREEN_H__
|
4
|
+
#define __REFLEX_SRC_OSX_SCREEN_H__
|
5
|
+
|
6
|
+
|
7
|
+
#import <AppKit/NSScreen.h>
|
8
|
+
#include "reflex/screen.h"
|
9
|
+
|
10
|
+
|
11
|
+
namespace Reflex
|
12
|
+
{
|
13
|
+
|
14
|
+
|
15
|
+
void Screen_initialize (Screen* pthis, NSScreen* screen);
|
16
|
+
|
17
|
+
|
18
|
+
}// Reflex
|
19
|
+
|
20
|
+
|
21
|
+
#endif//EOH
|
data/src/osx/screen.mm
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
// -*- mode: objc -*-
|
2
|
+
#include "screen.h"
|
3
|
+
|
4
|
+
|
5
|
+
#include "reflex/exception.h"
|
6
|
+
|
7
|
+
|
8
|
+
namespace Reflex
|
9
|
+
{
|
10
|
+
|
11
|
+
|
12
|
+
struct Screen::Data
|
13
|
+
{
|
14
|
+
|
15
|
+
NSScreen* screen = nil;
|
16
|
+
|
17
|
+
~Data ()
|
18
|
+
{
|
19
|
+
if (screen) [screen release];
|
20
|
+
}
|
21
|
+
|
22
|
+
};// Screen::Data
|
23
|
+
|
24
|
+
|
25
|
+
void
|
26
|
+
Screen_initialize (Screen* pthis, NSScreen* screen)
|
27
|
+
{
|
28
|
+
pthis->self->screen = [screen retain];
|
29
|
+
}
|
30
|
+
|
31
|
+
|
32
|
+
Screen::Screen ()
|
33
|
+
{
|
34
|
+
}
|
35
|
+
|
36
|
+
Screen::~Screen ()
|
37
|
+
{
|
38
|
+
}
|
39
|
+
|
40
|
+
Bounds
|
41
|
+
Screen::frame () const
|
42
|
+
{
|
43
|
+
if (!*this)
|
44
|
+
invalid_state_error(__FILE__, __LINE__);
|
45
|
+
|
46
|
+
NSRect f = self->screen.frame;
|
47
|
+
return Bounds(f.origin.x, f.origin.y, f.size.width, f.size.height);
|
48
|
+
}
|
49
|
+
|
50
|
+
Screen::operator bool () const
|
51
|
+
{
|
52
|
+
return self->screen;
|
53
|
+
}
|
54
|
+
|
55
|
+
bool
|
56
|
+
Screen::operator ! () const
|
57
|
+
{
|
58
|
+
return !operator bool();
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
}// Reflex
|
data/src/osx/window.h
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
#define __REFLEX_SRC_OSX_WINDOW_H__
|
5
5
|
|
6
6
|
|
7
|
+
#import <AppKit/NSWindow.h>
|
7
8
|
#include "../window.h"
|
8
9
|
|
9
10
|
|
@@ -17,12 +18,10 @@ namespace Reflex
|
|
17
18
|
struct WindowData : public Window::Data
|
18
19
|
{
|
19
20
|
|
20
|
-
NativeWindow* native;
|
21
|
+
NativeWindow* native = nil;
|
21
22
|
|
22
23
|
mutable String title_tmp;
|
23
24
|
|
24
|
-
WindowData ();
|
25
|
-
|
26
25
|
bool is_valid () const
|
27
26
|
{
|
28
27
|
return native;
|
@@ -35,6 +34,9 @@ namespace Reflex
|
|
35
34
|
|
36
35
|
const WindowData& Window_get_data (const Window* window);
|
37
36
|
|
37
|
+
NSWindowStyleMask Window_make_style_mask (
|
38
|
+
uint flags, NSWindowStyleMask styleMask = 0);
|
39
|
+
|
38
40
|
|
39
41
|
}// Reflex
|
40
42
|
|
data/src/osx/window.mm
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
|
5
5
|
#import <Cocoa/Cocoa.h>
|
6
6
|
#include "reflex/exception.h"
|
7
|
+
#include "screen.h"
|
7
8
|
#import "native_window.h"
|
8
9
|
|
9
10
|
|
@@ -31,6 +32,27 @@ namespace Reflex
|
|
31
32
|
return Window_get_data(const_cast<Window*>(window));
|
32
33
|
}
|
33
34
|
|
35
|
+
NSWindowStyleMask
|
36
|
+
Window_make_style_mask (uint flags, NSWindowStyleMask styleMask)
|
37
|
+
{
|
38
|
+
if (Xot::has_flag(flags, Window::FLAG_CLOSABLE))
|
39
|
+
styleMask |= NSWindowStyleMaskClosable;
|
40
|
+
else
|
41
|
+
styleMask &= ~NSWindowStyleMaskClosable;
|
42
|
+
|
43
|
+
if (Xot::has_flag(flags, Window::FLAG_MINIMIZABLE))
|
44
|
+
styleMask |= NSWindowStyleMaskMiniaturizable;
|
45
|
+
else
|
46
|
+
styleMask &= ~NSWindowStyleMaskMiniaturizable;
|
47
|
+
|
48
|
+
if (Xot::has_flag(flags, Window::FLAG_RESIZABLE))
|
49
|
+
styleMask |= NSWindowStyleMaskResizable;
|
50
|
+
else
|
51
|
+
styleMask &= ~NSWindowStyleMaskResizable;
|
52
|
+
|
53
|
+
return styleMask;
|
54
|
+
}
|
55
|
+
|
34
56
|
static NativeWindow*
|
35
57
|
get_native (const Window* window)
|
36
58
|
{
|
@@ -48,6 +70,15 @@ namespace Reflex
|
|
48
70
|
return new WindowData();
|
49
71
|
}
|
50
72
|
|
73
|
+
uint
|
74
|
+
Window_default_flags ()
|
75
|
+
{
|
76
|
+
return
|
77
|
+
Window::FLAG_CLOSABLE |
|
78
|
+
Window::FLAG_MINIMIZABLE |
|
79
|
+
Window::FLAG_RESIZABLE;
|
80
|
+
}
|
81
|
+
|
51
82
|
void
|
52
83
|
Window_initialize (Window* window)
|
53
84
|
{
|
@@ -104,28 +135,28 @@ namespace Reflex
|
|
104
135
|
Window_get_frame (const Window& window)
|
105
136
|
{
|
106
137
|
NativeWindow* native = get_native(&window);
|
107
|
-
NSRect
|
108
|
-
return Bounds(
|
109
|
-
rect.origin.x,
|
110
|
-
rect.origin.y,
|
111
|
-
rect.size.width,
|
112
|
-
rect.size.height);
|
138
|
+
NSRect r = [native contentRectForFrameRect: [native frame]];
|
139
|
+
return Bounds(r.origin.x, r.origin.y, r.size.width, r.size.height);
|
113
140
|
}
|
114
141
|
|
115
142
|
void
|
116
|
-
|
143
|
+
Window_set_flags (Window* window, uint flags)
|
117
144
|
{
|
118
|
-
NativeWindow* native
|
119
|
-
|
120
|
-
native.styleMask
|
121
|
-
|
122
|
-
|
145
|
+
NativeWindow* native = get_native(window);
|
146
|
+
NSWindowStyleMask styleMask =
|
147
|
+
Window_make_style_mask(window->self->flags, native.styleMask);
|
148
|
+
|
149
|
+
if (styleMask != native.styleMask)
|
150
|
+
native.styleMask = styleMask;
|
123
151
|
}
|
124
152
|
|
125
|
-
|
126
|
-
|
153
|
+
Screen
|
154
|
+
Window_get_screen (const Window& window)
|
127
155
|
{
|
128
|
-
|
156
|
+
Screen s;
|
157
|
+
NSScreen* screen = get_native(&window).screen;
|
158
|
+
if (screen) Screen_initialize(&s, screen);
|
159
|
+
return s;
|
129
160
|
}
|
130
161
|
|
131
162
|
float
|
@@ -135,10 +166,4 @@ namespace Reflex
|
|
135
166
|
}
|
136
167
|
|
137
168
|
|
138
|
-
WindowData::WindowData ()
|
139
|
-
{
|
140
|
-
native = nil;
|
141
|
-
}
|
142
|
-
|
143
|
-
|
144
169
|
}// Reflex
|
data/src/window.cpp
CHANGED
@@ -22,6 +22,17 @@ namespace Reflex
|
|
22
22
|
using TargetPointerMap = Window::Data::TargetPointerMap;
|
23
23
|
|
24
24
|
|
25
|
+
Window::Data::Data ()
|
26
|
+
: flags(Window_default_flags())
|
27
|
+
{
|
28
|
+
prev_time_update = prev_time_draw = Xot::time();
|
29
|
+
}
|
30
|
+
|
31
|
+
Window::Data::~Data ()
|
32
|
+
{
|
33
|
+
}
|
34
|
+
|
35
|
+
|
25
36
|
Window::Data::PointerData::PointerData (uint view_index)
|
26
37
|
: view_index(view_index)
|
27
38
|
{
|
@@ -450,6 +461,12 @@ namespace Reflex
|
|
450
461
|
self->hide_count = new_count;
|
451
462
|
}
|
452
463
|
|
464
|
+
bool
|
465
|
+
Window::hidden () const
|
466
|
+
{
|
467
|
+
return self->hide_count > 0;
|
468
|
+
}
|
469
|
+
|
453
470
|
void
|
454
471
|
Window::close (bool force)
|
455
472
|
{
|
@@ -512,21 +529,37 @@ namespace Reflex
|
|
512
529
|
}
|
513
530
|
|
514
531
|
void
|
515
|
-
Window::
|
532
|
+
Window::add_flag (uint flags)
|
516
533
|
{
|
517
|
-
|
534
|
+
uint value = self->flags;
|
535
|
+
Xot::add_flag(&value, flags);
|
536
|
+
|
537
|
+
Window_set_flags(this, value);
|
538
|
+
|
539
|
+
self->flags = value;
|
518
540
|
}
|
519
541
|
|
520
|
-
|
521
|
-
Window::
|
542
|
+
void
|
543
|
+
Window::remove_flag (uint flags)
|
522
544
|
{
|
523
|
-
|
545
|
+
uint value = self->flags;
|
546
|
+
Xot::remove_flag(&value, flags);
|
547
|
+
|
548
|
+
Window_set_flags(this, value);
|
549
|
+
|
550
|
+
self->flags = value;
|
524
551
|
}
|
525
552
|
|
526
553
|
bool
|
527
|
-
Window::
|
554
|
+
Window::has_flag (uint flags) const
|
528
555
|
{
|
529
|
-
return self->
|
556
|
+
return Xot::has_flag(self->flags, flags);
|
557
|
+
}
|
558
|
+
|
559
|
+
Screen
|
560
|
+
Window::screen () const
|
561
|
+
{
|
562
|
+
return Window_get_screen(*this);
|
530
563
|
}
|
531
564
|
|
532
565
|
View*
|
data/src/window.h
CHANGED
@@ -51,14 +51,11 @@ namespace Reflex
|
|
51
51
|
|
52
52
|
CaptureMap captures;
|
53
53
|
|
54
|
-
|
55
|
-
{
|
56
|
-
prev_time_update = prev_time_draw = Xot::time();
|
57
|
-
}
|
54
|
+
uint flags;
|
58
55
|
|
59
|
-
|
60
|
-
|
61
|
-
|
56
|
+
Data ();
|
57
|
+
|
58
|
+
virtual ~Data ();
|
62
59
|
|
63
60
|
virtual bool is_valid () const = 0;
|
64
61
|
|
@@ -77,6 +74,8 @@ namespace Reflex
|
|
77
74
|
|
78
75
|
Window::Data* Window_create_data ();
|
79
76
|
|
77
|
+
uint Window_default_flags ();
|
78
|
+
|
80
79
|
void Window_initialize (Window* window);
|
81
80
|
|
82
81
|
void Window_show (Window* window);
|
@@ -94,9 +93,9 @@ namespace Reflex
|
|
94
93
|
|
95
94
|
Bounds Window_get_frame (const Window& window);
|
96
95
|
|
97
|
-
|
96
|
+
Screen Window_get_screen (const Window& window);
|
98
97
|
|
99
|
-
|
98
|
+
void Window_set_flags (Window* window, uint flags);
|
100
99
|
|
101
100
|
void Window_set_focus (Window* window, View* view);
|
102
101
|
|
data/test/test_event.rb
CHANGED
data/test/test_screen.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require_relative 'helper'
|
2
|
+
|
3
|
+
|
4
|
+
class TestScreen < Test::Unit::TestCase
|
5
|
+
|
6
|
+
def screen()
|
7
|
+
Reflex::Window.new.screen
|
8
|
+
end
|
9
|
+
|
10
|
+
def test_initialize()
|
11
|
+
assert_raise(Reflex::ReflexError) {Reflex::Screen.new}
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_frame()
|
15
|
+
assert_raise(Rucy::InvalidObjectError) {screen.frame}
|
16
|
+
end
|
17
|
+
|
18
|
+
end# TestScreen
|
data/test/test_view.rb
CHANGED
@@ -28,21 +28,21 @@ class TestView < Test::Unit::TestCase
|
|
28
28
|
|
29
29
|
def test_show_hide_hidden()
|
30
30
|
v = view
|
31
|
-
|
31
|
+
assert_false v.hidden?
|
32
32
|
v.hide
|
33
|
-
|
33
|
+
assert_true v.hidden?
|
34
34
|
v.show
|
35
|
-
|
35
|
+
assert_false v.hidden?
|
36
36
|
end
|
37
37
|
|
38
38
|
def test_hidden_count()
|
39
39
|
v = view
|
40
40
|
v.show
|
41
|
-
|
41
|
+
assert_false v.hidden?
|
42
42
|
v.hide
|
43
|
-
|
43
|
+
assert_false v.hidden?
|
44
44
|
v.hide
|
45
|
-
|
45
|
+
assert_true v.hidden?
|
46
46
|
end
|
47
47
|
|
48
48
|
def test_coord_conversion()
|
data/test/test_window.rb
CHANGED
@@ -12,17 +12,21 @@ class TestWindow < Test::Unit::TestCase
|
|
12
12
|
|
13
13
|
def test_show_hide_hidden()
|
14
14
|
w = win
|
15
|
-
|
15
|
+
assert_true w.hidden
|
16
16
|
w.show
|
17
|
-
|
17
|
+
assert_false w.hidden
|
18
18
|
w.hide
|
19
|
-
|
19
|
+
assert_true w.hidden
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_hidden_count()
|
23
|
+
w = win
|
20
24
|
w.hide
|
21
|
-
|
25
|
+
assert_true w.hidden
|
22
26
|
w.show
|
23
|
-
|
27
|
+
assert_true w.hidden
|
24
28
|
w.show
|
25
|
-
|
29
|
+
assert_false w.hidden
|
26
30
|
end
|
27
31
|
|
28
32
|
def test_coord_conversion()
|
@@ -66,6 +70,40 @@ class TestWindow < Test::Unit::TestCase
|
|
66
70
|
w.frame = [bounds(1, 2, 3, 4, 5, 6)]; assert_equal [1, 2, 0, 4, 5, 0], w.frame.to_a(3)
|
67
71
|
end
|
68
72
|
|
73
|
+
def test_closable?()
|
74
|
+
w = win
|
75
|
+
assert_true w.closable?
|
76
|
+
|
77
|
+
w.closable = false
|
78
|
+
assert_false w.closable?
|
79
|
+
|
80
|
+
w.closable = true
|
81
|
+
assert_true w.closable?
|
82
|
+
|
83
|
+
w.closable false
|
84
|
+
assert_false w.closable?
|
85
|
+
|
86
|
+
w.closable true
|
87
|
+
assert_true w.closable?
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_minimizable?()
|
91
|
+
w = win
|
92
|
+
assert_true w.minimizable?
|
93
|
+
|
94
|
+
w.minimizable = false
|
95
|
+
assert_false w.minimizable?
|
96
|
+
|
97
|
+
w.minimizable = true
|
98
|
+
assert_true w.minimizable?
|
99
|
+
|
100
|
+
w.minimizable false
|
101
|
+
assert_false w.minimizable?
|
102
|
+
|
103
|
+
w.minimizable true
|
104
|
+
assert_true w.minimizable?
|
105
|
+
end
|
106
|
+
|
69
107
|
def test_resizable?()
|
70
108
|
w = win
|
71
109
|
assert_true w.resizable?
|
@@ -83,6 +121,10 @@ class TestWindow < Test::Unit::TestCase
|
|
83
121
|
assert_true w.resizable?
|
84
122
|
end
|
85
123
|
|
124
|
+
def test_screen()
|
125
|
+
assert_not_nil win.screen
|
126
|
+
end
|
127
|
+
|
86
128
|
def test_root()
|
87
129
|
w = win
|
88
130
|
assert_not_nil w.root
|