rautomation 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba425fe2212cdb7f9f34623423af85e658b97977
4
- data.tar.gz: 3e0b9423dc16e4bfdaa1f6e94d409076dc859ce6
3
+ metadata.gz: 178133c72cc25827e3ce116041461d98735467f7
4
+ data.tar.gz: 67c1b8edff6687922c7fb97a879af84e10c58107
5
5
  SHA512:
6
- metadata.gz: 43102aa78240ef7dc3a270ee1037cc8f02cd91c39f795eb362d403da5fc27285c2a390013b397f78d478444adcc8228405fbff71d585a0e5bc744032b55c11a9
7
- data.tar.gz: d1a8f0f19361f7f26067e8b14513a3c76a1506cef9c1cb33fb26bf1586f4e2706022deb8309e229c1b10fe954901b4e2582eb6c75cbcdaafabb8ee0d708cff3e
6
+ metadata.gz: 400deacbc79aa298a3d33dd0fc186d9ce6cf3c19af9a5cc5e5cf10e838d4b9b1048b1cd8fc7794feec56c07097111b81a7c4798d8d08bfa479dcf04393534ffc
7
+ data.tar.gz: c4c2e66e9d4699eedf120aa1352a3111fc1b956ffd0a48f44dbf471c5e158d7fa7e4ecdbacfc8a81b8c815a0839a3ff3b065e9323cd29ec4101bdf4cbf3826de
data/Gemfile.lock CHANGED
@@ -1,14 +1,14 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rautomation (0.11.0)
4
+ rautomation (0.12.0)
5
5
  ffi
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
10
  diff-lcs (1.1.3)
11
- ffi (1.8.1-x86-mingw32)
11
+ ffi (1.9.0-x86-mingw32)
12
12
  rake (0.9.2.2)
13
13
  rspec (2.8.0)
14
14
  rspec-core (~> 2.8.0)
data/History.rdoc CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.12.0
2
+
3
+ === MsUia adapter
4
+
5
+ * Add Control#help_text to relay ToolTip information
6
+
1
7
  == 0.11.0 / 2013-08-10
2
8
 
3
9
  === MsUia adapter
data/README.rdoc CHANGED
@@ -4,8 +4,6 @@
4
4
  * Web: http://www.github.com/jarmo/RAutomation
5
5
  * Author: Jarmo Pertman (mailto:jarmo.p[at]gmail.com)
6
6
 
7
- {<img alt='Click here to lend your support to: RAutomation and make a donation at www.pledgie.com !' src='https://pledgie.com/campaigns/16196.png?skin_name=chrome' />}[https://pledgie.com/campaigns/16196]
8
-
9
7
  RAutomation is a small and easy to use library for helping out to automate windows and their controls
10
8
  for automated testing.
11
9
 
@@ -101,6 +99,11 @@ In case of any problems, feel free to contact me.
101
99
  * Eric Kessler - https://github.com/enkessler
102
100
  * Stephan Schwab - https://github.com/snscaimito
103
101
 
102
+ == Libraries Using RAutomation
103
+
104
+ * watir-classic[https://github.com/watir/watir-classic]
105
+ * mohawk[https://github.com/leviwilson/mohawk]
106
+
104
107
  == Note on Patches/Pull Requests
105
108
 
106
109
  * Fork the project.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.11.0
1
+ 0.12.0
@@ -35,6 +35,11 @@ namespace RAutomation.UIA.Extensions
35
35
  return automationElement.Current.HasKeyboardFocus;
36
36
  }
37
37
 
38
+ public static string HelpText(this AutomationElement automationElement)
39
+ {
40
+ return automationElement.Current.HelpText;
41
+ }
42
+
38
43
  public static int NativeWindowHandle(this AutomationElement automationElement)
39
44
  {
40
45
  return automationElement.Exists() ? automationElement.Current.NativeWindowHandle : 0;
@@ -80,6 +85,12 @@ namespace RAutomation.UIA.Extensions
80
85
  return automationElement.AsValuePattern().Current.Value;
81
86
  }
82
87
 
88
+ public static void SendKeys(this AutomationElement automationElement, string keysToSend)
89
+ {
90
+ automationElement.SetFocus();
91
+ System.Windows.Forms.SendKeys.SendWait(keysToSend);
92
+ }
93
+
83
94
  public static void SetValue(this AutomationElement automationElement, string value)
84
95
  {
85
96
  automationElement.AsValuePattern().SetValue(value);
@@ -87,22 +98,22 @@ namespace RAutomation.UIA.Extensions
87
98
 
88
99
  public static bool IsValuePattern(this AutomationElement automationElement)
89
100
  {
90
- return (bool) automationElement.GetCurrentPropertyValue(AutomationElement.IsValuePatternAvailableProperty);
101
+ return (bool)automationElement.GetCurrentPropertyValue(AutomationElement.IsValuePatternAvailableProperty);
91
102
  }
92
103
 
93
104
  public static ValuePattern AsValuePattern(this AutomationElement automationElement)
94
105
  {
95
- return (ValuePattern) automationElement.GetCurrentPattern(ValuePattern.Pattern);
106
+ return (ValuePattern)automationElement.GetCurrentPattern(ValuePattern.Pattern);
96
107
  }
97
108
 
98
109
  public static TextPattern AsTextPattern(this AutomationElement automationElement)
99
110
  {
100
- return (TextPattern) automationElement.GetCurrentPattern(TextPattern.Pattern);
111
+ return (TextPattern)automationElement.GetCurrentPattern(TextPattern.Pattern);
101
112
  }
102
113
 
103
114
  public static T As<T>(this AutomationElement automationElement, AutomationPattern pattern)
104
115
  {
105
- return (T) automationElement.GetCurrentPattern(pattern);
116
+ return (T)automationElement.GetCurrentPattern(pattern);
106
117
  }
107
118
  }
108
119
  }
@@ -111,6 +111,23 @@ extern "C" {
111
111
  }
112
112
  }
