ruby-proxy 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,6 +16,14 @@ module ATU
16
16
  #~ path += '.rb'
17
17
  RubyProxy::DRbClient.proxy_load(arg)
18
18
  end
19
+
20
+ def [](arg)
21
+ RubyProxy::DRbClient.proxy_global_get(arg)
22
+ end
23
+
24
+ def []=(arg,var)
25
+ RubyProxy::DRbClient.proxy_global_set(arg,var)
26
+ end
19
27
  end
20
28
 
21
29
  #entry
@@ -167,10 +175,18 @@ module RubyProxy
167
175
 
168
176
  attr_accessor :ip,:port
169
177
 
170
- def proxy_load(dir_or_file)
171
- client.proxy_load(dir_or_file)
178
+ def proxy_load(file)
179
+ client.proxy_load(file)
172
180
  end
173
181
 
182
+ def proxy_global_get(arg)
183
+ client.proxy_global_get(arg)
184
+ end
185
+
186
+ def proxy_global_set(arg,var)
187
+ client.proxy_global_set(arg,var)
188
+ end
189
+
174
190
  # not use it later
175
191
  def start_service(t=10)
176
192
  message = nil
@@ -179,7 +195,7 @@ module RubyProxy
179
195
  @@logger.info start_command
180
196
  #~ @server_thread = Thread.new do |t|
181
197
  #~ t.abort_on_exception = true
182
- @service_log = IO.popen(start_command)
198
+ @service_log = IO.popen(start_command)
183
199
  #~ end
184
200
  #~ @server_thread.abort_on_exception = true
185
201
  wait_until_server_start_time(t)
@@ -209,7 +225,7 @@ module RubyProxy
209
225
  #~ raise CannotStartServer, "" unless @server_thread.alive?
210
226
  TCPSocket.new(Config.ip,Config.port)
211
227
  @@logger.info "server is starting"
212
- do_at_exit
228
+ #do_at_exit
213
229
  return true
214
230
  rescue Exception
215
231
  sleep 1
@@ -6,4 +6,6 @@ module RubyProxy
6
6
  class CommandNotFoundError < Error; end
7
7
  # start server fail error
8
8
  class CannotStartServer < Error; end
9
- end
9
+ # format wrong with global variable
10
+ class GlobalVarFormatError < Error; end
11
+ end
@@ -0,0 +1,35 @@
1
+ require 'logger'
2
+
3
+ module RubyProxy
4
+ class Logger
5
+ @@logger = ::Logger.new(STDOUT)
6
+ @@logger.level = ::Logger::INFO
7
+
8
+ def self.level=(level)
9
+ @@logger.level = level
10
+ end
11
+
12
+ def self.level
13
+ @@logger.level
14
+ end
15
+
16
+ def self.log(arg)
17
+ @@logger.info arg
18
+ end
19
+
20
+ def self.info(arg)
21
+ @@logger.info arg
22
+ end
23
+
24
+ def self.debug(arg)
25
+ @@logger.debug arg
26
+ end
27
+
28
+ def self.warn(arg)
29
+ @@logger.warn arg
30
+ end
31
+ def self.error(arg)
32
+ @@logger.error arh
33
+ end
34
+ end
35
+ end
@@ -1,19 +1,15 @@
1
- require 'logger'
1
+ require 'ruby_proxy/logger'
2
2
  require 'drb'
3
3
  require 'ruby_proxy/proxy_load'
4
+ require 'ruby_proxy/proxy_global_set'
4
5
 
5
6
  module RubyProxy
6
7
  class Proxy
7
- # loading proxy class, default folder: atu
8
- # you can use Proxy.load_path << "" to add load path
9
- #~ ProxyLoad.load
10
- @@logger = Logger.new(STDOUT)
11
- @@logger.level = Logger::INFO
12
-
8
+
13
9
  def self.proxy(klass_name,method=nil,*arg)
14
- @@logger.debug "klass_name= #{klass_name}"
15
- @@logger.debug "method = #{method}"
16
- @@logger.debug "arg = #{arg.join(',')}"
10
+ Logger.debug "klass_name= #{klass_name}"
11
+ Logger.debug "method = #{method}"
12
+ Logger.debug "arg = #{arg.join(',')}"
17
13
  if method.nil?
18
14
  return proxy_module(klass_name)
19
15
  else
@@ -22,12 +18,18 @@ module RubyProxy
22
18
  end
