rautomation 0.12.0 → 0.13.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.
- checksums.yaml +4 -4
 - data/Gemfile.lock +1 -1
 - data/History.rdoc +11 -1
 - data/VERSION +1 -1
 - data/ext/UiaDll/RAutomation.UIA/Controls/Clicker.cs +5 -1
 - data/ext/UiaDll/RAutomation.UIA/Controls/SelectList.cs +41 -1
 - data/ext/UiaDll/RAutomation.UIA/Controls/TableControl.cs +37 -2
 - data/ext/UiaDll/RAutomation.UIA/Extensions/Element.cs +48 -1
 - data/ext/UiaDll/UiaDll/SelectListMethods.cpp +23 -0
 - data/ext/UiaDll/UiaDll/StringHelper.cpp +5 -0
 - data/ext/UiaDll/UiaDll/StringHelper.h +1 -0
 - data/ext/UiaDll/UiaDll/TableMethods.cpp +23 -5
 - data/ext/WindowsForms/WindowsForms/AboutBox.Designer.cs +31 -0
 - data/ext/WindowsForms/WindowsForms/DataEntryForm.Designer.cs +13 -0
 - data/ext/WindowsForms/WindowsForms/DataEntryForm.cs +5 -0
 - data/ext/WindowsForms/WindowsForms/MainFormWindow.Designer.cs +32 -22
 - data/ext/WindowsForms/WindowsForms/MainFormWindow.cs +30 -1
 - data/lib/rautomation/adapter/ms_uia/select_list.rb +8 -8
 - data/lib/rautomation/adapter/ms_uia/table.rb +12 -8
 - data/lib/rautomation/adapter/ms_uia/uia_dll.rb +36 -4
 - data/spec/adapter/ms_uia/button_spec.rb +2 -2
 - data/spec/adapter/ms_uia/checkbox_spec.rb +2 -2
 - data/spec/adapter/ms_uia/listbox_spec.rb +15 -17
 - data/spec/adapter/ms_uia/radio_spec.rb +1 -1
 - data/spec/adapter/ms_uia/select_list_spec.rb +67 -65
 - data/spec/adapter/ms_uia/spinner_spec.rb +1 -1
 - data/spec/adapter/ms_uia/tab_control_spec.rb +3 -3
 - data/spec/adapter/ms_uia/table_spec.rb +35 -17
 - data/spec/adapter/ms_uia/text_field_spec.rb +2 -2
 - data/spec/adapter/ms_uia/window_spec.rb +1 -63
 - metadata +2 -2
 
| 
         @@ -24,7 +24,7 @@ describe MsUia::TabControl, :if => SpecHelper.adapter == :ms_uia do 
     | 
|
| 
       24 
24 
     | 
    
         
             
              end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
26 
     | 
    
         
             
              it 'has tab items' do
         
     | 
