uia 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/ChangeLog +11 -0
- data/README.md +18 -1
- data/Rakefile +6 -1
- data/ext/UiaDll/UIA.Helper/Element.cs +52 -32
- data/ext/UiaDll/UiaDll.Test/AssemblyInfo.cpp +40 -0
- data/ext/UiaDll/UiaDll.Test/ElementInformationTest.cpp +89 -0
- data/ext/UiaDll/UiaDll.Test/ElementStub.h +59 -0
- data/ext/UiaDll/UiaDll.Test/ElementsTest.cpp +22 -0
- data/ext/UiaDll/UiaDll.Test/MemoryLeakDetector.h +47 -0
- data/ext/UiaDll/UiaDll.Test/ReadMe.txt +35 -0
- data/ext/UiaDll/UiaDll.Test/StringHelperTest.cpp +14 -0
- data/ext/UiaDll/UiaDll.Test/UiaDll.Test.cpp +16 -0
- data/ext/UiaDll/UiaDll.Test/UiaDll.Test.vcxproj +127 -0
- data/ext/UiaDll/UiaDll.Test/UiaDll.Test.vcxproj.filters +67 -0
- data/ext/UiaDll/UiaDll.Test/app.ico +0 -0
- data/ext/UiaDll/UiaDll.Test/app.rc +0 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-actions.h +1078 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-cardinalities.h +147 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-actions.h +2415 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-actions.h.pump +821 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-function-mockers.h +991 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-function-mockers.h.pump +265 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-matchers.h +2190 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-matchers.h.pump +674 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-nice-strict.h +397 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-generated-nice-strict.h.pump +161 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-matchers.h +3986 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-more-actions.h +233 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-more-matchers.h +58 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock-spec-builders.h +1791 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/gmock.h +94 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-generated-internal-utils.h +279 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-generated-internal-utils.h.pump +136 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-internal-utils.h +498 -0
- data/ext/UiaDll/UiaDll.Test/gmock/include/gmock/internal/gmock-port.h +78 -0
- data/ext/UiaDll/UiaDll.Test/gmock/lib/gmock.lib +0 -0
- data/ext/UiaDll/UiaDll.Test/gmock/lib/gmockd.lib +0 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-death-test.h +294 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-message.h +250 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-param-test.h +1421 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-param-test.h.pump +487 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-printers.h +855 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-spi.h +232 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-test-part.h +179 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest-typed-test.h +259 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest.h +2291 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest_pred_impl.h +358 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/gtest_prod.h +58 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-death-test-internal.h +319 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-filepath.h +206 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-internal.h +1158 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-linked_ptr.h +233 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-param-util-generated.h +5143 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-param-util-generated.h.pump +301 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-param-util.h +619 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-port.h +1947 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-string.h +167 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-tuple.h +1012 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-tuple.h.pump +339 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-type-util.h +3331 -0
- data/ext/UiaDll/UiaDll.Test/gtest/include/gtest/internal/gtest-type-util.h.pump +297 -0
- data/ext/UiaDll/UiaDll.Test/gtest/lib/gtest.lib +0 -0
- data/ext/UiaDll/UiaDll.Test/gtest/lib/gtestd.lib +0 -0
- data/ext/UiaDll/UiaDll.Test/resource.h +3 -0
- data/ext/UiaDll/UiaDll.Test/stdafx.cpp +7 -0
- data/ext/UiaDll/UiaDll.Test/stdafx.h +7 -0
- data/ext/UiaDll/UiaDll.sln +15 -0
- data/ext/UiaDll/UiaDll/ArrayHelper.h +20 -2
- data/ext/UiaDll/UiaDll/ElementMethods.cpp +18 -0
- data/ext/UiaDll/UiaDll/ElementStructures.h +36 -24
- data/ext/UiaDll/UiaDll/StringHelper.h +16 -2
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj +0 -2
- data/ext/UiaDll/UiaDll/UiaDll.vcxproj.filters +0 -6
- data/lib/uia.rb +23 -117
- data/lib/uia/element.rb +38 -0
- data/lib/uia/library.rb +60 -0
- data/lib/uia/library/constants.rb +85 -0
- data/lib/uia/library/structs.rb +85 -0
- data/lib/uia/version.rb +1 -1
- data/spec/app/FizzWare.NBuilder.dll +0 -0
- data/spec/app/UIA.Extensions.dll +0 -0
- data/spec/app/WindowsForms.exe +0 -0
- data/spec/spec_helper.rb +21 -0
- data/spec/uia/element_spec.rb +56 -0
- data/spec/uia_spec.rb +28 -0
- data/uia.gemspec +13 -10
- metadata +134 -8
- data/ext/UiaDll/UiaDll/ArrayHelper.cpp +0 -22
- data/ext/UiaDll/UiaDll/StringHelper.cpp +0 -17
@@ -0,0 +1,297 @@
|
|
1
|
+
$$ -*- mode: c++; -*-
|
2
|
+
$var n = 50 $$ Maximum length of type lists we want to support.
|
3
|
+
// Copyright 2008 Google Inc.
|
4
|
+
// All Rights Reserved.
|
5
|
+
//
|
6
|
+
// Redistribution and use in source and binary forms, with or without
|
7
|
+
// modification, are permitted provided that the following conditions are
|
8
|
+
// met:
|
9
|
+
//
|
10
|
+
// * Redistributions of source code must retain the above copyright
|
11
|
+
// notice, this list of conditions and the following disclaimer.
|
12
|
+
// * Redistributions in binary form must reproduce the above
|
13
|
+
// copyright notice, this list of conditions and the following disclaimer
|
14
|
+
// in the documentation and/or other materials provided with the
|
15
|
+
// distribution.
|
16
|
+
// * Neither the name of Google Inc. nor the names of its
|
17
|
+
// contributors may be used to endorse or promote products derived from
|
18
|
+
// this software without specific prior written permission.
|
19
|
+
//
|
20
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
//
|
32
|
+
// Author: wan@google.com (Zhanyong Wan)
|
33
|
+
|
34
|
+
// Type utilities needed for implementing typed and type-parameterized
|
35
|
+
// tests. This file is generated by a SCRIPT. DO NOT EDIT BY HAND!
|
36
|
+
//
|
37
|
+
// Currently we support at most $n types in a list, and at most $n
|
38
|
+
// type-parameterized tests in one type-parameterized test case.
|
39
|
+
// Please contact googletestframework@googlegroups.com if you need
|
40
|
+
// more.
|
41
|
+
|
42
|
+
#ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
|
43
|
+
#define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
|
44
|
+
|
45
|
+
#include "gtest/internal/gtest-port.h"
|
46
|
+
|
47
|
+
// #ifdef __GNUC__ is too general here. It is possible to use gcc without using
|
48
|
+
// libstdc++ (which is where cxxabi.h comes from).
|
49
|
+
# if GTEST_HAS_CXXABI_H_
|
50
|
+
# include <cxxabi.h>
|
51
|
+
# elif defined(__HP_aCC)
|
52
|
+
# include <acxx_demangle.h>
|
53
|
+
# endif // GTEST_HASH_CXXABI_H_
|
54
|
+
|
55
|
+
namespace testing {
|
56
|
+
namespace internal {
|
57
|
+
|
58
|
+
// GetTypeName<T>() returns a human-readable name of type T.
|
59
|
+
// NB: This function is also used in Google Mock, so don't move it inside of
|
60
|
+
// the typed-test-only section below.
|
61
|
+
template <typename T>
|
62
|
+
std::string GetTypeName() {
|
63
|
+
# if GTEST_HAS_RTTI
|
64
|
+
|
65
|
+
const char* const name = typeid(T).name();
|
66
|
+
# if GTEST_HAS_CXXABI_H_ || defined(__HP_aCC)
|
67
|
+
int status = 0;
|
68
|
+
// gcc's implementation of typeid(T).name() mangles the type name,
|
69
|
+
// so we have to demangle it.
|
70
|
+
# if GTEST_HAS_CXXABI_H_
|
71
|
+
using abi::__cxa_demangle;
|
72
|
+
# endif // GTEST_HAS_CXXABI_H_
|
73
|
+
char* const readable_name = __cxa_demangle(name, 0, 0, &status);
|
74
|
+
const std::string name_str(status == 0 ? readable_name : name);
|
75
|
+
free(readable_name);
|
76
|
+
return name_str;
|
77
|
+
# else
|
78
|
+
return name;
|
79
|
+
# endif // GTEST_HAS_CXXABI_H_ || __HP_aCC
|
80
|
+
|
81
|
+
# else
|
82
|
+
|
83
|
+
return "<type>";
|
84
|
+
|
85
|
+
# endif // GTEST_HAS_RTTI
|
86
|
+
}
|
87
|
+
|
88
|
+
#if GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
89
|
+
|
90
|
+
// AssertyTypeEq<T1, T2>::type is defined iff T1 and T2 are the same
|
91
|
+
// type. This can be used as a compile-time assertion to ensure that
|
92
|
+
// two types are equal.
|
93
|
+
|
94
|
+
template <typename T1, typename T2>
|
95
|
+
struct AssertTypeEq;
|
96
|
+
|
97
|
+
template <typename T>
|
98
|
+
struct AssertTypeEq<T, T> {
|
99
|
+
typedef bool type;
|
100
|
+
};
|
101
|
+
|
102
|
+
// A unique type used as the default value for the arguments of class
|
103
|
+
// template Types. This allows us to simulate variadic templates
|
104
|
+
// (e.g. Types<int>, Type<int, double>, and etc), which C++ doesn't
|
105
|
+
// support directly.
|
106
|
+
struct None {};
|
107
|
+
|
108
|
+
// The following family of struct and struct templates are used to
|
109
|
+
// represent type lists. In particular, TypesN<T1, T2, ..., TN>
|
110
|
+
// represents a type list with N types (T1, T2, ..., and TN) in it.
|
111
|
+
// Except for Types0, every struct in the family has two member types:
|
112
|
+
// Head for the first type in the list, and Tail for the rest of the
|
113
|
+
// list.
|
114
|
+
|
115
|
+
// The empty type list.
|
116
|
+
struct Types0 {};
|
117
|
+
|
118
|
+
// Type lists of length 1, 2, 3, and so on.
|
119
|
+
|
120
|
+
template <typename T1>
|
121
|
+
struct Types1 {
|
122
|
+
typedef T1 Head;
|
123
|
+
typedef Types0 Tail;
|
124
|
+
};
|
125
|
+
|
126
|
+
$range i 2..n
|
127
|
+
|
128
|
+
$for i [[
|
129
|
+
$range j 1..i
|
130
|
+
$range k 2..i
|
131
|
+
template <$for j, [[typename T$j]]>
|
132
|
+
struct Types$i {
|
133
|
+
typedef T1 Head;
|
134
|
+
typedef Types$(i-1)<$for k, [[T$k]]> Tail;
|
135
|
+
};
|
136
|
+
|
137
|
+
|
138
|
+
]]
|
139
|
+
|
140
|
+
} // namespace internal
|
141
|
+
|
142
|
+
// We don't want to require the users to write TypesN<...> directly,
|
143
|
+
// as that would require them to count the length. Types<...> is much
|
144
|
+
// easier to write, but generates horrible messages when there is a
|
145
|
+
// compiler error, as gcc insists on printing out each template
|
146
|
+
// argument, even if it has the default value (this means Types<int>
|
147
|
+
// will appear as Types<int, None, None, ..., None> in the compiler
|
148
|
+
// errors).
|
149
|
+
//
|
150
|
+
// Our solution is to combine the best part of the two approaches: a
|
151
|
+
// user would write Types<T1, ..., TN>, and Google Test will translate
|
152
|
+
// that to TypesN<T1, ..., TN> internally to make error messages
|
153
|
+
// readable. The translation is done by the 'type' member of the
|
154
|
+
// Types template.
|
155
|
+
|
156
|
+
$range i 1..n
|
157
|
+
template <$for i, [[typename T$i = internal::None]]>
|
158
|
+
struct Types {
|
159
|
+
typedef internal::Types$n<$for i, [[T$i]]> type;
|
160
|
+
};
|
161
|
+
|
162
|
+
template <>
|
163
|
+
struct Types<$for i, [[internal::None]]> {
|
164
|
+
typedef internal::Types0 type;
|
165
|
+
};
|
166
|
+
|
167
|
+
$range i 1..n-1
|
168
|
+
$for i [[
|
169
|
+
$range j 1..i
|
170
|
+
$range k i+1..n
|
171
|
+
template <$for j, [[typename T$j]]>
|
172
|
+
struct Types<$for j, [[T$j]]$for k[[, internal::None]]> {
|
173
|
+
typedef internal::Types$i<$for j, [[T$j]]> type;
|
174
|
+
};
|
175
|
+
|
176
|
+
]]
|
177
|
+
|
178
|
+
namespace internal {
|
179
|
+
|
180
|
+
# define GTEST_TEMPLATE_ template <typename T> class
|
181
|
+
|
182
|
+
// The template "selector" struct TemplateSel<Tmpl> is used to
|
183
|
+
// represent Tmpl, which must be a class template with one type
|
184
|
+
// parameter, as a type. TemplateSel<Tmpl>::Bind<T>::type is defined
|
185
|
+
// as the type Tmpl<T>. This allows us to actually instantiate the
|
186
|
+
// template "selected" by TemplateSel<Tmpl>.
|
187
|
+
//
|
188
|
+
// This trick is necessary for simulating typedef for class templates,
|
189
|
+
// which C++ doesn't support directly.
|
190
|
+
template <GTEST_TEMPLATE_ Tmpl>
|
191
|
+
struct TemplateSel {
|
192
|
+
template <typename T>
|
193
|
+
struct Bind {
|
194
|
+
typedef Tmpl<T> type;
|
195
|
+
};
|
196
|
+
};
|
197
|
+
|
198
|
+
# define GTEST_BIND_(TmplSel, T) \
|
199
|
+
TmplSel::template Bind<T>::type
|
200
|
+
|
201
|
+
// A unique struct template used as the default value for the
|
202
|
+
// arguments of class template Templates. This allows us to simulate
|
203
|
+
// variadic templates (e.g. Templates<int>, Templates<int, double>,
|
204
|
+
// and etc), which C++ doesn't support directly.
|
205
|
+
template <typename T>
|
206
|
+
struct NoneT {};
|
207
|
+
|
208
|
+
// The following family of struct and struct templates are used to
|
209
|
+
// represent template lists. In particular, TemplatesN<T1, T2, ...,
|
210
|
+
// TN> represents a list of N templates (T1, T2, ..., and TN). Except
|
211
|
+
// for Templates0, every struct in the family has two member types:
|
212
|
+
// Head for the selector of the first template in the list, and Tail
|
213
|
+
// for the rest of the list.
|
214
|
+
|
215
|
+
// The empty template list.
|
216
|
+
struct Templates0 {};
|
217
|
+
|
218
|
+
// Template lists of length 1, 2, 3, and so on.
|
219
|
+
|
220
|
+
template <GTEST_TEMPLATE_ T1>
|
221
|
+
struct Templates1 {
|
222
|
+
typedef TemplateSel<T1> Head;
|
223
|
+
typedef Templates0 Tail;
|
224
|
+
};
|
225
|
+
|
226
|
+
$range i 2..n
|
227
|
+
|
228
|
+
$for i [[
|
229
|
+
$range j 1..i
|
230
|
+
$range k 2..i
|
231
|
+
template <$for j, [[GTEST_TEMPLATE_ T$j]]>
|
232
|
+
struct Templates$i {
|
233
|
+
typedef TemplateSel<T1> Head;
|
234
|
+
typedef Templates$(i-1)<$for k, [[T$k]]> Tail;
|
235
|
+
};
|
236
|
+
|
237
|
+
|
238
|
+
]]
|
239
|
+
|
240
|
+
// We don't want to require the users to write TemplatesN<...> directly,
|
241
|
+
// as that would require them to count the length. Templates<...> is much
|
242
|
+
// easier to write, but generates horrible messages when there is a
|
243
|
+
// compiler error, as gcc insists on printing out each template
|
244
|
+
// argument, even if it has the default value (this means Templates<list>
|
245
|
+
// will appear as Templates<list, NoneT, NoneT, ..., NoneT> in the compiler
|
246
|
+
// errors).
|
247
|
+
//
|
248
|
+
// Our solution is to combine the best part of the two approaches: a
|
249
|
+
// user would write Templates<T1, ..., TN>, and Google Test will translate
|
250
|
+
// that to TemplatesN<T1, ..., TN> internally to make error messages
|
251
|
+
// readable. The translation is done by the 'type' member of the
|
252
|
+
// Templates template.
|
253
|
+
|
254
|
+
$range i 1..n
|
255
|
+
template <$for i, [[GTEST_TEMPLATE_ T$i = NoneT]]>
|
256
|
+
struct Templates {
|
257
|
+
typedef Templates$n<$for i, [[T$i]]> type;
|
258
|
+
};
|
259
|
+
|
260
|
+
template <>
|
261
|
+
struct Templates<$for i, [[NoneT]]> {
|
262
|
+
typedef Templates0 type;
|
263
|
+
};
|
264
|
+
|
265
|
+
$range i 1..n-1
|
266
|
+
$for i [[
|
267
|
+
$range j 1..i
|
268
|
+
$range k i+1..n
|
269
|
+
template <$for j, [[GTEST_TEMPLATE_ T$j]]>
|
270
|
+
struct Templates<$for j, [[T$j]]$for k[[, NoneT]]> {
|
271
|
+
typedef Templates$i<$for j, [[T$j]]> type;
|
272
|
+
};
|
273
|
+
|
274
|
+
]]
|
275
|
+
|
276
|
+
// The TypeList template makes it possible to use either a single type
|
277
|
+
// or a Types<...> list in TYPED_TEST_CASE() and
|
278
|
+
// INSTANTIATE_TYPED_TEST_CASE_P().
|
279
|
+
|
280
|
+
template <typename T>
|
281
|
+
struct TypeList {
|
282
|
+
typedef Types1<T> type;
|
283
|
+
};
|
284
|
+
|
285
|
+
|
286
|
+
$range i 1..n
|
287
|
+
template <$for i, [[typename T$i]]>
|
288
|
+
struct TypeList<Types<$for i, [[T$i]]> > {
|
289
|
+
typedef typename Types<$for i, [[T$i]]>::type type;
|
290
|
+
};
|
291
|
+
|
292
|
+
#endif // GTEST_HAS_TYPED_TEST || GTEST_HAS_TYPED_TEST_P
|
293
|
+
|
294
|
+
} // namespace internal
|
295
|
+
} // namespace testing
|
296
|
+
|
297
|
+
#endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_TYPE_UTIL_H_
|
Binary file
|
Binary file
|
data/ext/UiaDll/UiaDll.sln
CHANGED
@@ -5,6 +5,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UiaDll", "UiaDll\UiaDll.vcx
|
|
5
5
|
EndProject
|
6
6
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIA.Helper", "UIA.Helper\UIA.Helper.csproj", "{C2D567A8-B059-41A8-B9F5-FF4F8F961C1F}"
|
7
7
|
EndProject
|
8
|
+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UiaDll.Test", "UiaDll.Test\UiaDll.Test.vcxproj", "{E83CF3F7-74C6-4333-89E3-36C6297F0A06}"
|
9
|
+
ProjectSection(ProjectDependencies) = postProject
|
10
|
+
{16531A20-39FB-4BDB-8F1C-E2D619BBCF58} = {16531A20-39FB-4BDB-8F1C-E2D619BBCF58}
|
11
|
+
EndProjectSection
|
12
|
+
EndProject
|
8
13
|
Global
|
9
14
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
10
15
|
Debug|Any CPU = Debug|Any CPU
|
@@ -35,6 +40,16 @@ Global
|
|
35
40
|
{C2D567A8-B059-41A8-B9F5-FF4F8F961C1F}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
|
36
41
|
{C2D567A8-B059-41A8-B9F5-FF4F8F961C1F}.Release|Mixed Platforms.Build.0 = Release|Any CPU
|
37
42
|
{C2D567A8-B059-41A8-B9F5-FF4F8F961C1F}.Release|Win32.ActiveCfg = Release|Any CPU
|
43
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Debug|Any CPU.ActiveCfg = Debug|Win32
|
44
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
|
45
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Debug|Mixed Platforms.Build.0 = Debug|Win32
|
46
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Debug|Win32.ActiveCfg = Debug|Win32
|
47
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Debug|Win32.Build.0 = Debug|Win32
|
48
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Release|Any CPU.ActiveCfg = Release|Win32
|
49
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Release|Mixed Platforms.ActiveCfg = Debug|Win32
|
50
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Release|Mixed Platforms.Build.0 = Debug|Win32
|
51
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Release|Win32.ActiveCfg = Release|Win32
|
52
|
+
{E83CF3F7-74C6-4333-89E3-36C6297F0A06}.Release|Win32.Build.0 = Release|Win32
|
38
53
|
EndGlobalSection
|
39
54
|
GlobalSection(SolutionProperties) = preSolution
|
40
55
|
HideSolutionNode = FALSE
|
@@ -2,7 +2,25 @@
|
|
2
2
|
ref class ArrayHelper
|
3
3
|
{
|
4
4
|
public:
|
5
|
-
static array<int>^ ToArray(const int items[], const int length)
|
6
|
-
|
5
|
+
static array<int>^ ToArray(const int items[], const int length)
|
6
|
+
{
|
7
|
+
auto managedItems = gcnew array<int>(length);
|
8
|
+
for(auto index = 0; index < length; ++index) {
|
9
|
+
managedItems[index] = items[index];
|
10
|
+
}
|
11
|
+
return managedItems;
|
12
|
+
}
|
13
|
+
|
14
|
+
static int* FromArray(array<int>^ items)
|
15
|
+
{
|
16
|
+
auto unmanagedArray = new int[items->Length];
|
17
|
+
|
18
|
+
auto index = 0;
|
19
|
+
for each(auto item in items) {
|
20
|
+
unmanagedArray[index++] = item;
|
21
|
+
}
|
22
|
+
|
23
|
+
return unmanagedArray;
|
24
|
+
}
|
7
25
|
};
|
8
26
|
|
@@ -29,6 +29,16 @@ extern "C" {
|
|
29
29
|
return NULL;
|
30
30
|
}
|
31
31
|
|
32
|
+
__declspec(dllexport) PElementInformation Element_FindByProcessId(const int processId, char* errorInfo, const int errorLength) {
|
33
|
+
try {
|
34
|
+
return new ElementInformation(Element::ByProcessId(processId));
|
35
|
+
} catch(Exception^ error) {
|
36
|
+
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
37
|
+
}
|
38
|
+
|
39
|
+
return NULL;
|
40
|
+
}
|
41
|
+
|
32
42
|
__declspec(dllexport) PElementInformation Element_FindByHandle(HWND windowHandle, char* errorInfo, const int errorLength) {
|
33
43
|
try {
|
34
44
|
return new ElementInformation(Element::ByHandle(IntPtr(windowHandle)));
|
@@ -63,6 +73,14 @@ extern "C" {
|
|
63
73
|
}
|
64
74
|
}
|
65
75
|
|
76
|
+
__declspec(dllexport) PElements Element_Descendants(PElementInformation parentElement, char* errorInfo, const int errorLength) {
|
77
|
+
try {
|
78
|
+
return new Elements(Find(parentElement)->Descendants);
|
79
|
+
} catch(Exception^ error) {
|
80
|
+
StringHelper::CopyToUnmanagedString(error->Message, errorInfo, errorLength);
|
81
|
+
}
|
82
|
+
}
|
83
|
+
|
66
84
|
__declspec(dllexport) void Element_Click(PElementInformation element, char* errorInfo, const int errorLength) {
|
67
85
|
try {
|
68
86
|
Find(element)->MouseClick();
|
@@ -1,27 +1,43 @@
|
|
1
|
-
#
|
1
|
+
#pragma once
|
2
|
+
#include "ArrayHelper.h"
|
3
|
+
#include "StringHelper.h"
|
2
4
|
|
3
5
|
typedef struct _ElementInformation {
|
4
6
|
int nativeWindowHandle;
|
5
7
|
int* runtimeId;
|
6
8
|
int runtimeIdLength;
|
7
9
|
char* name;
|
10
|
+
int controlTypeId;
|
11
|
+
int* patterns;
|
12
|
+
int patternsLength;
|
13
|
+
char* id;
|
8
14
|
|
9
|
-
_ElementInformation() : name(NULL), nativeWindowHandle(0) {}
|
15
|
+
_ElementInformation() : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL) {}
|
10
16
|
|
11
|
-
_ElementInformation(Element^ element) : name(NULL), nativeWindowHandle(0) {
|
12
|
-
|
13
|
-
|
17
|
+
_ElementInformation(Element^ element) : name(NULL), nativeWindowHandle(0), runtimeId(NULL), patterns(NULL), id(NULL) {
|
18
|
+
Update(element);
|
19
|
+
}
|
20
|
+
|
21
|
+
void Update(Element^ element) {
|
22
|
+
Reset();
|
23
|
+
id = StringHelper::ToUnmanaged(element->Id);
|
24
|
+
name = StringHelper::ToUnmanaged(element->Name);
|
25
|
+
nativeWindowHandle = element->NativeWindowHandle;
|
14
26
|
runtimeId = ArrayHelper::FromArray(element->RuntimeId);
|
15
27
|
runtimeIdLength = element->RuntimeId->Length;
|
28
|
+
controlTypeId = element->ControlTypeId;
|
29
|
+
patterns = ArrayHelper::FromArray(element->SupportedPatternIds);
|
30
|
+
patternsLength = element->SupportedPatternIds->Length;
|
16
31
|
}
|
17
32
|
|
18
33
|
~_ElementInformation() {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
34
|
+
Reset();
|
35
|
+
}
|
36
|
+
|
37
|
+
private:
|
38
|
+
void Reset() {
|
39
|
+
delete[] name; delete[] runtimeId; delete[] patterns; delete[] id;
|
40
|
+
name = NULL; runtimeId = NULL; patterns = NULL; id = NULL;
|
25
41
|
}
|
26
42
|
|
27
43
|
} ElementInformation, *PElementInformation;
|
@@ -30,23 +46,19 @@ typedef struct _Elements {
|
|
30
46
|
int length;
|
31
47
|
ElementInformation* elements;
|
32
48
|
|
33
|
-
_Elements(
|
49
|
+
_Elements() : length(0), elements(NULL) {}
|
50
|
+
|
51
|
+
_Elements(array<Element^>^ elements) : elements(NULL) {
|
34
52
|
length = elements->Length;
|
35
|
-
this->elements =
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
for each(Element^ child in elements) {
|
41
|
-
auto element = new ElementInformation(child);
|
42
|
-
memcpy(&this->elements[index++], element, sizeof(ElementInformation));
|
43
|
-
}
|
53
|
+
if( length > 0 ) this->elements = new ElementInformation[length];
|
54
|
+
|
55
|
+
auto index = 0;
|
56
|
+
for each(auto element in elements) {
|
57
|
+
this->elements[index++].Update(element);
|
44
58
|
}
|
45
59
|
}
|
46
60
|
|
47
61
|
~_Elements() {
|
48
|
-
|
49
|
-
elements[index].~_ElementInformation();
|
50
|
-
}
|
62
|
+
delete[] elements;
|
51
63
|
}
|
52
64
|
} Elements, *PElements;
|