sirius-client-win32 2013.4.1.0 → 2013.4.30.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.
Files changed (50) hide show
  1. data/Rakefile +31 -1
  2. data/lib/sirius/win32.rb +6 -3
  3. data/lib/sirius/win32/classes/Control.rb +7 -1
  4. data/lib/sirius/win32/classes/DialogBox.rb +27 -2
  5. data/lib/sirius/win32/classes/MainWindow.rb +6 -2
  6. data/lib/sirius/win32/classes/Menu.rb +21 -11
  7. data/lib/sirius/win32/classes/MenuItem.rb +4 -5
  8. data/lib/sirius/win32/classes/MovableWindow.rb +3 -3
  9. data/lib/sirius/win32/classes/TopLevelWindow.rb +5 -4
  10. data/lib/sirius/win32/classes/Window.rb +19 -17
  11. data/lib/sirius/win32/classes/controls/Button.rb +4 -1
  12. data/lib/sirius/win32/classes/controls/CheckBox.rb +4 -1
  13. data/lib/sirius/win32/core.rb +19 -5
  14. data/lib/sirius/win32/core/button/ButtonService.rb +73 -35
  15. data/lib/sirius/win32/core/button/ButtonServiceClient.rb +1 -1
  16. data/lib/sirius/win32/core/button/ButtonServiceDriver.rb +12 -11
  17. data/lib/sirius/win32/core/button/ButtonServiceMappingRegistry.rb +1 -1
  18. data/lib/sirius/win32/core/combobox/ComboBoxService.rb +553 -249
  19. data/lib/sirius/win32/core/combobox/ComboBoxServiceClient.rb +1 -1
  20. data/lib/sirius/win32/core/combobox/ComboBoxServiceDriver.rb +46 -45
  21. data/lib/sirius/win32/core/combobox/ComboBoxServiceMappingRegistry.rb +1 -1
  22. data/lib/sirius/win32/core/dialog/DialogService.rb +182 -89
  23. data/lib/sirius/win32/core/dialog/DialogServiceClient.rb +1 -1
  24. data/lib/sirius/win32/core/dialog/DialogServiceDriver.rb +20 -19
  25. data/lib/sirius/win32/core/dialog/DialogServiceMappingRegistry.rb +1 -1
  26. data/lib/sirius/win32/core/edit/EditService.rb +357 -180
  27. data/lib/sirius/win32/core/edit/EditServiceClient.rb +1 -1
  28. data/lib/sirius/win32/core/edit/EditServiceDriver.rb +38 -37
  29. data/lib/sirius/win32/core/edit/EditServiceMappingRegistry.rb +1 -1
  30. data/lib/sirius/win32/core/listbox/ListBoxService.rb +373 -186
  31. data/lib/sirius/win32/core/listbox/ListBoxServiceClient.rb +1 -1
  32. data/lib/sirius/win32/core/listbox/ListBoxServiceDriver.rb +38 -37
  33. data/lib/sirius/win32/core/listbox/ListBoxServiceMappingRegistry.rb +1 -1
  34. data/lib/sirius/win32/core/menu/MenuService.rb +425 -209
  35. data/lib/sirius/win32/core/menu/MenuServiceClient.rb +1 -1
  36. data/lib/sirius/win32/core/menu/MenuServiceDriver.rb +26 -25
  37. data/lib/sirius/win32/core/menu/MenuServiceMappingRegistry.rb +1 -1
  38. data/lib/sirius/win32/core/tabcontrol/TabControlService.rb +285 -139
  39. data/lib/sirius/win32/core/tabcontrol/TabControlServiceClient.rb +1 -1
  40. data/lib/sirius/win32/core/tabcontrol/TabControlServiceDriver.rb +22 -21
  41. data/lib/sirius/win32/core/tabcontrol/TabControlServiceMappingRegistry.rb +1 -1
  42. data/lib/sirius/win32/core/utils/Win32UtilsService.rb +49 -22
  43. data/lib/sirius/win32/core/utils/Win32UtilsServiceClient.rb +1 -1
  44. data/lib/sirius/win32/core/utils/Win32UtilsServiceDriver.rb +8 -7
  45. data/lib/sirius/win32/core/utils/Win32UtilsServiceMappingRegistry.rb +1 -1
  46. data/lib/sirius/win32/core/window/WindowService.rb +643 -313
  47. data/lib/sirius/win32/core/window/WindowServiceClient.rb +1 -1
  48. data/lib/sirius/win32/core/window/WindowServiceDriver.rb +62 -61
  49. data/lib/sirius/win32/core/window/WindowServiceMappingRegistry.rb +1 -1
  50. metadata +2 -2
