sirius-client-win32 1.1.1 → 1.2.21
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/sirius/win32.rb +6 -0
- data/lib/sirius/win32/classes/Control.rb +10 -0
- data/lib/sirius/win32/classes/DialogBox.rb +10 -0
- data/lib/sirius/win32/classes/MainWindow.rb +17 -0
- data/lib/sirius/win32/classes/Menu.rb +10 -0
- data/lib/sirius/win32/classes/MenuItem.rb +10 -0
- data/lib/sirius/win32/classes/MovableWindow.rb +49 -0
- data/lib/sirius/win32/classes/TopLevelWindow.rb +32 -0
- data/lib/sirius/win32/classes/Window.rb +116 -0
- data/lib/sirius/win32/classes/controls/Button.rb +12 -0
- data/lib/sirius/win32/classes/controls/CheckBox.rb +12 -0
- data/lib/sirius/win32/classes/controls/Edit.rb +12 -0
- data/lib/sirius/win32/classes/controls/ListBox.rb +12 -0
- data/lib/sirius/win32/classes/controls/ListView.rb +12 -0
- data/lib/sirius/win32/classes/controls/RadioButton.rb +12 -0
- data/lib/sirius/win32/classes/controls/Toolbar.rb +12 -0
- data/lib/sirius/win32/classes/controls/UpDown.rb +12 -0
- data/lib/sirius/win32/core.rb +16 -0
- data/lib/sirius/win32/core/button/ButtonService.rb +71 -0
- data/lib/sirius/win32/core/button/ButtonServiceClient.rb +60 -0
- data/lib/sirius/win32/core/button/ButtonServiceDriver.rb +72 -0
- data/lib/sirius/win32/core/button/ButtonServiceMappingRegistry.rb +199 -0
- data/lib/sirius/win32/core/combobox/ComboBoxService.rb +471 -0
- data/lib/sirius/win32/core/combobox/ComboBoxServiceClient.rb +264 -0
- data/lib/sirius/win32/core/combobox/ComboBoxServiceDriver.rb +208 -0
- data/lib/sirius/win32/core/combobox/ComboBoxServiceMappingRegistry.rb +1100 -0
- data/lib/sirius/win32/core/dialog/DialogService.rb +187 -0
- data/lib/sirius/win32/core/dialog/DialogServiceClient.rb +108 -0
- data/lib/sirius/win32/core/dialog/DialogServiceDriver.rb +104 -0
- data/lib/sirius/win32/core/dialog/DialogServiceMappingRegistry.rb +424 -0
- data/lib/sirius/win32/core/edit/EditService.rb +358 -0
- data/lib/sirius/win32/core/edit/EditServiceClient.rb +216 -0
- data/lib/sirius/win32/core/edit/EditServiceDriver.rb +176 -0
- data/lib/sirius/win32/core/edit/EditServiceMappingRegistry.rb +859 -0
- data/lib/sirius/win32/core/listbox/ListBoxService.rb +379 -0
- data/lib/sirius/win32/core/listbox/ListBoxServiceClient.rb +216 -0
- data/lib/sirius/win32/core/listbox/ListBoxServiceDriver.rb +176 -0
- data/lib/sirius/win32/core/listbox/ListBoxServiceMappingRegistry.rb +880 -0
- data/lib/sirius/win32/core/menu/MenuService.rb +443 -0
- data/lib/sirius/win32/core/menu/MenuServiceClient.rb +144 -0
- data/lib/sirius/win32/core/menu/MenuServiceDriver.rb +128 -0
- data/lib/sirius/win32/core/menu/MenuServiceMappingRegistry.rb +830 -0
- data/lib/sirius/win32/core/tabcontrol/TabControlService.rb +286 -0
- data/lib/sirius/win32/core/tabcontrol/TabControlServiceClient.rb +120 -0
- data/lib/sirius/win32/core/tabcontrol/TabControlServiceDriver.rb +112 -0
- data/lib/sirius/win32/core/tabcontrol/TabControlServiceMappingRegistry.rb +583 -0
- data/lib/sirius/win32/core/utils/Win32UtilsService.rb +64 -0
- data/lib/sirius/win32/core/utils/Win32UtilsServiceClient.rb +36 -0
- data/lib/sirius/win32/core/utils/Win32UtilsServiceDriver.rb +56 -0
- data/lib/sirius/win32/core/utils/Win32UtilsServiceMappingRegistry.rb +136 -0
- data/lib/sirius/win32/core/window/WindowService.rb +625 -0
- data/lib/sirius/win32/core/window/WindowServiceClient.rb +360 -0
- data/lib/sirius/win32/core/window/WindowServiceDriver.rb +272 -0
- data/lib/sirius/win32/core/window/WindowServiceMappingRegistry.rb +1513 -0
- metadata +54 -2
data/lib/sirius/win32.rb
CHANGED
@@ -2,6 +2,12 @@ module Sirius
|
|
2
2
|
module Client
|
3
3
|
module Win32
|
4
4
|
class Win32
|
5
|
+
attr_accessor :core
|
6
|
+
attr_accessor :utils
|
7
|
+
def initialize(host="localhost",port="21212")
|
8
|
+
@core = Core::Core.new(host,port)
|
9
|
+
@utils = Core::Utils::Win32Utils.new("http://#{host}:#{port}/win32/utils")
|
10
|
+
end
|
5
11
|
end
|
6
12
|
end
|
7
13
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Sirius
|
2
|
+
module Client
|
3
|
+
module Win32
|
4
|
+
module Classes
|
5
|
+
class MainWindow < TopLevelWindow
|
6
|
+
def initialize(client=nil, locator=nil)
|
7
|
+
super(client, nil, locator)
|
8
|
+
end
|
9
|
+
|
10
|
+
def start(executable, params, workingDir)
|
11
|
+
@client.core.window.start(@locator.hwnd, executable, params, workingDir)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
module Sirius
|
2
|
+
module Client
|
3
|
+
module Win32
|
4
|
+
module Classes
|
5
|
+
class MovableWindow < Window
|
6
|
+
def initialize(client=nil, locator=nil,parent=nil)
|
7
|
+
super(client, parent, locator)
|
8
|
+
end
|
9
|
+
|
10
|
+
def moveTo(x, y)
|
11
|
+
@client.core.window.moveTo(@locator.hwnd, x, y);
|
12
|
+
end
|
13
|
+
|
14
|
+
def sizeTo(width, height)
|
15
|
+
@client.core.window.sizeTo(@locator.hwnd, width, height);
|
16
|
+
end
|
17
|
+
|
18
|
+
def minimize
|
19
|
+
@client.core.window.minimize(@locator.hwnd);
|
20
|
+
end
|
21
|
+
|
22
|
+
def maximize
|
23
|
+
@client.core.window.maximize(@locator.hwnd);
|
24
|
+
end
|
25
|
+
|
26
|
+
def restore
|
27
|
+
@client.core.window.restore(@locator.hwnd);
|
28
|
+
end
|
29
|
+
|
30
|
+
def minimized?
|
31
|
+
return @client.core.window.isMinimized(@locator.hwnd);
|
32
|
+
end
|
33
|
+
|
34
|
+
def maximized?
|
35
|
+
@client.core.window.isMaximized(@locator.hwnd);
|
36
|
+
end
|
37
|
+
|
38
|
+
def restored?
|
39
|
+
@client.core.window.isNormal(@locator.hwnd);
|
40
|
+
end
|
41
|
+
|
42
|
+
def close
|
43
|
+
@client.core.window.close(@locator.hwnd);
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Sirius
|
2
|
+
module Client
|
3
|
+
module Win32
|
4
|
+
module Classes
|
5
|
+
class TopLevelWindow < MovableWindow
|
6
|
+
def initialize(client=nil, locator=nil,parent=nil)
|
7
|
+
super(client, parent, locator)
|
8
|
+
end
|
9
|
+
|
10
|
+
def set_active
|
11
|
+
@client.core.window.activate(@locator.hwnd)
|
12
|
+
end
|
13
|
+
|
14
|
+
def menu
|
15
|
+
if exists?
|
16
|
+
return Menu.new(client,self)
|
17
|
+
end
|
18
|
+
return nil
|
19
|
+
end
|
20
|
+
|
21
|
+
def system_menu
|
22
|
+
if (exists?)
|
23
|
+
@hmenu = @client.core.window.getSystemMenu(@locator.hwnd, true);
|
24
|
+
return Menu.new(client, self, @hmenu)
|
25
|
+
end
|
26
|
+
return nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
module Sirius
|
2
|
+
module Client
|
3
|
+
module Win32
|
4
|
+
module Classes
|
5
|
+
class Window
|
6
|
+
attr_accessor :client
|
7
|
+
attr_accessor :locator
|
8
|
+
attr_accessor :parent
|
9
|
+
|
10
|
+
def initialize(locator,client=nil,parent=nil)
|
11
|
+
@locator = locator
|
12
|
+
@client = client
|
13
|
+
@parent=parent
|
14
|
+
|
15
|
+
if(parent != nil)
|
16
|
+
@client = @parent.client
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def click
|
21
|
+
return unless exists?
|
22
|
+
@client.core.window.click(@locator.hwnd, 0, 0, 0, false, false, false);
|
23
|
+
end
|
24
|
+
|
25
|
+
def type_keys(text)
|
26
|
+
return unless exists?
|
27
|
+
text.split('//').each { |key|
|
28
|
+
@client.core.window.keyPress(@locator.hwnd, key);
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def exists?
|
33
|
+
if (@parent != nil)
|
34
|
+
|
35
|
+
if (!@parent.exists?)
|
36
|
+
return false;
|
37
|
+
else
|
38
|
+
@locator.parent = @parent.hwnd
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
@locator.hwnd = 0
|
43
|
+
if(@parent != nil)
|
44
|
+
@client = @parent.client
|
45
|
+
end
|
46
|
+
|
47
|
+
@locator.hwnd = @client.utils.searchWindow(@locator)
|
48
|
+
|
49
|
+
if @locator.hwnd != 0
|
50
|
+
return true;
|
51
|
+
else
|
52
|
+
@locator.hwnd = 0
|
53
|
+
end
|
54
|
+
|
55
|
+
return false;
|
56
|
+
end
|
57
|
+
|
58
|
+
=begin
|
59
|
+
private Class<?>[] getArrayTypes(Object... params) {
|
60
|
+
Class<?>[] types = new Class[params.length];
|
61
|
+
for (int i = 0; i < params.length; i++) {
|
62
|
+
types[i] = params[i].getClass();
|
63
|
+
}
|
64
|
+
return types;
|
65
|
+
}
|
66
|
+
|
67
|
+
public boolean waitFor(long timeout, String methodName,
|
68
|
+
Object expectedValue, Object... params) throws Exception {
|
69
|
+
long end = (new Date()).getTime() + timeout;
|
70
|
+
Class<?>[] parameterTypes = getArrayTypes(params);
|
71
|
+
while ((new Date()).getTime() < end) {
|
72
|
+
Method waitMethod = this.getClass().getMethod(methodName,
|
73
|
+
parameterTypes);
|
74
|
+
Object result = waitMethod.invoke(this, params);
|
75
|
+
if (result.equals(expectedValue)) {
|
76
|
+
return true;
|
77
|
+
}
|
78
|
+
}
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
|
82
|
+
public boolean exists(long timeout) throws Exception {
|
83
|
+
return waitFor(timeout, "exists", true);
|
84
|
+
}
|
85
|
+
=end
|
86
|
+
|
87
|
+
def disappears?
|
88
|
+
!exists?
|
89
|
+
end
|
90
|
+
=begin
|
91
|
+
public boolean disappears(long timeout) throws Exception {
|
92
|
+
return waitFor(timeout, "disappears", true);
|
93
|
+
}
|
94
|
+
=end
|
95
|
+
|
96
|
+
def get_client_rect
|
97
|
+
@client.core.window.getClientRect(@locator.hwnd)
|
98
|
+
end
|
99
|
+
|
100
|
+
def get_rect
|
101
|
+
@client.core.window.getRect(@locator.hwnd)
|
102
|
+
end
|
103
|
+
|
104
|
+
def enabled?
|
105
|
+
@client.core.window.isEnabled(@locator.hwnd)
|
106
|
+
end
|
107
|
+
|
108
|
+
def visible?
|
109
|
+
@client.core.window.isVisible(@locator.hwnd);
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
data/lib/sirius/win32/core.rb
CHANGED
@@ -3,7 +3,23 @@ module Sirius
|
|
3
3
|
module Win32
|
4
4
|
module Core
|
5
5
|
class Core
|
6
|
+
attr_accessor :button
|
7
|
+
attr_accessor :dialog
|
8
|
+
attr_accessor :edit
|
9
|
+
attr_accessor :listbox
|
10
|
+
attr_accessor :menu
|
11
|
+
attr_accessor :tabcontrol
|
12
|
+
attr_accessor :window
|
6
13
|
|
14
|
+
def initialize(host = "localhost",port="21212")
|
15
|
+
@button = Button::Button.new("http://#{host}:#{port}/win32/button")
|
16
|
+
@dialog = Dialog::Dialog.new("http://#{host}:#{port}/win32/dialog")
|
17
|
+
@edit = Edit::Edit.new("http://#{host}:#{port}/win32/edit")
|
18
|
+
@listbox = Listbox::ListBox.new("http://#{host}:#{port}/win32/listbox")
|
19
|
+
@menu = Menu::Menu.new("http://#{host}:#{port}/win32/menu")
|
20
|
+
@tabcontrol = Tabcontrol::TabControl.new("http://#{host}:#{port}/win32/tabcontrol")
|
21
|
+
@window = Window::Window.new("http://#{host}:#{port}/win32/window")
|
22
|
+
end
|
7
23
|
end
|
8
24
|
end
|
9
25
|
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'xsd/qname'
|
2
|
+
|
3
|
+
module Sirius; module Client; module Win32; module Core; module Button
|
4
|
+
|
5
|
+
# {http:controls.classes.win32.server.sirius.org/}GetState
|
6
|
+
# arg0 - SOAP::SOAPLong
|
7
|
class GetState
|
8
|
+
attr_accessor :arg0
|
9
|
+
def initialize(arg0 = nil) @arg0 = arg0
|
10
|
+
end
|
11
|
+
end
|
12
|
+
# {http:controls.classes.win32.server.sirius.org/}GetStateResponse
|
13
|
+
# m_return - SOAP::SOAPInt
|
14
|
+
class GetStateResponse
|
1
15
|
def m_return
|
16
|
+
@v_return
|
17
|
+
end
|
18
|
+
|
19
|
+
def m_return=(value) @v_return = value
|
20
|
+
end
|
21
|
+
|
22
|
+
def initialize(v_return = nil) @v_return = v_return
|
23
|
+
end
|
24
|
+
end
|
25
|
+
# {http:controls.classes.win32.server.sirius.org/}SetCheck
|
26
|
+
# arg0 - SOAP::SOAPLong
|
27
|
+
# arg1 - SOAP::SOAPInt
|
28
|
+
class SetCheck
|
29
|
+
attr_accessor :arg0
|
30
|
+
attr_accessor :arg1
|
31
|
+
def initialize(arg0 = nil, arg1 = nil) @arg0 = arg0
|
32
|
+
@arg1 = arg1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
# {http:controls.classes.win32.server.sirius.org/}SetCheckResponse
|
36
|
+
class SetCheckResponse
|
2
37
|
def initialize
|
38
|
+
end
|
39
|
+
end
|
40
|
+
# {http:controls.classes.win32.server.sirius.org/}SetState
|
41
|
+
# arg0 - SOAP::SOAPLong
|
42
|
+
# arg1 - SOAP::SOAPInt
|
43
|
+
class SetState
|
44
|
+
attr_accessor :arg0
|
45
|
+
attr_accessor :arg1
|
46
|
+
def initialize(arg0 = nil, arg1 = nil) @arg0 = arg0
|
47
|
+
@arg1 = arg1
|
48
|
+
end
|
49
|
+
end
|
50
|
+
# {http:controls.classes.win32.server.sirius.org/}SetStateResponse
|
51
|
+
class SetStateResponse
|
3
52
|
def initialize
|
53
|
+
end
|
54
|
+
end
|
55
|
+
# {http:controls.classes.win32.server.sirius.org/}GetCheck
|
56
|
+
# arg0 - SOAP::SOAPLong
|
57
|
+
class GetCheck
|
58
|
+
attr_accessor :arg0
|
59
|
+
def initialize(arg0 = nil) @arg0 = arg0
|
60
|
+
end
|
61
|
+
end
|
62
|
+
# {http:controls.classes.win32.server.sirius.org/}GetCheckResponse
|
63
|
+
# m_return - SOAP::SOAPInt
|
64
|
+
class GetCheckResponse
|
4
65
|
def m_return
|
66
|
+
@v_return
|
67
|
+
end
|
68
|
+
|
69
|
+
def m_return=(value) @v_return = value
|
70
|
+
end
|
71
|
+
|
72
|
+
def initialize(v_return = nil) @v_return = v_return
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end; end; end; end; end
|