23
19
 
24
20
  def self.proxy_load(file_or_gem)
25
- #~ ProxyLoad.load_path << dir_or_file
26
21
  ProxyLoad.load_file(file_or_gem)
27
22
  end
23
+
24
+ def self.proxy_global_set(arg,var)
25
+ ProxyGlobalSet.set(arg,var)
26
+ end
27
+
28
+ def self.proxy_global_get(arg)
29
+ ProxyGlobalSet.get(arg)
30
+ end
28
31
 
29
32
  def self.proxy_type(klass_name)
30
- #@@logger.debug "proxy_type: #{proxy_const_get(klass_name).name} type is #{proxy_const_get(klass_name).class.to_s}"
31
33
  return proxy_const_get(klass_name).class.to_s
32
34
  end
33
35
 
@@ -38,7 +40,6 @@ module RubyProxy
38
40
  end
39
41
 
40
42
  def self.proxy_const_get(klass_name)
41
- #@@logger.debug "const_get klass_name = #{klass_name}"
42
43
  atu = nil
43
44
  klass_name_array = klass_name.split('::')
44
45
  klass_name_array.shift if klass_name_array[0] == "ATU"
@@ -0,0 +1,37 @@
1
+ require 'ruby_proxy/logger'
2
+ require 'ruby_proxy/exceptions'
3
+ module RubyProxy
4
+ class ProxyGlobalSet
5
+ MAGIC_GLOBAL = [ "$:", "$!", "$@", "$_", "$.", "$&", "$~", "$n", "$=", "$/", "$0", "$*", "$$", "$?" ]
6
+ class <<self
7
+ def set(arg,value)
8
+ arg = convert_to_global(arg)
9
+ Logger.info "global set: #{arg} = #{value}"
10
+ eval("#{arg} = #{value}")
11
+ end
12
+
13
+ def get(arg)
14
+ arg = convert_to_global(arg)
15
+ Logger.info "global get: #{arg}"
16
+ eval(arg)
17
+ end
18
+
19
+ private
20
+ def convert_to_global(arg)
21
+ check_format(arg)
22
+ add_dollar_if_noexist(arg)
23
+ end
24
+
25
+ def check_format(arg)
26
+ if !MAGIC_GLOBAL.include?(arg) and ! arg.match(/^\$?[a-zA-Z_]{1}[a-zA-Z_0-9]*$/)
27
+ raise GlobalVarFormatError,"global variable format wrong: #{arg}"
28
+ end
29
+ end
30
+
31
+ def add_dollar_if_noexist(arg)
32
+ arg = "$" + arg unless arg.match(/^\$/)
33
+ arg
34
+ end
35
+ end
36
+ end
37
+ end
@@ -1,9 +1,6 @@
1
1
  require 'logger'
2
2
  module RubyProxy
3
3
  class ProxyLoad
4
- @@logger = Logger.new(STDOUT)
5
- @@logger.level = Logger::ERROR
6
- #~ @@logger.info $:.join(':')
7
4
  @load_path = []
8
5
  class <<self
9
6
  attr_accessor :load_path
@@ -20,10 +17,10 @@ module RubyProxy
20
17
  end
21
18
 
22
19
  def load_file(file)
23
- @@logger.debug "require file : #{file}"
20
+ Logger.debug "require file : #{file}"
24
21
  require file
25
22
  rescue LoadError=>e
26
- @@logger.warn "require file : #{file} fail,exception:\n#{e}"
23
+ Logger.warn "require file : #{file} fail,exception:\n#{e}"
27
24
  raise
28
25
  end
29
26
  end
@@ -1,3 +1,3 @@
1
1
  module RubyProxy
2
- VERSION = "0.2.0"
3
- end
2
+ VERSION = "0.2.1"
3
+ end
@@ -0,0 +1,15 @@
1
+ require 'setup'
2
+
3
+ RubyProxy::Config.command = "/home/windy/.rvm/rubies/jruby-1.6.7/bin/ruby"
4
+
5
+ class TestAtuLoad < Test::Unit::TestCase
6
+ def test_load_ok
7
+ assert_nothing_raised {
8
+ ATU.require 'support/atu/hello.rb'
9
+ }
10
+ end
11
+
12
+ def test_load_noexist
13
+ assert_raise(LoadError) { ATU.require 'noexist' }
14
+ end
15
+ end
@@ -9,7 +9,6 @@ class TestConfig < Test::Unit::TestCase
9
9
  def test_config_default