data/Rakefile CHANGED
@@ -2,6 +2,8 @@ require 'rubygems'
2
2
  require 'rubygems/package_task'
3
3
  require 'cucumber'
4
4
  require 'cucumber/rake/task'
5
+ require 'rake/testtask'
6
+ require 'fileutils'
5
7
 
6
8
  spec = Gem::Specification.new do |s|
7
9
  s.platform = Gem::Platform::RUBY
@@ -16,9 +18,37 @@ spec = Gem::Specification.new do |s|
16
18
  s.email="kolesnik.nickolay@gmail.com"
17
19
  end
18
20
 
21
+ task :clean do |t|
22
+ FileUtils.rm_r 'pkg', :force => true
23
+ end
24
+
25
+ task :rubocop do |t|
26
+ includes = Dir['lib/**/*']
27
+ excludes = Dir['lib/sirius/win32/core/**/*']
28
+
29
+ file_list = (includes - excludes ).reject {|fn| File.directory?(fn)}
30
+
31
+ file_list.each do |path|
32
+ sh "call rubocop -c .rubocop.yml -e #{path}"
33
+ end
34
+ end
35
+
36
+ Rake::TestTask.new(:install_test) do |task|
37
+ task.name = 'install_test'
38
+ task.libs << "test"
39
+ task.test_files = FileList['tests/install/**/*.rb']
40
+ task.verbose = true
41
+ end
42
+
19
43
  Gem::PackageTask.new(spec) do |pkg|
20
44
  end
21
45
 
22
46
  Cucumber::Rake::Task.new(:test) do |t|
23
47
  t.cucumber_opts = "tests/features --format pretty --guess"
24
- end
48
+ end
49
+
50
+ task :push => [:package] do |t|
51
+ sh "call gem push -V pkg/#{spec.name}-#{spec.version}.gem"
52
+ end
53
+
54
+ task :all => [:clean,:rubocop,:package,:install_test]
@@ -1,12 +1,15 @@
1
+ require 'sirius/win32/core.rb'
2
+
1
3
  module Sirius
2
4
  module Client
3
5
  module Win32
4
6
  class Win32
5
7
  attr_accessor :core
6
8
  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")
9
+ def initialize(host = 'localhost', port = '21212')
10
+ @core = Core::Core.new(host, port)
11
+ @utils = Core::Utils::Win32Utils.new(
12
+ "http://#{host}:#{port}/win32/utils")
10
13
  end
11
14
  end
12
15
  end
@@ -2,7 +2,13 @@ module Sirius
2
2
  module Client
3
3
  module Win32
4
4
  module Classes
5
- class Control
5
+ class Control < Window
6
+ def initialize(locator, parent = nil)
7
+ @locator = locator
8
+ @parent = parent
9
+
10
+ @client = @parent.client if parent != nil
11
+ end
6
12
  end
7
13
  end
8
14
  end
@@ -2,8 +2,33 @@ module Sirius
2
2
  module Client
3
3
  module Win32
4
4
  module Classes
5
- class DialogBox
6
- end
5
+ class DialogBox < TopLevelWindow
6
+ def initialize(locator, client = nil, parent = nil)
7
+ super(client, parent, locator);
8
+ end
9
+
10
+ def exists?
11
+ return super.exists? if @parent == nil
12
+
13
+ return false unless @parent.exists?
14
+
15
+ hwnd = @client.utils.searchSameThreadWindow(
16
+ @parent.hwnd,
17
+ @locator)
18
+
19
+ if hwnd == 0
20
+ return false
21
+ else
22
+ @locator.hwnd = hwnd
23
+ end
24
+ return true
25
+ end
26
+
27
+ #
28
+ def exists?(timeout)
29
+ return waitFor(timeout, 'exists', true)
30
+ end
31
+ end
7
32
  end
