examples/quicknote/spec/quicknote/form_main_spec.rb in win32-autogui-0.5.1 vs examples/quicknote/spec/quicknote/form_main_spec.rb in win32-autogui-0.5.2
- old
+ new
@@ -26,12 +26,12 @@
end
puts "FormMain after(:all)" if @debug
end
after(:each) do
if @application.running?
- keystroke(VK_N) if @application.message_dialog_confirm || @application.dialog_overwrite_confirm
- keystroke(VK_ESCAPE) if @application.error_dialog
+ keystroke(VK_N) if @application.message_dialog_confirm(:timeout => 0) || @application.dialog_overwrite_confirm(:timeout => 0)
+ keystroke(VK_ESCAPE) if @application.error_dialog(:timeout => 0)
end
puts "FormMain after(:each)" if @debug
end
describe "after startup" do
@@ -65,12 +65,18 @@
@filename = "input_file.txt"
@file_contents = write_file(@filename, "the quick brown fox")
@application.file_new(:save => false)
end
after(:each) do
- keystroke(VK_N) if @application.message_dialog_confirm
- keystroke(VK_ESCAPE) if @application.file_open_dialog
+ if @application.message_dialog_confirm(:timeout => 0)
+ @application.message_dialog_confirm.set_focus
+ keystroke(VK_N)
+ end
+ if @application.file_open_dialog(:timeout => 0)
+ @application.file_open_dialog.set_focus
+ keystroke(VK_ESCAPE)
+ end
end
it "should prompt to save with modified text" do
type_in("foobar")
@application.main_window.title.should match(/\+/)
@@ -78,11 +84,11 @@
@application.message_dialog_confirm.should_not be_nil
end
it "should not prompt to save with unmodified text" do
@application.main_window.title.should_not match(/\+/)
keystroke(VK_MENU, VK_F, VK_O)
- @application.message_dialog_confirm.should be_nil
+ @application.message_dialog_confirm(:timeout => 0).should be_nil
end
describe "succeeding" do
it "should add the filename to the title" do
@application.main_window.title.should == "QuickNote - untitled.txt"
@@ -120,11 +126,11 @@
end
it "should not prompt to save with unmodified text" do
@application.file_new(:save => false)
@application.main_window.title.should_not match(/\+/)
keystroke(VK_MENU, VK_F, VK_N)
- @application.message_dialog_confirm.should be_nil
+ @application.message_dialog_confirm(:timeout => 0).should be_nil
end
it "should add the filename 'untitled.txt' to the title" do
filename = "input_file.txt"
file_contents = write_file(filename, "the quick brown fox")
@application.file_open(filename, :save => false)
@@ -220,12 +226,12 @@
@saveas_filename = "newfile.txt"
write_file(@saveas_filename, "")
@application.file_open(fullpath(@filename), :save => false)
end
after(:each) do
- keystroke(VK_N) if @application.dialog_overwrite_confirm
- keystroke(VK_ESCAPE) if @application.file_save_as_dialog
+ keystroke(VK_N) if @application.dialog_overwrite_confirm(:timeout => 0)
+ keystroke(VK_ESCAPE) if @application.file_save_as_dialog(:timeout => 0)
end
it "should prompt for filename" do
keystroke(VK_MENU, VK_F, VK_A)
@application.file_save_as_dialog.should_not be_nil
@@ -264,10 +270,10 @@
@application.main_window.is_window?.should == true
@application.should be_running
end
it "should not prompt to save with unmodified text" do
keystroke(VK_MENU, VK_F, VK_X)
- @application.message_dialog_confirm.should be_nil
+ @application.message_dialog_confirm(:timeout => 0).should be_nil
@application.main_window.is_window?.should == false
@application.should_not be_running
end
end