10
10
  assert_equal(8000, @config.port)
11
11
  assert_equal('127.0.0.1', @config.ip)
12
- assert_equal('ruby', @config.command)
13
12
  end
14
13
 
15
14
  def test_config_personal
@@ -17,8 +16,10 @@ class TestConfig < Test::Unit::TestCase
17
16
  assert_equal(1111, @config.port)
18
17
  @config.ip = '1.1.1.1'
19
18
  assert_equal('1.1.1.1', @config.ip)
19
+ old_command = @config.command
20
20
  @config.command = 'ruby'
21
21
  assert_equal('ruby', @config.command)
22
+ @config.command = old_command
22
23
  end
23
24
 
24
25
  end
@@ -80,11 +80,6 @@ class TestDrbProxy < Test::Unit::TestCase
80
80
  end
81
81
  end
82
82
 
83
- #~ def test_atu_sikuli
84
- #~ screen = ATU::Sikuli::Region.new(0,0,1440,900)
85
- #~ assert_not_nil(screen)
86
- #~ end
87
-
88
83
  def test_multi_modules
89
84
  a = ATU::M1::Hello4.new
90
85
  assert_equal("one",a.one("test"))
@@ -106,10 +101,10 @@ class TestDrbProxy < Test::Unit::TestCase
106
101
  # failed, fix me
107
102
  # I have not seen druby's block call. That not be supported to call block.
108
103
  # I will do fixing it later.
109
- def test_block_ok
110
- a = ATU::M1::Hello6.new
111
- assert_equal(1,a.b() {|i| i})
112
- end
104
+ #def test_block_ok
105
+ # a = ATU::M1::Hello6.new
106
+ # assert_equal(1,a.b() {|i| i})
107
+ #end
113
108
 
114
109
  def test_file_path
115
110
  assert_equal([__FILE__],ATU::M1::Hello6.a(__FILE__))
@@ -128,4 +123,4 @@ class TestDrbProxy < Test::Unit::TestCase
128
123
  assert_equal("normal",hello7.normal)
129
124
  end
130
125
 
131
- end
126
+ end
@@ -0,0 +1,20 @@
1
+ require 'setup'
2
+
3
+ class TestGlobalVar < Test::Unit::TestCase
4
+ def test_global_get_ok
5
+ assert_equal(ATU["$LOAD_PATH"], ATU["LOAD_PATH"])
6
+ end
7
+
8
+ def test_global_get_noexist
9
+ assert_equal(nil, ATU["NO"])
10
+ end
11
+
12
+ def test_global_get_format_error
13
+ assert_raise(RubyProxy::GlobalVarFormatError) { ATU["12345"] }
14
+ end
15
+
16
+ def test_global_set_ok
17
+ ATU["HELLO"] = 10
18
+ assert_equal(10, ATU["HELLO"])
19
+ end
20
+ end
metadata CHANGED
@@ -1,77 +1,95 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: ruby-proxy
3
- version: !ruby/object:Gem::Version
4
- version: 0.2.0
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 2
9
+ - 1
10
+ version: 0.2.1
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - yafei Lee
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
- date: 2012-04-19 00:00:00.000000000 Z
17
+
18
+ date: 2012-04-21 00:00:00 Z
13
19
  dependencies: []
20
+
14
21
  description: Ruby Proxy for two or more ruby processes.
15
22
  email: lyfi2003@gmail.com
16
23
  executables: []
24
+
17
25
  extensions: []
26
+
18
27
  extra_rdoc_files: []
19
- files:
28
+
29
+ files:
20
30
  - lib/ruby_proxy/config.rb
21
31
  - lib/ruby_proxy/client.rb
22
32
  - lib/ruby_proxy/exceptions.rb
23
33
  - lib/ruby_proxy/proxy_load.rb
34
+ - lib/ruby_proxy/proxy_global_set.rb
24
35
  - lib/ruby_proxy/server.rb
25
36
  - lib/ruby_proxy/version.rb
26
37
  - lib/ruby_proxy/proxy.rb
38
+ - lib/ruby_proxy/logger.rb
27
39
  - lib/ruby_proxy.rb
28
- - lib/atu/sikuli.rb
29
- - lib/atu/sikuli-script.jar
30
- - lib/atu/key.rb
31
40
  - lib/test.rb