8
33
  end
9
34
  end
@@ -3,12 +3,16 @@ module Sirius
3
3
  module Win32
4
4
  module Classes
5
5
  class MainWindow < TopLevelWindow
6
- def initialize(client=nil, locator=nil)
6
+ def initialize(client = nil, locator = nil)
7
7
  super(client, nil, locator)
8
8
  end
9
9
 
10
10
  def start(executable, params, workingDir)
11
- @client.core.window.start(@locator.hwnd, executable, params, workingDir)
11
+ @client.core.window.start(
12
+ @locator.hwnd,
13
+ executable,
14
+ params,
15
+ workingDir)
12
16
  end
13
17
  end
14
18
  end
@@ -4,19 +4,19 @@ module Sirius
4
4
  module Classes
5
5
  class Menu
6
6
 
7
- MF_BYCOMMAND = 0x00000000
8
- MF_BYPOSITION = 0x00000400
7
+ MF_BYCOMMAND = _0x00000000
8
+ MF_BYPOSITION = _0x00000400
9
9
 
10
10
  attr_accessor client
11
11
  attr_accessor owner
12
12
  attr_accessor hmenu
13
- def initialize(client, owner=nil, hmenu=nil)
13
+ def initialize(client, owner = nil, hmenu = nil)
14
14
  @client = client
15
15
  @owner = owner
16
16
  if hmenu == nil
17
- @hmenu = hmenu;
17
+ @hmenu = hmenu
18
18
  else
19
- @hmenu = @client.core.window.getMenu( @owner.hwnd )
19
+ @hmenu = @client.core.window.getMenu @owner.hwnd
20
20
  end
21
21
  end
22
22
 
@@ -27,10 +27,15 @@ module Sirius
27
27
  end
28
28
 
29
29
  def get_menu_item_text(position)
30
- maxLength = 255;
30
+ max_length = 255;
31
31
 
32
- buffer = " " * maxLength
33
- @client.core.menu.getMenuString(@hmenu, position, buffer, maxLength,MF_BYPOSITION)
32
+ buffer = ' ' * maxLength
33
+ @client.core.menu.getMenuString(
34
+ @hmenu,
35
+ position,
36
+ buffer,
37
+ max_length,
38
+ MF_BYPOSITION)
34
39
  buffer
35
40
  end
36
41
 
@@ -50,7 +55,8 @@ module Sirius
50
55
  # for (int i = 0; i < count; i++) {
51
56
  # UnsignedShort[] buf = new UnsignedShort[255];
52
57
  # client.core().menu()
53
- # .getMenuString(hmenu, i, buf, 255, (int) MF_BYPOSITION);
58
+ # .getMenuString(hmenu, i, buf, 255,
59
+ # (int) MF_BYPOSITION);
54
60
  # byte[] text = new byte[buf.length];
55
61
  #
56
62
  # for (int j = 0; j < buf.length; j++) {
@@ -64,14 +70,18 @@ module Sirius
64
70
 
65
71
  def menu(title)
66
72
  names = get_item_names
67
- item = names.index { |name| ( name.match(title) || name.index(title)!=nil ) }
73
+ item = names.index do |name|
74
+ (name.match(title) || name.index(title) != nil)
75
+ end
68
76
  sub_hmenu = @client.core.menu.getSubMenu(hmenu, item)
69
77
  Menu.new(@client, @owner, sub_hmenu)
70
78
  end
71
79
 
72
80
  def item(title)
73
81
  names = get_item_names
74
- item = names.index{|name| (name.match(title) || name.index(title)!=nil ) }
82
+ item = names.index do |name|
83
+ (name.match(title) || name.index(title) != nil)
84
+ end
75
85
  MenuItem.new(@client, @owner, @hmenu, item)