113
113
 
114
+ __declspec (dllexport) void SendKeys(const FindInformation& findInformation, const char* keysToSend, char* errorInfo, const long errorInfoLength) {
115
+ try {
116
+ Element::SendKeys(Locator::FindFor(findInformation), gcnew String(keysToSend));
117
+ } catch(Exception^ e) {
118
+ StringHelper::CopyToUnmanagedString(e->Message, errorInfo, errorInfoLength);
119
+ }
120
+ }
121
+
122
+ __declspec ( dllexport ) void HelpText(const FindInformation& findInformation, char* helpText, const int helpTextLength) {
123
+ try {
124
+ auto helpTextProperty = Element::HelpText(Locator::FindFor(findInformation));
125
+ StringHelper::CopyToUnmanagedString(helpTextProperty, helpText, helpTextLength);
126
+ } catch(Exception^ e) {
127
+ Console::WriteLine("HelpText: {0}", e->Message);
128
+ }
129
+ }
130
+
114
131
  __declspec ( dllexport ) int GetClassNames(const FindInformation& findInformation, const char* classNames[]) {
115
132
  auto allChildren = Locator::FindFor(findInformation)->FindAll(System::Windows::Automation::TreeScope::Subtree, Condition::TrueCondition);
116
133
 
@@ -28,14 +28,15 @@
28
28
  /// </summary>
29
29
  private void InitializeComponent()
30
30
  {
31
- System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("Child 1");
32
- System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("Grandchild 1");
33
- System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("Child 2", new System.Windows.Forms.TreeNode[] {
34
- treeNode2});
35
- System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("Parent One", new System.Windows.Forms.TreeNode[] {
36
- treeNode1,
37
- treeNode3});
38
- System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("Parent Two");
31
+ this.components = new System.ComponentModel.Container();
32
+ System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("Child 1");
33
+ System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("Grandchild 1");
34
+ System.Windows.Forms.TreeNode treeNode8 = new System.Windows.Forms.TreeNode("Child 2", new System.Windows.Forms.TreeNode[] {
35
+ treeNode7});
36
+ System.Windows.Forms.TreeNode treeNode9 = new System.Windows.Forms.TreeNode("Parent One", new System.Windows.Forms.TreeNode[] {
37
+ treeNode6,
38
+ treeNode8});
39
+ System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("Parent Two");
39
40
  this.label1 = new System.Windows.Forms.Label();
40
41
  this.aboutButton = new System.Windows.Forms.Button();
41
42
  this.button1 = new System.Windows.Forms.Button();
@@ -70,6 +71,7 @@
70
71
  this.multiLineTextField = new System.Windows.Forms.TextBox();
71
72
  this.buttonDataGridView = new System.Windows.Forms.Button();
72
73
  this.automatableMonthCalendar1 = new System.Windows.Forms.MonthCalendar();
74
+ this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
73
75
  this.groupBox1.SuspendLayout();
74
76
  this.groupBox2.SuspendLayout();
75
77
  this.menuStrip1.SuspendLayout();
@@ -167,6 +169,7 @@
167
169
  this.radioButtonReset.Size = new System.Drawing.Size(75, 23);
168
170
  this.radioButtonReset.TabIndex = 9;
169
171
  this.radioButtonReset.Text = "Reset";
172
+ this.toolTip1.SetToolTip(this.radioButtonReset, "Some help text");
170
173
  this.radioButtonReset.UseVisualStyleBackColor = true;
171
174
  this.radioButtonReset.Click += new System.EventHandler(this.radioButtonReset_Click);
172
175
  //
@@ -392,19 +395,19 @@
392
395
  //
393
396
  this.treeView.Location = new System.Drawing.Point(490, 285);
394
397
  this.treeView.Name = "treeView";
395
- treeNode1.Name = "Child 1";
396
- treeNode1.Text = "Child 1";
397
- treeNode2.Name = "Grandchild 1";
398
- treeNode2.Text = "Grandchild 1";
399
- treeNode3.Name = "Child 2";
400
- treeNode3.Text = "Child 2";
401
- treeNode4.Name = "Parent One";
402
- treeNode4.Text = "Parent One";
403
- treeNode5.Name = "Parent Two";
404
- treeNode5.Text = "Parent Two";
398
+ treeNode6.Name = "Child 1";
399
+ treeNode6.Text = "Child 1";
400
+ treeNode7.Name = "Grandchild 1";
401
+ treeNode7.Text = "Grandchild 1";
402
+ treeNode8.Name = "Child 2";
403
+ treeNode8.Text = "Child 2";
404
+ treeNode9.Name = "Parent One";
405
+ treeNode9.Text = "Parent One";
406
+ treeNode10.Name = "Parent Two";
407
+ treeNode10.Text = "Parent Two";
405
408
  this.treeView.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
406
- treeNode4,
407
- treeNode5});
409
+ treeNode9,
410
+ treeNode10});
408
411
  this.treeView.Size = new System.Drawing.Size(159, 177);