32
41
  - lib/ext/drb_ext.rb
33
42
  - unittests/test_drb_proxy.rb
34
- - unittests/your_jruby_sikuli_config_ok.rb
35
43
  - unittests/test_config.rb
44
+ - unittests/test_gloabal_var.rb
36
45
  - unittests/all_tests.rb
37
46
  - unittests/support/config.yml
38
47
  - unittests/support/image/search.png
39
48
  - unittests/support/image/start.png
40
49
  - unittests/support/atu/hello.rb
41
- - unittests/test_sikuli_api.rb
50
+ - unittests/test_atu_require.rb
42
51
  - unittests/setup.rb
43
52
  homepage: https://github.com/windy/ruby_proxy
44
53
  licenses: []
54
+
45
55
  post_install_message:
46
56
  rdoc_options: []
47
- require_paths:
57
+
58
+ require_paths:
48
59
  - lib
49
- required_ruby_version: !ruby/object:Gem::Requirement
60
+ required_ruby_version: !ruby/object:Gem::Requirement
50
61
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- required_rubygems_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
70
  none: false
57
- requirements:
58
- - - ! '>='
59
- - !ruby/object:Gem::Version
60
- version: '0'
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ hash: 3
75
+ segments:
76
+ - 0
77
+ version: "0"
61
78
  requirements: []
79
+
62
80
  rubyforge_project:
63
- rubygems_version: 1.8.22
81
+ rubygems_version: 1.8.10
64
82
  signing_key:
65
83
  specification_version: 3
66
84
  summary: Ruby Proxy for two or more ruby processes.
67
- test_files:
85
+ test_files:
68
86
  - unittests/test_drb_proxy.rb
69
- - unittests/your_jruby_sikuli_config_ok.rb
70
87
  - unittests/test_config.rb
88
+ - unittests/test_gloabal_var.rb
71
89
  - unittests/all_tests.rb
72
90
  - unittests/support/config.yml
73
91
  - unittests/support/image/search.png
74
92
  - unittests/support/image/start.png
75
93
  - unittests/support/atu/hello.rb
76
- - unittests/test_sikuli_api.rb
94
+ - unittests/test_atu_require.rb
77
95
  - unittests/setup.rb