| 
       27 
     | 
    
         
            -
                subject.items.count.should eq( 
     | 
| 
      
 27 
     | 
    
         
            +
                subject.items.count.should eq(3)
         
     | 
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              it 'knows the current tab' do
         
     | 
| 
         @@ -33,11 +33,11 @@ describe MsUia::TabControl, :if => SpecHelper.adapter == :ms_uia do 
     | 
|
| 
       33 
33 
     | 
    
         | 
| 
       34 
34 
     | 
    
         
             
              context('#items') do
         
     | 
| 
       35 
35 
     | 
    
         
             
                it 'has text' do
         
     | 
| 
       36 
     | 
    
         
            -
                  subject.items.map(&:text).should eq(['Info', 'More Info'])
         
     | 
| 
      
 36 
     | 
    
         
            +
                  subject.items.map(&:text).should eq(['Info', 'More Info', 'Multi-Select ListBox'])
         
     | 
| 
       37 
37 
     | 
    
         
             
                end
         
     | 
| 
       38 
38 
     | 
    
         | 
| 
       39 
39 
     | 
    
         
             
                it 'has indices' do
         
     | 
| 
       40 
     | 
    
         
            -
                  subject.items.map(&:index).should eq([0, 1])
         
     | 
| 
      
 40 
     | 
    
         
            +
                  subject.items.map(&:index).should eq([0, 1, 2])
         
     | 
| 
       41 
41 
     | 
    
         
             
                end
         
     | 
| 
       42 
42 
     | 
    
         | 
| 
       43 
43 
     | 
    
         
             
                it 'can be selected' do
         
     | 
| 
         @@ -1,7 +1,9 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            describe "MsUia::Table", :if => SpecHelper.adapter == :ms_uia do
         
     | 
| 
       4 
     | 
    
         
            -
              let(: 
     | 
| 
      
 4 
     | 
    
         
            +
              let(:data_entry) { RAutomation::Window.new(:title => "DataEntryForm") }
         
     | 
| 
      
 5 
     | 
    
         
            +
              let(:table) { data_entry.table(:id => "personListView") }
         
     | 
| 
      
 6 
     | 
    
         
            +
              let(:toggle_multi_select) { data_entry.button(:value => 'Toggle Multi').click { true } }
         
     | 
| 
       5 
7 
     | 
    
         | 
| 
       6 
8 
     | 
    
         
             
              before :each do
         
     | 
| 
       7 
9 
     | 
    
         
             
                window = RAutomation::Window.new(:title => "MainFormWindow")
         
     | 
| 
         @@ -36,22 +38,6 @@ describe "MsUia::Table", :if => SpecHelper.adapter == :ms_uia do 
     | 
|
| 
       36 
38 
     | 
    
         
             
                ]
         
     | 
| 
       37 
39 
     | 
    
         
             
              end
         
     | 
| 
       38 
40 
     | 
    
         | 
| 
       39 
     | 
    
         
            -
              it "#select by index" do
         
     | 
| 
       40 
     | 
    
         
            -
                table.select(0)
         
     | 
| 
       41 
     | 
    
         
            -
                table.should_not be_selected(1)
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                table.select(1)
         
     | 
| 
       44 
     | 
    
         
            -
                table.should be_selected(1)
         
     | 
| 
       45 
     | 
    
         
            -
              end
         
     | 
| 
       46 
     | 
    
         
            -
             
     | 
| 
       47 
     | 
    
         
            -
              it "#select by value" do
         
     | 
| 
       48 
     | 
    
         
            -
                table.select "John Doe"
         
     | 
| 
       49 
     | 
    
         
            -
                table.should_not be_selected(1)
         
     | 
| 
       50 
     | 
    
         
            -
             
     | 
| 
       51 
     | 
    
         
            -
                table.select "Anna Doe"
         
     | 
| 
       52 
     | 
    
         
            -
                table.should be_selected(1)
         
     | 
| 
       53 
     | 
    
         
            -
              end
         
     | 
| 
       54 
     | 
    
         
            -
             
     | 
| 
       55 
41 
     | 
    
         
             
              it "#row_count" do
         
     | 
| 
       56 
42 
     | 
    
         
             
                table.row_count.should eq(2)
         
     | 
| 
       57 
43 
     | 
    
         
             
              end
         
     | 
| 
         @@ -69,6 +55,38 @@ describe "MsUia::Table", :if => SpecHelper.adapter == :ms_uia do 
     | 
|
| 
       69 
55 
     | 
    
         
             
                  table.rows.map(&:text).should eq ["John Doe", "Anna Doe"]
         
     | 
| 
       70 
56 
     | 
    
         
             
                end
         
     | 
| 
       71 
57 
     | 
    
         | 
| 
      
 58 
     | 
    
         
            +
                it "can be selected" do
         
     | 
| 
      
 59 
     | 
    
         
            +
                  row = table.row(:index => 1)
         
     | 
| 
      
 60 
     | 
    
         
            +
                  row.select
         
     | 
| 
      
 61 
     | 
    
         
            +
                  row.should be_selected
         
     | 
| 
      
 62 
     | 
    
         
            +
                end
         
     | 
| 
      
 63 
     | 
    
         
            +
             
     | 
| 
      
 64 
     | 
    
         
            +
                it "can be cleared" do
         
     | 
| 
      
 65 
     | 
    
         
            +
                  row = table.row(:index => 1)
         
     | 
| 
      
 66 
     | 
    
         
            +
                  row.select
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                  row.clear
         
     | 
| 
      
 69 
     | 
    
         
            +
                  row.should_not be_selected
         
     | 
| 
      
 70 
     | 
    
         
            +
                end
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
      
 72 
     | 
    
         
            +
                it "can select multiple rows" do
         
     | 
| 
      
 73 
     | 
    
         
            +
                  table.rows.each(&:select)
         
     | 
| 
      
 74 
     | 
    
         
            +
                  table.rows.all?(&:selected?).should be_true
         
     | 
| 
      
 75 
     | 
    
         
            +
                end
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                it "plays nice if the table does not support multiple selections" do
         
     | 
| 
      
 78 
     | 
    
         
            +
                  toggle_multi_select
         
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
                  first_row = table.rows.first
         
     | 
| 
      
 81 
     | 
    
         
            +
                  last_row = table.rows.last
         
     | 
| 
      
 82 
     | 
    
         
            +
             
     | 
| 
      
 83 
     | 
    
         
            +
                  first_row.select
         
     | 
| 
      
 84 
     | 
    
         
            +
                  last_row.select
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  first_row.should_not be_selected
         
     | 
| 
      
 87 
     | 
    
         
            +
                  last_row.should be_selected
         
     | 
| 
      
 88 
     | 
    
         
            +
                end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
       72 
90 
     | 
    
         
             
                context "locators" do
         
     | 
| 
       73 
91 
     | 
    
         
             
                  it "can locate by text" do
         
     | 
| 
       74 
92 
     | 
    
         
             
                    table.rows(:text => "Anna Doe").size.should eq 1
         
     | 
| 
         @@ -17,9 +17,9 @@ describe "MsUia::TextField", :if => SpecHelper.adapter == :ms_uia do 
     | 
|
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              it "cannot set a value to a disabled text field" do
         
     | 
| 
       20 
     | 
    
         
            -
                 
     | 
| 
      
 20 
     | 
    
         
            +
                expect { main_form.text_field(:id => "textBoxDisabled").set "abc" }.to raise_error
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
     | 
    
         
            -
                 
     | 
| 
      
 22 
     | 
    
         
            +
                expect { main_form.text_field(:id => "textBoxDisabled").clear }.to raise_error
         
     | 
| 
       23 
23 
     | 
    
         
             
              end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              it "considers a document control type a text field as well" do
         
     | 
| 
         @@ -62,7 +62,7 @@ describe "MsUia::Window", :if => SpecHelper.adapter == :ms_uia do 
     | 
|
| 
       62 
62 
     | 
    
         
             
                end
         
     | 
| 
       63 
63 
     | 
    
         | 
| 
       64 
64 
     | 
    
         
             
                it "raises when errors occur" do
         
     | 
| 
       65 
     | 
    
         
            -
                   
     | 
| 
      
 65 
     | 
    
         
            +
                  expect { window.menu(:text => "File").menu(:text => "Does Not Exist").open}.to raise_error
         
     | 
| 
       66 
66 
     | 
    
         
             
                end
         
     | 
| 
       67 
67 
     | 
    
         | 
| 
       68 
68 
     | 
    
         
             
                it "indicates if the menu item does not exist" do
         
     | 
| 
         @@ -82,66 +82,4 @@ describe "MsUia::Window", :if => SpecHelper.adapter == :ms_uia do 
     | 
|
| 
       82 
82 
     | 
    
         
             
                  window.menu(:text => "File").menu(:text => "Missing").should_not exist
         
     | 
| 
       83 
83 
     | 
    
         
             
                end
         
     | 
| 
       84 
84 
     | 
    
         
             
              end
         
     | 
| 
       85 
     | 
    
         
            -
             
     | 
| 
       86 
     | 
    
         
            -
            =begin
         
     | 
| 
       87 
     | 
    
         
            -
              it "control by focus" do
         
     | 
| 
       88 
     | 
    
         
            -
                window = RAutomation::Window.new(:title => /MainFormWindow/i)
         
     | 
| 
       89 
     | 
    
         
            -
             
     | 
| 
       90 
     | 
    
         
            -
                button = window.button(:value => "Reset")
         
     | 
| 
       91 
     | 
    
         
            -
                button.set_focus
         
     | 
| 
       92 
     | 
    
         
            -
                control = window.control(:id => "button1", :focus => "")
         
     | 
| 
       93 
     | 
    
         
            -
             
     | 
| 
       94 
     | 
    
         
            -
                box2 = button.bounding_rectangle
         
     | 
| 
       95 
     | 
    
         
            -
                box1 = control.bounding_rectangle
         
     | 
| 
       96 
     | 
    
         
            -
             
     | 
| 
       97 
     | 
    
         
            -
                box1.should == box2
         
     | 
| 
       98 
     | 
    
         
            -
              end
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
       100 
     | 
    
         
            -
              it "send tab keystrokes to move focus between elements" do
         
     | 
| 
       101 
     | 
    
         
            -
                window = RAutomation::Window.new(:title => /MainFormWindow/i)
         
     | 
| 
       102 
     | 
    
         
            -
                window.button(:value => "&About").set_focus
         
     | 
| 
       103 
     | 
    
         
            -
                window.button(:value => "&About").should have_focus
         
     | 
| 
       104 
     | 
    
         
            -
             
     | 
| 
       105 
     | 
    
         
            -
                window.send_keys("{tab}{tab}{tab}")
         
     | 
| 
       106 
     | 
    
         
            -
                button = window.button(:value => "Close")
         
     | 
| 
       107 
     | 
    
         
            -
                button.should exist
         
     | 
| 
       108 
     | 
    
         
            -
                button.should have_focus
         
     | 
| 
       109 
     | 
    
         
            -
              end
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
              it "send keystrokes to a text field" do
         
     | 
| 
       112 
     | 
    
         
            -
                window = RAutomation::Window.new(:title => /MainFormWindow/i)
         
     | 
| 
       113 
     | 
    
         
            -
                text_field = RAutomation::Window.new(:title => "MainFormWindow").text_field(:id => "textField")
         
     | 
| 
       114 
     | 
    
         
            -
                text_field.set_focus
         
     | 
| 
       115 
     | 
    
         
            -
                window.send_keys("abc123ABChiHI!\#@$%^&*()\"/-,'&_<>")
         
     | 
| 
       116 
     | 
    
         
            -
                text_field.value.should == "abc123ABChiHI!\#@$%^&*()\"/-,'&_<>"
         
     | 
| 
       117 
     | 
    
         
            -
              end
         
     | 
| 
       118 
     | 
    
         
            -
             
     | 
| 
       119 
     | 
    
         
            -
              it "sending keystrokes does not change argument string" do
         
     | 
| 
       120 
     | 
    
         
            -
                window = RAutomation::Window.new(:title => /MainFormWindow/i)
         
     | 
| 
       121 
     | 
    
         
            -
             
     | 
| 
       122 
     | 
    
         
            -
                text_field = RAutomation::Window.new(:title => "MainFormWindow").text_field(:id => "textField")
         
     | 
| 
       123 
     | 
    
         
            -
                text_field.set_focus()
         
     | 
| 
       124 
     | 
    
         
            -
             
     | 
| 
       125 
     | 
    
         
            -
                an_important_string = "Don't lose me"
         
     | 
| 
       126 
     | 
    
         
            -
                window.send_keys(an_important_string)
         
     | 
| 
       127 
     | 
    
         
            -
                an_important_string.should == "Don't lose me"
         
     | 
| 
       128 
     | 
    
         
            -
              end
         
     | 
| 
       129 
     | 
    
         
            -
             
     | 
| 
       130 
     | 
    
         
            -
              it "#control" do
         
     | 
| 
       131 
     | 
    
         
            -
                window = RAutomation::Window.new(:title => /MainFormWindow/i)
         
     | 
| 
       132 
     | 
    
         
            -
                window.control(:id => "aboutButton").should exist
         
     | 
| 
       133 
     | 
    
         
            -
              end
         
     | 
| 
       134 
     | 
    
         
            -
             
     | 
| 
       135 
     | 
    
         
            -
              it "has controls" do
         
     | 
| 
       136 
     | 
    
         
            -
                window = RAutomation::Window.new(:title => /MainFormWindow/i)
         
     | 
| 
       137 
     | 
    
         
            -
                window.controls(:class => /BUTTON/i).size.should == 12
         
     | 
| 
       138 
     | 
    
         
            -
              end
         
     | 
| 
       139 
     | 
    
         
            -
             
     | 
| 
       140 
     | 
    
         
            -
              it "window coordinates" do
         
     | 
| 
       141 
     | 
    
         
            -
                window = RAutomation::Window.new(:title => /MainFormWindow/i)
         
     | 
| 
       142 
     | 
    
         
            -
             
     | 
| 
       143 
     | 
    
         
            -
                window.maximize
         
     | 
| 
       144 
     | 
    
         
            -
                window.bounding_rectangle.should == [-4, -4, 1444, 874]
         
     | 
| 
       145 
     | 
    
         
            -
              end
         
     | 
| 
       146 
     | 
    
         
            -
            =end
         
     | 
| 
       147 
85 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: rautomation
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.13.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jarmo Pertman
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2013- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-10-03 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: ffi
         
     |