spec/win/gui/input_spec.rb in win-0.1.13 vs spec/win/gui/input_spec.rb in win-0.1.16
- old
+ new
@@ -12,19 +12,19 @@
describe '#keydb_event' do
spec{ use{ keybd_event(vkey = 0, bscan = 0, flags = 0, extra_info = 0) }}
it 'synthesizes a numeric keystrokes, emulating keyboard driver' do
test_app do |app|
- text = '123 456'
+ text = '12 34'
text.upcase.each_byte do |b| # upcase needed since user32 keybd_event expects upper case chars
keybd_event(b.ord, 0, KEYEVENTF_KEYDOWN, 0)
sleep TEST_KEY_DELAY
keybd_event(b.ord, 0, KEYEVENTF_KEYUP, 0)
sleep TEST_KEY_DELAY
end
- app.textarea.text.should =~ Regexp.new(text)
- 7.times {keystroke(VK_CONTROL, 'Z'.ord)} # dirty hack!
+ text(app.textarea).should =~ Regexp.new(text)
+ 5.times {keystroke(VK_CONTROL, 'Z'.ord)} # rolling back changes to allow window closing without dialog!
end
end
end
describe '#mouse_event' do
@@ -44,12 +44,12 @@
it 'emulates combinations of keys pressed (Ctrl+Alt+P+M, etc)' do
test_app do |app|
keystroke(VK_CONTROL, 'A'.ord)
keystroke(VK_SPACE)
- app.textarea.text.should == ' '
- 2.times {keystroke(VK_CONTROL, 'Z'.ord)} # dirty hack!
+ text(app.textarea).should.should == ' '
+ 2.times {keystroke(VK_CONTROL, 'Z'.ord)} # rolling back changes to allow window closing without dialog!
end
end
end
describe '#type_in' do
@@ -57,11 +57,11 @@
it 'types text message into the window holding the focus' do
test_app do |app|
text = '12 34'
type_in(text)
- app.textarea.text.should =~ Regexp.new(text)
- 5.times {keystroke(VK_CONTROL, 'Z'.ord)} # dirty hack!
+ text(app.textarea).should =~ Regexp.new(text)
+ 5.times {keystroke(VK_CONTROL, 'Z'.ord)} # rolling back changes to allow window closing without dialog!
end
end
end
end
end