76
86
  end
77
87
  end
@@ -16,22 +16,21 @@ module Sirius
16
16
  @pos = pos
17
17
  end
18
18
 
19
- def checked?()
19
+ def checked?
20
20
  false
21
21
  end
22
22
 
23
- def enabled?()
23
+ def enabled?
24
24
  false
25
25
  end
26
26
 
27
- def separator?()
27
+ def separator?
28
28
  false
29
29
  end
30
30
 
31
- def pick()
31
+ def pick
32
32
  @client.core.menu.pickItem(@owner.hwnd, @hmenu, @pos)
33
33
  end
34
-
35
34
  end
36
35
  end
37
36
  end
@@ -3,15 +3,15 @@ module Sirius
3
3
  module Win32
4
4
  module Classes
5
5
  class MovableWindow < Window
6
- def initialize(client=nil, locator=nil,parent=nil)
6
+ def initialize(client = nil, locator = nil, parent = nil)
7
7
  super(client, parent, locator)
8
8
  end
9
9
 
10
- def moveTo(x, y)
10
+ def move_to(x, y)
11
11
  @client.core.window.moveTo(@locator.hwnd, x, y);
12
12
  end
13
13
 
14
- def sizeTo(width, height)
14
+ def size_to(width, height)
15
15
  @client.core.window.sizeTo(@locator.hwnd, width, height);
16
16
  end
17
17
 
@@ -3,7 +3,7 @@ module Sirius
3
3
  module Win32
4
4
  module Classes
5
5
  class TopLevelWindow < MovableWindow
6
- def initialize(client=nil, locator=nil,parent=nil)
6
+ def initialize(client = nil, locator = nil, parent = nil)
7
7
  super(client, parent, locator)
8
8
  end
9
9
 
@@ -13,13 +13,14 @@ module Sirius
13
13
 
14
14
  def menu
15
15
  if exists?
16
- return Menu.new(client,self)
16
+ Menu.new(client, self)
17
+ else
18
+ nil
17
19
  end
18
- return nil
19
20
  end
20
21
 
21
22
  def system_menu
22
- if (exists?)
23
+ if exists?
23
24
  @hmenu = @client.core.window.getSystemMenu(@locator.hwnd, true);
24
25
  return Menu.new(client, self, @hmenu)
25
26
  end
@@ -6,33 +6,37 @@ module Sirius
6
6
  attr_accessor :client
7
7
  attr_accessor :locator
8
8
  attr_accessor :parent
9
-
10
- def initialize(locator,client=nil,parent=nil)
9
+
10
+ def initialize(locator, client = nil, parent = nil)
11
11
  @locator = locator
12
12
  @client = client
13
- @parent=parent
13
+ @parent = parent
14
14
 
15
- if(parent != nil)
16
- @client = @parent.client
17
- end
15
+ @client = @parent.client if parent != nil
18
16
  end
19
17
 
20
18
  def click
21
19
  return unless exists?
22
- @client.core.window.click(@locator.hwnd, 0, 0, 0, false, false, false);
20
+ @client.core.window.click(
21
+ @locator.hwnd,
22
+ 0,
23
+ 0,
24
+ 0,
25
+ false,
26
+ false,
27
+ false)
23
28
  end
24
29
 
25
30
  def type_keys(text)
26
31
  return unless exists?
27
- text.split('//').each { |key|
28
- @client.core.window.keyPress(@locator.hwnd, key);
29
- }
32
+ text.split('//').each do |key|
33
+ @client.core.window.keyPress(@locator.hwnd, key)
34
+ end
30
35
  end
31
36
 
32
37
  def exists?
33
- if (@parent != nil)
34
-
35
- if (!@parent.exists?)
38
+ if @parent != nil
39
+ if !@parent.exists?
36
40
  return false;
37
41
  else
38
42
  @locator.parent = @parent.hwnd
@@ -40,9 +44,7 @@ module Sirius
40
44
  end
41
45
 
42
46
  @locator.hwnd = 0
43
- if(@parent != nil)
44
- @client = @parent.client
45
- end
47
+ @client = @parent.client if @parent != nil
46
48
 
