uia 0.4 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ === Version 0.4.1 / 2014-05-14
2
+ * Enhancements
3
+ * Element#help_text
4
+
1
5
  === Version 0.4 / 2014-05-13
2
6
  * Enhancements
3
7
  * MenuItems#menu_item - find by path
Binary file
Binary file
@@ -62,6 +62,11 @@ namespace UIA.Helper
62
62
  get { return _element.Current.Name; }
63
63
  }
64
64
 
65
+ public virtual string HelpText
66
+ {
67
+ get { return _element.Current.HelpText; }
68
+ }
69
+
65
70
  public virtual string ClassName
66
71
  {
67
72
  get { return _element.Current.ClassName; }
@@ -7,6 +7,7 @@ typedef struct _ElementInformation {
7
7
  int* runtimeId;
8
8
  int runtimeIdLength;
9
9
  char* name;
10
+ char* helpText;
10
11
  char* className;
11
12
  int controlTypeId;
12
13
  int* patterns;
@@ -18,9 +19,9 @@ typedef struct _ElementInformation {
18
19
  bool hasKeyboardFocus;
19
20
  long boundingRectangle[4];
20
21
 
21
- _ElementInformation() : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL), className(NULL) {}
22
+ _ElementInformation() : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL), className(NULL), helpText(NULL) {}
22
23
 
23
- _ElementInformation(Element^ element) : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL), className(NULL) {
24
+ _ElementInformation(Element^ element) : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL), className(NULL), helpText(NULL) {
24
25
  Refresh(element);
25
26
  }
26
27
 
@@ -56,6 +57,8 @@ typedef struct _ElementInformation {
56
57
  isVisible = element->IsVisible;
57
58
  hasKeyboardFocus = element->HasKeyboardFocus;
58
59
 
60
+ helpText = StringHelper::ToUnmanaged(element->HelpText);
61
+
59
62
  auto r = element->BoundingRectangle;
60
63
  for(auto coord = 0; coord < 4; coord++) {
61
64
  boundingRectangle[coord] = r[coord];
@@ -68,8 +71,8 @@ typedef struct _ElementInformation {
68
71
 
69
72
  private:
70
73
  void Reset() {
71
- delete[] name; delete[] runtimeId; delete[] patterns; delete[] id; delete[] className;
72
- name = NULL; runtimeId = NULL; patterns = NULL; id = NULL; className = NULL;
74
+ delete[] name; delete[] runtimeId; delete[] patterns; delete[] id; delete[] className; delete[] helpText;
75
+ name = NULL; runtimeId = NULL; patterns = NULL; id = NULL; className = NULL; helpText = NULL;
73
76
  }
74
77
 
75
78
  } ElementInformation, *ElementInformationPtr;
@@ -37,6 +37,13 @@ TEST_F(ElementInformationTest, ItHasTheName)
37
37
  ASSERT_STREQ("Expected Name", ElementInformation(gcnew ElementStub("Expected Name")).name);
38
38
  }
39
39
 
40
+ TEST_F(ElementInformationTest, ItHasTheHelpText) {
41
+ auto element = gcnew ElementStub("");
42
+ element->HelpText = gcnew String("Expected help text");
43
+
44
+ ASSERT_STREQ("Expected help text", ElementInformation(element).helpText);
45
+ }
46
+
40
47
  TEST_F(ElementInformationTest, ItKnowsAboutTheRuntimeId)
41
48
  {
42
49
  auto elementInformation = ElementInformation(gcnew ElementStub("", 0, 1, 2));
@@ -16,6 +16,12 @@ public:
16
16
  void set(String^ name) { _name = name; }
17
17
  }
18
18
 
19
+ virtual property String^ HelpText
20
+ {
21
+ String^ get() override { return _helpText; }
22
+ void set(String^ helpText) { _helpText = helpText; }
23
+ }
24
+
19
25
  virtual property String^ ClassName
20
26
  {
21
27
  String^ get() override { return _className; }
@@ -80,6 +86,7 @@ public:
80
86
 
81
87
  private:
82
88
  String^ _name;
89
+ String^ _helpText;
83
90
  String^ _className;
84
91
  String^ _id;
85
92
  array<int>^ _runtimeIds;
data/lib/uia/element.rb CHANGED
@@ -18,7 +18,7 @@ module Uia
18
18
  @default = lambda { [:unknown] }
19
19
  end
20
20
 
21
- element_attr :id, :name, :handle, :runtime_id,
21
+ element_attr :id, :name, :handle, :runtime_id, :help_text,
22
22
  :class_name, :children, :descendants
23
23
  refreshed_element_attr :enabled?, :visible?, :focused?, :bounding_rectangle
24
24
 
@@ -13,6 +13,7 @@ module Uia
13
13
  :runtime_id, :pointer,
14
14
  :number_of_ids, :int,
15
15
  :name, :string,
16
+ :help_text, :string,
16
17
  :class_name, :string,
17
18
  :control_type_id, :int,
18
19
  :patterns, :pointer,
@@ -23,7 +24,7 @@ module Uia
23
24
  :has_focus, :bool,
24
25
  :bounding_rectangle, [:long, 4]
25
26
 
26
- struct_attr :id, :name, :handle, :control_type_id, :class_name,
27
+ struct_attr :id, :name, :handle, :control_type_id, :class_name, :help_text,
27
28
  [:enabled?, :is_enabled], [:visible?, :is_visible], [:focused?, :has_focus]
28
29
 
29
30
  def runtime_id
data/lib/uia/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Uia
2
- VERSION = '0.4'
2
+ VERSION = '0.4.1'
3
3
  end
Binary file
@@ -26,9 +26,12 @@ describe Uia::Element do
26
26
 
27
27
  context 'properties' do
28
28
  let(:raw_element) { element.instance_variable_get(:@element) }
29
+ Given(:about_button) { element.find name: 'About', control_type: :button }
30
+
29
31
  Then { element.handle != 0 }
30
32
  Then { element.name == 'MainFormWindow' }
31
33
  Then { element.id == 'MainFormWindow' }
34
+ Then { about_button.help_text =~ /click about to find out/i }
32
35
  Then { element.class_name =~ /Forms.*app/i }
33
36
  Then { expect(element.find(id: 'textField')).to be_enabled }
34
37
  Then do
data/test.rb ADDED
@@ -0,0 +1,5 @@
1
+ require 'uia'
2
+
3
+ def w
4
+ @w ||= Uia.find_element title: /^MainForm/
5
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uia
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.4'
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -243,6 +243,7 @@ files:
243
243
  - spec/uia/patterns/value_spec.rb
244
244
  - spec/uia/patterns/window_spec.rb
245
245
  - spec/uia_spec.rb
246
+ - test.rb
246
247
  - uia.gemspec
247
248
  - ext/UiaDll/Release/UiaDll.dll
248
249
  - ext/UiaDll/Release/UIA.Helper.dll
@@ -261,7 +262,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
261
262
  version: '0'
262
263
  segments:
263
264
  - 0
264
- hash: -662745805
265
+ hash: -1027979665
265
266
  required_rubygems_version: !ruby/object:Gem::Requirement
266
267
  none: false
267
268
  requirements:
@@ -270,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
270
271
  version: '0'
271
272
  segments:
272
273
  - 0
273
- hash: -662745805
274
+ hash: -1027979665
274
275
  requirements: []
275
276
  rubyforge_project:
276
277
  rubygems_version: 1.8.28