@@ -1,218 +0,0 @@
1
- require 'java'
2
- require 'iconv'
3
- #require 'drb'
4
- java_import 'java.awt.event.InputEvent'
5
- class String
6
- def to_unicode
7
- begin
8
- Iconv.iconv("UNICODEBIG//", "utf-8", self)[0]
9
- rescue Exception
10
- puts $!.class
11
- puts $!.message
12
- self
13
- end
14
- end
15
- end
16
-
17
- module ATU
18
- ##
19
- # The Shift key modifier constant.
20
- # This equals to java.awt.event.InputEvent.SHIFT_MASK.
21
- KEY_SHIFT = InputEvent::SHIFT_MASK
22
- ##
23
- # The Ctrl key modifier constant.
24
- # This equals to java.awt.event.InputEvent.CTRL_MASK.
25
- KEY_CTRL = InputEvent::CTRL_MASK
26
- ##
27
- # The Meta/Windows/Apple key modifier constant.
28
- # This equals to java.awt.event.InputEvent.META_MASK.
29
- KEY_META = InputEvent::META_MASK
30
- ##
31
- # The Apple(Command) key modifier constant.
32
- # This equals to java.awt.event.InputEvent.META_MASK.
33
- KEY_CMD = InputEvent::META_MASK
34
- ##
35
- # The Windows key modifier constant.
36
- # This equals to java.awt.event.InputEvent.META_MASK.
37
- KEY_WIN = InputEvent::META_MASK
38
- ##
39
- # The Alt key modifier constant.
40
- # This equals to java.awt.event.InputEvent.ALT_MASK.
41
- KEY_ALT = InputEvent::ALT_MASK
42
-
43
- ##
44
- # class Key contains the constants of all special keys.
45
- class Key
46
- include DRb::DRbUndumped
47
- ##
48
- # ENTER
49
- ENTER = "\n"
50
- ##
51
- # BACKSPACE
52
- BACKSPACE = "\b"
53
- ##
54
- # TAB
55
- TAB = "\t"
56
- ##
57
- # ESC
58
- ESC = "\u001b".to_unicode
59
- ##
60
- # UP
61
- UP = "\ue000".to_unicode
62
- ##
63
- # RIGHT
64
- RIGHT = "\ue001".to_unicode
65
- ##
66
- # DOWN
67
- DOWN = "\ue002".to_unicode
68
- ##
69
- # LEFT
70
- LEFT = "\ue003".to_unicode
71
- ##
72
- # PAGE_UP
73
- PAGE_UP = "\ue004".to_unicode
74
- ##
75
- # PAGE_DOWN
76
- PAGE_DOWN = "\ue005".to_unicode
77
- ##
78
- # DELETE
79
- DELETE = "\ue006".to_unicode
80
- ##
81
- # END
82
- KEY_END = "\ue007".to_unicode
83
- ##
84
- # HOME
85
- HOME = "\ue008".to_unicode
86
- ##
87
- # INSERT
88
- INSERT = "\ue009".to_unicode
89
- ##
90
- # F1
91
- F1 = "\ue011".to_unicode
92
- ##
93
- # F2
94
- F2 = "\ue012".to_unicode
95
- ##
96
- # F3
97
- F3 = "\ue013".to_unicode
98
- ##
99
- # F4
100
- F4 = "\ue014".to_unicode
101
- ##
102
- # F5
103
- F5 = "\ue015".to_unicode
104
- ##
105
- # F6
106
- F6 = "\ue016".to_unicode
107
- ##
108
- # F7
109
- F7 = "\ue017".to_unicode
110
- ##
111
- # F8
112
- F8 = "\ue018".to_unicode
113
- ##
114
- # F9
115
- F9 = "\ue019".to_unicode
116
- ##
117
- # F10
118
- F10 = "\ue01A".to_unicode
119
- ##
120
- # F11
121
- F11 = "\ue01B".to_unicode
122
- ##
123
- # F12
124
- F12 = "\ue01C".to_unicode
125
- ##
126
- # F13
127
- F13 = "\ue01D".to_unicode
128
- ##
129
- # F14
130
- F14 = "\ue01E".to_unicode
131
- ##
132
- # F15
133
- F15 = "\ue01F".to_unicode
134
- ##
135
- # SHIFT
136
- SHIFT = "\ue020".to_unicode
137
- ##
138
- # CTRL
139
- CTRL = "\ue021".to_unicode
140
- ##
141
- # ALT
142
- ALT = "\ue022".to_unicode
143
- ##
144
- # META
145
- META = "\ue023".to_unicode
146
- ##
147
- # META
148
- CMD = "\ue023".to_unicode
149
- ##
150
- # META
151
- WIN = "\ue023".to_unicode
152
-
153
- ##
154
- # PRINTSCREEN
155
- PRINTSCREEN = "\ue024".to_unicode
156
- ##
157
- # SCROLL_LOCK
158
- SCROLL_LOCK = "\ue025".to_unicode
159
- ##
160
- # PAUSE
161
- PAUSE = "\ue026".to_unicode
162
- ##
163
- # CAPS_LOCK
164
- CAPS_LOCK = "\ue027".to_unicode
165
-
166
- ##
167
- # NUM0
168
- NUM0 = "\ue030".to_unicode
169
- ##
170
- # NUM1
171
- NUM1 = "\ue031".to_unicode
172
- ##
173
- # NUM2
174
- NUM2 = "\ue032".to_unicode
175
- ##
176
- # NUM3
177
- NUM3 = "\ue033".to_unicode
178
- ##
179
- # NUM4
180
- NUM4 = "\ue034".to_unicode
181
- ##
182
- # NUM5
183
- NUM5 = "\ue035".to_unicode
184
- ##
185
- # NUM6
186
- NUM6 = "\ue036".to_unicode
187
- ##
188
- # NUM7
189
- NUM7 = "\ue037".to_unicode
190
- ##
191
- # NUM8
192
- NUM8 = "\ue038".to_unicode
193
- ##
194
- # NUM9
195
- NUM9 = "\ue039".to_unicode
196
- ##
197
- # SEPARATOR (numpad)
198
- SEPARATOR = "\ue03A".to_unicode
199
- ##
200
- # NUM_LOCK
201
- NUM_LOCK = "\ue03B".to_unicode
202
- ##
203
- # ADD (numpad)
204
- ADD = "\ue03C".to_unicode
205
- ##
206
- # MINUS (numpad)
207
- MINUS = "\ue03D".to_unicode
208
- ##
209
- # MULTIPLY (numpad)
210
- MULTIPLY = "\ue03E".to_unicode
211
- ##
212
- # DIVIDE (numpad)
213
- DIVIDE = "\ue03F".to_unicode
214
- end
215
- end
216
-
217
- if __FILE__ == $0
218
- end
Binary file
@@ -1,40 +0,0 @@
1
- require 'rubygems'
2
- require 'java'
3
- #$CLASSPATH << "/Applications/Sikuli-IDE.app/Contents/Resources/Java/"
4
- #This is key to making it work under ruby. The path above is the default
5
- #installation location on the Mac which contains all of the
6
- #relevant sikuli jar files.
7
- require "atu/sikuli-script.jar"
8
-
9
-
10
-
11
- #~ include Java
12
- module ATU
13
- module Sikuli
14
- java_import 'org.sikuli.script.Region'
15
- java_import 'org.sikuli.script.Screen'
16
- java_import 'org.sikuli.script.Settings'
17
- java_import 'org.sikuli.script.Pattern'
18
- java_import 'org.sikuli.script.SikuliEvent'
19
- java_import 'org.sikuli.script.SikuliScript'
20
- include Java::OrgSikuliScript
21
- end
22
- class Java::OrgSikuliScript::Region
23
- alias old_paste paste
24
- def paste(*args)
25
- len = args.length
26
- if len == 1
27
- old_paste(nil,java.lang.String.new(args[0].to_java_bytes,"utf-8"))
28
- elsif len== 2
29
- old_paste(args[0],java.lang.String.new(args[1].to_java_bytes,"utf-8"))
30
- end
31
- end
32
- end
33
- #Sikuli = Java::OrgSikuliScript
34
- end
35
- if __FILE__ == $0
36
- puts ATU::Sikuli
37
- @region = ATU::Sikuli::Region.new(0, 0, 1440, 900)
38
- puts @region.class
39
- puts ATU::Sikuli::C.new.class
40
- end
@@ -1,33 +0,0 @@
1
- require 'setup'
2
-
3
- class TestSikuliApi < Test::Unit::TestCase
4
- @@image_path = nil
5
- def setup
6
- @@image_path ||= File.join(__FILE__,'..','support','image')
7
- end
8
- def test_sikuli_module
9
- screen = ATU::Sikuli::Screen.new
10
- assert_equal(0,screen.x)
11
- assert_equal(0,screen.y)
12
- assert_equal(true,screen.w > 0)
13
- assert_equal(true,screen.h > 0)
14
- end
15
-
16
- def test_screen_click
17
- #region = ATU::Sikuli::Region.new(0,0,1440,900)
18
- region = ATU::Sikuli::Screen.new
19
- assert_equal(0,region.x)
20
- assert_equal(0,region.y)
21
- assert_equal(true,File.exist?(File.join(@@image_path,"start.png")))
22
- region.click(File.expand_path(File.join(@@image_path, "start.png")),0)
23
- assert_nothing_raised do
24
- region.wait(File.expand_path(File.join(@@image_path,"search.png")),10)
25
- end
26
- #~ region.type(ATU::Key.ESC)
27
- #~ assert_nothing_raised do
28
- #~ region.waitVanish(File.expand_path(File.join(@@image_path,"search.png")),10)
29
- #~ end
30
- end
31
-
32
-
33
- end
@@ -1,26 +0,0 @@
1
- require 'setup'
2
- require 'atu/sikuli'
3
- class TestSikuliApi < Test::Unit::TestCase
4
- @@image_path = nil
5
- def setup
6
- @@image_path ||= File.join(__FILE__,'..','support','image')
7
- end
8
- def test_sikuli_module
9
- screen = ATU::Sikuli::Screen.new
10
- assert_equal(0,screen.x)
11
- assert_equal(0,screen.y)
12
- assert_equal(true,screen.w > 0)
13
- assert_equal(true,screen.h > 0)
14
- end
15
-
16
- def test_region_offen_used
17
- region = ATU::Sikuli::Region.new(0,0,1440,900)
18
- assert_equal(0,region.x)
19
- assert_equal(0,region.y)
20
- assert_equal(true,File.exist?(File.join(@@image_path,"start.png")))
21
- region.click(File.join(@@image_path, "start.png"),0)
22
- puts region.wait(File.join(@@image_path,"search.png"),10)
23
- end
24
-
25
-
26
- end