47
49
  @locator.hwnd = @client.utils.searchWindow(@locator)
48
50
 
@@ -52,7 +54,7 @@ module Sirius
52
54
  @locator.hwnd = 0
53
55
  end
54
56
 
55
- return false;
57
+ return false
56
58
  end
57
59
 
58
60
  =begin
@@ -3,7 +3,10 @@ module Sirius
3
3
  module Win32
4
4
  module Classes
5
5
  module Controls
6
- class Button
6
+ class Button < Control
7
+ def initialize(locator, parent = nil)
8
+ super(locator, parent)
9
+ end
7
10
  end
8
11
  end
9
12
  end
@@ -3,7 +3,10 @@ module Sirius
3
3
  module Win32
4
4
  module Classes
5
5
  module Controls
6
- class CheckBox
6
+ class CheckBox < Button
7
+ def initialize(locator, parent = nil)
8
+ super(locator, parent)
9
+ end
7
10
  end
8
11
  end
9
12
  end
@@ -1,23 +1,37 @@
1
+ require 'sirius/win32/core/button/ButtonServiceDriver.rb'
2
+ require 'sirius/win32/core/combobox/ComboBoxServiceDriver.rb'
3
+ require 'sirius/win32/core/dialog/DialogServiceDriver.rb'
4
+ require 'sirius/win32/core/edit/EditServiceDriver.rb'
5
+ require 'sirius/win32/core/listbox/ListBoxServiceDriver.rb'
6
+ require 'sirius/win32/core/menu/MenuServiceDriver.rb'
7
+ require 'sirius/win32/core/tabcontrol/TabControlServiceDriver.rb'
8
+ require 'sirius/win32/core/utils/Win32UtilsServiceDriver.rb'
9
+ require 'sirius/win32/core/window/WindowServiceDriver.rb'
10
+
1
11
  module Sirius
2
12
  module Client
3
13
  module Win32
4
14
  module Core
5
15
  class Core
6
- attr_accessor :button
16
+ attr_accessor :button
7
17
  attr_accessor :dialog
8
18
  attr_accessor :edit
9
19
  attr_accessor :listbox
10
20
  attr_accessor :menu
11
21
  attr_accessor :tabcontrol
12
22
  attr_accessor :window
13
-
14
- def initialize(host = "localhost",port="21212")
23
+
24
+ def initialize(host = 'localhost', port = '21212')
15
25
  @button = Button::Button.new("http://#{host}:#{port}/win32/button")
16
26
  @dialog = Dialog::Dialog.new("http://#{host}:#{port}/win32/dialog")
17
27
  @edit = Edit::Edit.new("http://#{host}:#{port}/win32/edit")
18
- @listbox = Listbox::ListBox.new("http://#{host}:#{port}/win32/listbox")
28
+ @listbox =
29
+ Listbox::ListBox.new(
30
+ "http://#{host}:#{port}/win32/listbox")
19
31
  @menu = Menu::Menu.new("http://#{host}:#{port}/win32/menu")
20
- @tabcontrol = Tabcontrol::TabControl.new("http://#{host}:#{port}/win32/tabcontrol")
32
+ @tabcontrol =
33
+ Tabcontrol::TabControl.new(
34
+ "http://#{host}:#{port}/win32/tabcontrol")
21
35
  @window = Window::Window.new("http://#{host}:#{port}/win32/window")
22
36
  end
23
37
  end
@@ -3,69 +3,107 @@ require 'xsd/qname'
3
3
  module Sirius; module Client; module Win32; module Core; module Button
4
4
 
5
5
  # {http:controls.classes.win32.server.sirius.org/}GetState
6
- # arg0 - SOAP::SOAPLong
7
6
  class GetState
7
+ # arg0 - SOAP::SOAPLong
8
+ class GetState
9
+
8
10
  attr_accessor :arg0
9
- def initialize(arg0 = nil) @arg0 = arg0
10
- end
11
+ def initialize(arg0 = nil) @arg0 = arg0
12
+
13
+ end
14
+
11
15
  end