409
412
  this.treeView.TabIndex = 16;
410
413
  //
@@ -507,7 +510,8 @@
507
510
  private System.Windows.Forms.TreeView treeView;
508
511
  private System.Windows.Forms.TextBox multiLineTextField;
509
512
  private System.Windows.Forms.Button buttonDataGridView;
510
- private System.Windows.Forms.MonthCalendar automatableMonthCalendar1;
513
+ private System.Windows.Forms.MonthCalendar automatableMonthCalendar1;
514
+ private System.Windows.Forms.ToolTip toolTip1;
511
515
  }
512
516
  }
513
517
 
@@ -117,6 +117,9 @@
117
117
  <resheader name="writer">
118
118
  <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
119
  </resheader>
120
+ <metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121
+ <value>132, 17</value>
122
+ </metadata>
120
123
  <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121
124
  <value>17, 17</value>
122
125
  </metadata>
@@ -104,6 +104,10 @@ module RAutomation
104
104
  UiaDll::name(search_information)
105
105
  end
106
106
 
107
+ def help_text
108
+ UiaDll::help_text(search_information)
109
+ end
110
+
107
111
  def control_class
108
112
  UiaDll::class_name(search_information)
109
113
  end
@@ -134,8 +134,9 @@ module RAutomation
134
134
  attach_function :is_enabled, :IsEnabled, [SearchCriteria.by_ref], :bool
135
135
  attach_function :is_focused, :IsFocused, [SearchCriteria.by_ref], :bool
136
136
  attach_function :set_focus, :SetControlFocus, [SearchCriteria.by_ref], :bool
137
- attach_function :GetClassNames,
138
- [SearchCriteria.by_ref, :pointer], :int
137
+ attach_function :GetClassNames, [SearchCriteria.by_ref, :pointer], :int
138
+ attach_function :HelpText, [SearchCriteria.by_ref, :pointer, :int], :void
139
+ attach_function :SendKeys, [SearchCriteria.by_ref, :string, :pointer, :int], :void
139
140
 
140
141
  def self.exists?(search_information)
141
142
  ElementExists search_information
@@ -155,6 +156,10 @@ module RAutomation
155
156
  string_from(:Text_GetValue, search_information)
156
157
  end
157
158
 
159
+ def self.help_text(search_information)
160
+ string_from(:HelpText, search_information)
161
+ end
162
+
158
163
  def self.name(search_information)
159
164
  string_from(:Name, search_information)
160
165
  end
@@ -167,6 +172,10 @@ module RAutomation
167
172
  strings_from :GetClassNames, search_information
168
173
  end
169
174
 
175
+ def self.send_keys(search_information, keys_to_send)
176
+ can_throw(:SendKeys, search_information, keys_to_send)
177
+ end
178
+
170
179
  # Toggle methods
171
180
  attach_function :is_set, :IsSet, [SearchCriteria.by_ref], :bool
172
181
 
@@ -27,6 +27,11 @@ describe "MsUia::Control", :if => SpecHelper.adapter == :ms_uia do
27
27
  control.control_class.should =~ /WindowsForms10.BUTTON.*/
28
28
  end
29
29
 
30
+ it "can get tooltip information" do
31
+ control = window.button(:value => 'Reset')
32
+ control.help_text.should eq 'Some help text'
33
+ end
34
+
30
35
  it "can limit the search depth" do
31
36
  window.button(:id => 'buttonDataGridView').click { true }
32
37
  data_grid_window = RAutomation::Window.new(:title => /DataGridView/i)
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.11.0
4
+ version: 0.12.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-08-10 00:00:00.000000000 Z
11
+ date: 2013-09-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ffi
@@ -292,7 +292,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
292
292
  version: '0'
293
293
  requirements: []
294
294
  rubyforge_project:
295
- rubygems_version: 2.0.3
295
+ rubygems_version: 2.0.7
296
296
  signing_key:
297
297
  specification_version: 4
298
298
  summary: Automate windows and their controls through user-friendly API with Ruby