12
16
  # {http:controls.classes.win32.server.sirius.org/}GetStateResponse
13
- # m_return - SOAP::SOAPInt
14
- class GetStateResponse
15
17
  def m_return
16
- @v_return
18
+ # m_return - SOAP::SOAPInt
19
+
20
+ class GetStateResponse
21
+ def m_return
22
+ @v_return
23
+
24
+ end
25
+
26
+ def m_return=(value) @v_return = value
27
+
17
28
  end
18
29
 
19
- def m_return=(value) @v_return = value
30
+ def initialize(v_return = nil) @v_return = v_return
31
+
20
32
  end
21
33
 
22
- def initialize(v_return = nil) @v_return = v_return
23
- end
24
34
  end
25
35
  # {http:controls.classes.win32.server.sirius.org/}SetCheck
26
36
  # arg0 - SOAP::SOAPLong
27
- # arg1 - SOAP::SOAPInt
28
- class SetCheck
29
- attr_accessor :arg0
37
+ # arg1 - SOAP::SOAPInt
38
+
39
+ class SetCheck
40
+
41
+ attr_accessor :arg0
42
+
30
43
  attr_accessor :arg1
31
44
  def initialize(arg0 = nil, arg1 = nil) @arg0 = arg0
32
- @arg1 = arg1
33
- end
45
+ @arg1 = arg1
46
+
47
+ end
48
+
34
49
  end
35
- # {http:controls.classes.win32.server.sirius.org/}SetCheckResponse
36
- class SetCheckResponse
37
50
  def initialize
38
- end
51
+ # {http:controls.classes.win32.server.sirius.org/}SetCheckResponse
52
+
53
+ class SetCheckResponse
54
+ def initialize
55
+
56
+ end
57
+
39
58
  end
40
59
  # {http:controls.classes.win32.server.sirius.org/}SetState
41
60
  # arg0 - SOAP::SOAPLong
42
- # arg1 - SOAP::SOAPInt
43
- class SetState
44
- attr_accessor :arg0
61
+ # arg1 - SOAP::SOAPInt
62
+
63
+ class SetState
64
+
65
+ attr_accessor :arg0
66
+
45
67
  attr_accessor :arg1
46
68
  def initialize(arg0 = nil, arg1 = nil) @arg0 = arg0
47
- @arg1 = arg1
48
- end
69
+ @arg1 = arg1
70
+
71
+ end
72
+
49
73
  end
50
- # {http:controls.classes.win32.server.sirius.org/}SetStateResponse
51
- class SetStateResponse
52
74
  def initialize
53
- end
75
+ # {http:controls.classes.win32.server.sirius.org/}SetStateResponse
76
+
77
+ class SetStateResponse
78
+ def initialize
79
+
80
+ end
81
+
54
82
  end
55
83
  # {http:controls.classes.win32.server.sirius.org/}GetCheck
56
- # arg0 - SOAP::SOAPLong
57
- class GetCheck
84
+ # arg0 - SOAP::SOAPLong
85
+
86
+ class GetCheck
87
+
58
88
  attr_accessor :arg0
59
- def initialize(arg0 = nil) @arg0 = arg0
60
- end
89
+ def initialize(arg0 = nil) @arg0 = arg0
90
+
91
+ end
92
+
61
93
  end
62
94
  # {http:controls.classes.win32.server.sirius.org/}GetCheckResponse
63
- # m_return - SOAP::SOAPInt
64
- class GetCheckResponse
65
95
  def m_return
66
- @v_return
96
+ # m_return - SOAP::SOAPInt
97
+
98
+ class GetCheckResponse
99
+ def m_return
100
+ @v_return
101
+
67
102
  end
68
103
 
69
- def m_return=(value) @v_return = value
104
+ def m_return=(value) @v_return = value
105
+
106
+ end
107
+
108
+ def initialize(v_return = nil) @v_return = v_return
109
+
70
110
  end
71
111
 
72
- def initialize(v_return = nil) @v_return = v_return
73
- end
74
112
  end
75
113
 
76
114
  end; end; end; end; end