eyes_core 4.6.3 → 6.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +504 -0
  3. data/Rakefile +35 -0
  4. data/eyes_core.gemspec +60 -0
  5. data/lib/applitools/core/batch_info.rb +2 -0
  6. data/lib/applitools/core/classic_runner.rb +1 -3
  7. data/lib/applitools/core/eyes_base.rb +110 -22
  8. data/lib/applitools/core/eyes_base_configuration.rb +9 -1
  9. data/lib/applitools/core/eyes_runner.rb +3 -2
  10. data/lib/applitools/core/test_result_summary.rb +7 -7
  11. data/lib/applitools/core/test_results.rb +19 -3
  12. data/lib/applitools/core/universal_eyes_checks.rb +2 -1
  13. data/lib/applitools/core/universal_eyes_open.rb +5 -1
  14. data/lib/applitools/eyes_core/version.rb +10 -0
  15. data/lib/applitools/universal_sdk/universal_client.rb +26 -10
  16. data/lib/applitools/universal_sdk/universal_eyes.rb +5 -0
  17. data/lib/applitools/universal_sdk/universal_eyes_config.rb +10 -9
  18. data/lib/applitools/universal_sdk/universal_eyes_manager.rb +1 -1
  19. data/lib/eyes_core.rb +1 -3
  20. metadata +14 -58
  21. data/ext/eyes_core/extconf.rb +0 -5
  22. data/ext/eyes_core/eyes_core.c +0 -252
  23. data/ext/eyes_core/eyes_core.h +0 -28
  24. data/lib/applitools/appium/android_region_provider.rb +0 -32
  25. data/lib/applitools/appium/android_screenshot.rb +0 -21
  26. data/lib/applitools/appium/driver.rb +0 -12
  27. data/lib/applitools/appium/eyes.rb +0 -189
  28. data/lib/applitools/appium/ios_region_provider.rb +0 -25
  29. data/lib/applitools/appium/ios_screenshot.rb +0 -10
  30. data/lib/applitools/appium/region_provider.rb +0 -51
  31. data/lib/applitools/appium/screenshot.rb +0 -30
  32. data/lib/applitools/appium/target.rb +0 -240
  33. data/lib/applitools/appium/utils.rb +0 -64
  34. data/lib/applitools/calabash/calabash_element.rb +0 -64
  35. data/lib/applitools/calabash/calabash_screenshot_provider.rb +0 -83
  36. data/lib/applitools/calabash/environment_detector.rb +0 -25
  37. data/lib/applitools/calabash/eyes.rb +0 -194
  38. data/lib/applitools/calabash/eyes_calabash_android_screenshot.rb +0 -68
  39. data/lib/applitools/calabash/eyes_calabash_ios_screenshot.rb +0 -30
  40. data/lib/applitools/calabash/eyes_calabash_screenshot.rb +0 -80
  41. data/lib/applitools/calabash/eyes_hooks.rb +0 -51
  42. data/lib/applitools/calabash/eyes_settings.rb +0 -45
  43. data/lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb +0 -95
  44. data/lib/applitools/calabash/full_page_capture_algorithm/base.rb +0 -51
  45. data/lib/applitools/calabash/full_page_capture_algorithm/ios_ui_table_view.rb +0 -150
  46. data/lib/applitools/calabash/full_page_capture_algorithm.rb +0 -26
  47. data/lib/applitools/calabash/os_versions.rb +0 -25
  48. data/lib/applitools/calabash/rspec_matchers.rb +0 -25
  49. data/lib/applitools/calabash/steps/android_eyes_session.rb +0 -37
  50. data/lib/applitools/calabash/steps/android_matchers.rb +0 -36
  51. data/lib/applitools/calabash/steps/eyes_session.rb +0 -42
  52. data/lib/applitools/calabash/steps/eyes_settings.rb +0 -59
  53. data/lib/applitools/calabash/steps/ios_eyes_session.rb +0 -15
  54. data/lib/applitools/calabash/steps/ios_matchers.rb +0 -17
  55. data/lib/applitools/calabash/steps/matchers.rb +0 -71
  56. data/lib/applitools/calabash/target.rb +0 -69
  57. data/lib/applitools/calabash/utils.rb +0 -74
  58. data/lib/applitools/calabash_steps.rb +0 -16
  59. data/lib/applitools/capybara/capybara_settings.rb +0 -25
  60. data/lib/applitools/capybara/driver.rb +0 -39
  61. data/lib/applitools/rspec/target_matcher.rb +0 -25
  62. data/lib/applitools/universal_sdk/executable_finder.rb +0 -57
  63. data/lib/applitools/universal_sdk/universal_server_control.rb +0 -79
  64. data/lib/applitools/version.rb +0 -8
  65. data/lib/eyes_consts.rb +0 -4
  66. data/lib/eyes_rspec.rb +0 -4
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eyes_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.6.3
4
+ version: 6.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Applitools Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-07-05 00:00:00.000000000 Z
11
+ date: 2023-12-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 3.3.3
117
+ version: 4.3.0
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 3.3.3
124
+ version: 4.3.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: bundler
127
127
  requirement: !ruby/object:Gem::Requirement
@@ -182,16 +182,16 @@ dependencies:
182
182
  name: webdrivers
183
183
  requirement: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - ">="
185
+ - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '0'
187
+ version: '5.0'
188
188
  type: :development
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
- - - ">="
192
+ - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '0'
194
+ version: '5.0'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: pry
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -281,50 +281,12 @@ description: Don't use it directly, take a look at eyes_selenium, eyes_images or
281
281
  email:
282
282
  - team@applitools.com
283
283
  executables: []
284
- extensions:
285
- - ext/eyes_core/extconf.rb
284
+ extensions: []
286
285
  extra_rdoc_files: []
287
286
  files:
288
- - ext/eyes_core/extconf.rb
289
- - ext/eyes_core/eyes_core.c
290
- - ext/eyes_core/eyes_core.h
291
- - lib/applitools/appium/android_region_provider.rb
292
- - lib/applitools/appium/android_screenshot.rb
293
- - lib/applitools/appium/driver.rb
294
- - lib/applitools/appium/eyes.rb
295
- - lib/applitools/appium/ios_region_provider.rb
296
- - lib/applitools/appium/ios_screenshot.rb
297
- - lib/applitools/appium/region_provider.rb
298
- - lib/applitools/appium/screenshot.rb
299
- - lib/applitools/appium/target.rb
300
- - lib/applitools/appium/utils.rb
301
- - lib/applitools/calabash/calabash_element.rb
302
- - lib/applitools/calabash/calabash_screenshot_provider.rb
303
- - lib/applitools/calabash/environment_detector.rb
304
- - lib/applitools/calabash/eyes.rb
305
- - lib/applitools/calabash/eyes_calabash_android_screenshot.rb
306
- - lib/applitools/calabash/eyes_calabash_ios_screenshot.rb
307
- - lib/applitools/calabash/eyes_calabash_screenshot.rb
308
- - lib/applitools/calabash/eyes_hooks.rb
309
- - lib/applitools/calabash/eyes_settings.rb
310
- - lib/applitools/calabash/full_page_capture_algorithm.rb
311
- - lib/applitools/calabash/full_page_capture_algorithm/android_scroll_view.rb
312
- - lib/applitools/calabash/full_page_capture_algorithm/base.rb
313
- - lib/applitools/calabash/full_page_capture_algorithm/ios_ui_table_view.rb
314
- - lib/applitools/calabash/os_versions.rb
315
- - lib/applitools/calabash/rspec_matchers.rb
316
- - lib/applitools/calabash/steps/android_eyes_session.rb
317
- - lib/applitools/calabash/steps/android_matchers.rb
318
- - lib/applitools/calabash/steps/eyes_session.rb
319
- - lib/applitools/calabash/steps/eyes_settings.rb
320
- - lib/applitools/calabash/steps/ios_eyes_session.rb
321
- - lib/applitools/calabash/steps/ios_matchers.rb
322
- - lib/applitools/calabash/steps/matchers.rb
323
- - lib/applitools/calabash/target.rb
324
- - lib/applitools/calabash/utils.rb
325
- - lib/applitools/calabash_steps.rb
326
- - lib/applitools/capybara/capybara_settings.rb
327
- - lib/applitools/capybara/driver.rb
287
+ - CHANGELOG.md
288
+ - Rakefile
289
+ - eyes_core.gemspec
328
290
  - lib/applitools/connectivity/proxy.rb
329
291
  - lib/applitools/connectivity/server_connector.rb
330
292
  - lib/applitools/connectivity/user_agent_middleware.rb
@@ -382,11 +344,10 @@ files:
382
344
  - lib/applitools/core/universal_eyes_open.rb
383
345
  - lib/applitools/core/universal_new_api.rb
384
346
  - lib/applitools/extensions.rb
347
+ - lib/applitools/eyes_core/version.rb
385
348
  - lib/applitools/eyes_logger.rb
386
349
  - lib/applitools/method_tracer.rb
387
- - lib/applitools/rspec/target_matcher.rb
388
350
  - lib/applitools/sauce.rb
389
- - lib/applitools/universal_sdk/executable_finder.rb
390
351
  - lib/applitools/universal_sdk/universal_check_settings.rb
391
352
  - lib/applitools/universal_sdk/universal_client.rb
392
353
  - lib/applitools/universal_sdk/universal_client_socket.rb
@@ -395,15 +356,11 @@ files:
395
356
  - lib/applitools/universal_sdk/universal_eyes_manager.rb
396
357
  - lib/applitools/universal_sdk/universal_eyes_manager_config.rb
397
358
  - lib/applitools/universal_sdk/universal_server.rb
398
- - lib/applitools/universal_sdk/universal_server_control.rb
399
359
  - lib/applitools/utils/eyes_selenium_utils.rb
400
360
  - lib/applitools/utils/image_delta_compressor.rb
401
361
  - lib/applitools/utils/image_utils.rb
402
362
  - lib/applitools/utils/utils.rb
403
- - lib/applitools/version.rb
404
- - lib/eyes_consts.rb
405
363
  - lib/eyes_core.rb
406
- - lib/eyes_rspec.rb
407
364
  - lib/require_utils.rb
408
365
  homepage: https://www.applitools.com
409
366
  licenses:
@@ -414,7 +371,6 @@ post_install_message:
414
371
  rdoc_options: []
415
372
  require_paths:
416
373
  - lib
417
- - ext
418
374
  required_ruby_version: !ruby/object:Gem::Requirement
419
375
  requirements:
420
376
  - - ">="
@@ -426,7 +382,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
426
382
  - !ruby/object:Gem::Version
427
383
  version: '0'
428
384
  requirements: []
429
- rubygems_version: 3.3.14
385
+ rubygems_version: 3.0.3.1
430
386
  signing_key:
431
387
  specification_version: 4
432
388
  summary: Core of the Applitools Ruby SDK
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'mkmf'
4
- $CFLAGS << ' -Wall'
5
- create_makefile('eyes_core/eyes_core')
@@ -1,252 +0,0 @@
1
- #include "eyes_core.h"
2
-
3
- void Init_eyes_core() {
4
- VALUE Applitools = rb_define_module("Applitools");
5
- VALUE Resampling = rb_define_module_under(Applitools, "ResamplingFast");
6
- rb_define_method(Resampling, "resampling_first_step", c_resampling_first_step, 2);
7
- };
8
-
9
- VALUE c_resampling_first_step(VALUE self, VALUE dst_dimension_x, VALUE dst_dimension_y) {
10
- PIXEL *source, *destination;
11
- unsigned long int source_width, source_height, c_dst_dimension_x, c_dst_dimension_y, w_m, h_m;
12
- VALUE result_array;
13
-
14
- source_width = NUM2UINT(rb_funcall(self, rb_intern("width"), 0));
15
- source_height = NUM2UINT(rb_funcall(self, rb_intern("height"), 0));
16
-
17
- c_dst_dimension_x = NUM2UINT(dst_dimension_x);
18
- c_dst_dimension_y = NUM2UINT(dst_dimension_y);
19
-
20
- w_m = source_width / c_dst_dimension_x;
21
- h_m = source_height / c_dst_dimension_y;
22
-
23
- if (w_m == 0) {
24
- w_m = 1;
25
- };
26
-
27
- if (h_m == 0) {
28
- h_m = 1;
29
- };
30
-
31
- source = get_c_array(self);
32
-
33
- destination = get_bicubic_points(source, source_width, source_height, c_dst_dimension_x * w_m, c_dst_dimension_y * h_m);
34
-
35
- if (w_m * h_m > 1) {
36
- source = destination;
37
- destination = c_scale_points(source, c_dst_dimension_x, c_dst_dimension_y, w_m, h_m);
38
- }
39
-
40
- result_array = get_ruby_array(self, destination, c_dst_dimension_x * c_dst_dimension_y);
41
- free(destination);
42
- return result_array;
43
- };
44
-
45
- VALUE get_ruby_array(VALUE self, PIXEL *pixels, unsigned long int pixels_size) {
46
- VALUE result_array;
47
- unsigned long int i;
48
- result_array = rb_ary_new2(pixels_size);
49
- for (i=0; i<pixels_size; i++) {
50
- rb_ary_store(result_array, i, UINT2NUM(pixels[i]));
51
- };
52
- return result_array;
53
- }
54
-
55
- PIXEL* get_c_array(VALUE self) {
56
- unsigned long int w,h,i;
57
- PIXEL* ary;
58
- VALUE pixels;
59
-
60
- pixels = rb_funcall(self, rb_intern("pixels"), 0);
61
- w = NUM2UINT(rb_funcall(self, rb_intern("width"), 0));
62
- h = NUM2UINT(rb_funcall(self, rb_intern("height"), 0));
63
- ary = (PIXEL*)malloc( w*h*sizeof(PIXEL));
64
-
65
- for(i=0; i<w*h; i++) {
66
- ary[i] = NUM2UINT(rb_ary_entry(pixels, i));
67
- }
68
-
69
- return ary;
70
- }
71
-
72
- PIXEL raw_interpolate_cubic(double t, PIXEL p0, PIXEL p1, PIXEL p2, PIXEL p3) {
73
- BYTE new_r, new_g, new_b, new_a;
74
-
75
- new_r = interpolate_char(t, R_BYTE(p0), R_BYTE(p1), R_BYTE(p2), R_BYTE(p3));
76
- new_g = interpolate_char(t, G_BYTE(p0), G_BYTE(p1), G_BYTE(p2), G_BYTE(p3));
77
- new_b = interpolate_char(t, B_BYTE(p0), B_BYTE(p1), B_BYTE(p2), B_BYTE(p3));
78
- new_a = interpolate_char(t, A_BYTE(p0), A_BYTE(p1), A_BYTE(p2), A_BYTE(p3));
79
-
80
- return BUILD_PIXEL(new_r, new_g, new_b, new_a);
81
- }
82
-
83
- BYTE interpolate_char(double t, BYTE c0, BYTE c1, BYTE c2, BYTE c3) {
84
- double a, b, c, d, res;
85
- a = - 0.5 * c0 + 1.5 * c1 - 1.5 * c2 + 0.5 * c3;
86
- b = c0 - 2.5 * c1 + 2 * c2 - 0.5 * c3;
87
- c = 0.5 * c2 - 0.5 * c0;
88
- d = c1;
89
- res = a * t * t * t + b * t * t + c * t + d + 0.5;
90
- if(res < 0) {
91
- res = 0;
92
- } else if(res > 255) {
93
- res = 255;
94
- };
95
- return (BYTE)(res);
96
- };
97
-
98
- PIXEL raw_merge_pixels(PIXEL* merge_pixels, unsigned long int size) {
99
- unsigned long int i, real_colors, acum_r, acum_g, acum_b, acum_a;
100
- BYTE new_r, new_g, new_b, new_a;
101
- PIXEL pix;
102
-
103
- acum_r = 0;
104
- acum_g = 0;
105
- acum_b = 0;
106
- acum_a = 0;
107
-
108
- new_r = 0;
109
- new_g = 0;
110
- new_b = 0;
111
- new_a = 0;
112
-
113
- real_colors = 0;
114
-
115
- for(i=0; i < size; i++) {
116
- pix = merge_pixels[i];
117
- if(A_BYTE(pix) != 0) {
118
- acum_r += R_BYTE(pix);
119
- acum_g += G_BYTE(pix);
120
- acum_b += B_BYTE(pix);
121
- acum_a += A_BYTE(pix);
122
- real_colors += 1;
123
- };
124
- };
125
-
126
- if(real_colors > 0) {
127
- new_r = (BYTE)(acum_r/real_colors);
128
- new_g = (BYTE)(acum_g/real_colors);
129
- new_b = (BYTE)(acum_b/real_colors);
130
- };
131
- new_a = (BYTE)(acum_a/size);
132
- return BUILD_PIXEL(new_r, new_g, new_b, new_a);
133
- };
134
-
135
- void setup_steps_residues(unsigned long int *steps, double *residues,
136
- unsigned long int src_dimension, unsigned long int dst_dimension) {
137
- unsigned long int i;
138
- double step = (double) (src_dimension - 1) / (dst_dimension - 1);
139
- for(i = 0; i < dst_dimension - 1; i++) {
140
- steps[i] = (unsigned long int) i*step;
141
- residues[i] = i*step - steps[i];
142
- };
143
-
144
- steps[dst_dimension - 1] = src_dimension - 2;
145
- residues[dst_dimension - 1] = 1;
146
- };
147
-
148
- PIXEL get_line_pixel(PIXEL* source, unsigned long int line, long int pixel,
149
- unsigned long int src_dimension_x) {
150
- if(pixel >= 0 && pixel < (long int)src_dimension_x) {
151
- return source[line * src_dimension_x + pixel];
152
- } else {
153
- return 0;
154
- };
155
- };
156
-
157
- PIXEL get_column_pixel(PIXEL* source,
158
- unsigned long int column, long int pixel,
159
- unsigned long int src_dimension_y, unsigned long int src_dimension_x) {
160
-
161
- if(pixel >=0 && pixel < (long int)src_dimension_y) {
162
- return source[src_dimension_x * pixel + column];
163
- } else {
164
- return 0;
165
- };
166
- };
167
-
168
- PIXEL* get_bicubic_points(PIXEL* source_array,
169
- unsigned long int src_dimension_x, unsigned long int src_dimension_y,
170
- unsigned long int dst_dimension_x, unsigned long int dst_dimension_y) {
171
- PIXEL* dest, *source;
172
- unsigned long int index_y, index, y, x;
173
- unsigned long int* steps;
174
- double* residues;
175
-
176
- steps = (unsigned long int*) malloc(dst_dimension_x * sizeof(unsigned long int));
177
- residues = (double*) malloc(dst_dimension_x * sizeof(double));
178
- setup_steps_residues(steps, residues, src_dimension_x, dst_dimension_x);
179
-
180
- source = source_array;
181
- dest = (PIXEL*)malloc( src_dimension_y*dst_dimension_x*sizeof(PIXEL) );
182
-
183
- for (y=0; y < src_dimension_y; y++) {
184
- index_y = dst_dimension_x * y;
185
- for (x=0; x < dst_dimension_x; x++) {
186
- index = index_y + x;
187
- dest[index] = raw_interpolate_cubic(residues[x],
188
- get_line_pixel(source, y, steps[x] - 1, src_dimension_x),
189
- get_line_pixel(source, y, steps[x], src_dimension_x),
190
- get_line_pixel(source, y, steps[x] + 1, src_dimension_x),
191
- get_line_pixel(source, y, steps[x] + 2, src_dimension_x)
192
- );
193
- };
194
- };
195
-
196
- steps = realloc(steps, dst_dimension_y * sizeof(unsigned long int));
197
- residues = realloc(residues, dst_dimension_y * sizeof(double));
198
- setup_steps_residues(steps, residues, src_dimension_y, dst_dimension_y);
199
-
200
- free(source);
201
- source = dest;
202
- dest = (PIXEL*)malloc( dst_dimension_x * dst_dimension_y * sizeof(PIXEL));
203
-
204
- for (y=0; y < dst_dimension_x; y++) {
205
- for (x=0; x < dst_dimension_y; x++) {
206
- index = dst_dimension_x * x + y;
207
- dest[index] = raw_interpolate_cubic(residues[x],
208
- get_column_pixel(source, y, steps[x] - 1, src_dimension_y, dst_dimension_x),
209
- get_column_pixel(source, y, steps[x], src_dimension_y, dst_dimension_x),
210
- get_column_pixel(source, y, steps[x] + 1, src_dimension_y, dst_dimension_x),
211
- get_column_pixel(source, y, steps[x] + 2, src_dimension_y, dst_dimension_x)
212
- );
213
- };
214
- };
215
-
216
- free(source);
217
- free(steps);
218
- free(residues);
219
-
220
- return dest;
221
- };
222
-
223
- PIXEL* c_scale_points(PIXEL* source, unsigned long int dst_width, unsigned long int dst_height,
224
- unsigned long int w_m, unsigned long int h_m) {
225
-
226
- unsigned long int y_pos, x_pos, index, i, j, x, y, buffer_size, buffer_index;
227
- PIXEL* pixels_to_merge;
228
- PIXEL* result;
229
-
230
- pixels_to_merge = malloc(w_m*h_m*sizeof(PIXEL));
231
- result = malloc(dst_width * dst_height * sizeof(PIXEL));
232
-
233
- buffer_size = h_m * w_m;
234
-
235
- for (i = 0; i < dst_height; i++) {
236
- for (j = 0; j < dst_width; j++) {
237
- buffer_index = 0;
238
- for (y = 0; y < h_m; y++) {
239
- y_pos = i * h_m + y;
240
- for (x = 0; x < w_m; x++) {
241
- x_pos = j * w_m + x;
242
- pixels_to_merge[buffer_index++] = source[dst_width * w_m * y_pos + x_pos];
243
- };
244
- };
245
- index = i * dst_width + j;
246
- result[index] = raw_merge_pixels(pixels_to_merge, buffer_size);
247
-
248
- };
249
- };
250
- free(source);
251
- return result;
252
- };
@@ -1,28 +0,0 @@
1
- #ifndef APPLITOOLS_RESAMPLING_EXT
2
- #define APPLITOOLS_RESAMPLING_EXT
3
- #include "ruby.h"
4
-
5
- typedef uint32_t PIXEL; // Pixels use 32 bits unsigned integers
6
- typedef unsigned char BYTE; // Bytes use 8 bits unsigned integers
7
-
8
- #define R_BYTE(pixel) ((BYTE) (((pixel) & (PIXEL) 0xff000000) >> 24))
9
- #define G_BYTE(pixel) ((BYTE) (((pixel) & (PIXEL) 0x00ff0000) >> 16))
10
- #define B_BYTE(pixel) ((BYTE) (((pixel) & (PIXEL) 0x0000ff00) >> 8))
11
- #define A_BYTE(pixel) ((BYTE) (((pixel) & (PIXEL) 0x000000ff)))
12
-
13
- #define BUILD_PIXEL(r, g, b, a) (((PIXEL) (r) << 24) + ((PIXEL) (g) << 16) + ((PIXEL) (b) << 8) + (PIXEL) (a))
14
- #define INT8_MULTIPLY(a, b) (((((a) * (b) + 0x80) >> 8) + ((a) * (b) + 0x80)) >> 8)
15
-
16
- BYTE interpolate_char(double, BYTE, BYTE, BYTE, BYTE);
17
-
18
- PIXEL* get_bicubic_points(PIXEL*, unsigned long int, unsigned long int, unsigned long int, unsigned long int);
19
-
20
- PIXEL* get_c_array(VALUE);
21
- VALUE c_resampling_first_step(VALUE, VALUE, VALUE);
22
- VALUE get_ruby_array(VALUE, PIXEL*, unsigned long int);
23
- PIXEL get_line_pixel(PIXEL*, unsigned long int, long int, unsigned long int);
24
- PIXEL get_column_pixel(PIXEL*, unsigned long int, long int, unsigned long int, unsigned long int);
25
- PIXEL raw_merge_pixels(PIXEL*, unsigned long int);
26
- PIXEL* c_scale_points(PIXEL*, unsigned long int, unsigned long int, unsigned long int, unsigned long int);
27
-
28
- #endif
@@ -1,32 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'region_provider'
4
- module Applitools
5
- module Appium
6
- class AndroidRegionProvider < ::Applitools::Appium::RegionProvider
7
- private
8
-
9
- def convert_element_coordinates
10
- Applitools::Region.from_location_size(eye_region.location, eye_region.size)
11
- end
12
-
13
- def convert_viewport_rect_coordinates
14
- region = viewport_rect
15
-
16
- session_info = Applitools::Appium::Utils.session_capabilities(driver)
17
- if session_info['deviceScreenSize']
18
- device_height = session_info['deviceScreenSize'].split('x').last.to_i
19
- system_bars_height = driver.get_system_bars.map {|_,v| v['height'] }.sum
20
- region['height'] = device_height - system_bars_height
21
- end
22
-
23
- Applitools::Region.new(
24
- region['left'],
25
- region['top'],
26
- region['width'],
27
- region['height']
28
- )
29
- end
30
- end
31
- end
32
- end
@@ -1,21 +0,0 @@
1
- require_relative './screenshot.rb'
2
- module Applitools
3
- module Appium
4
- class AndroidScreenshot < Applitools::Appium::Screenshot
5
- def convert_region_location(region, from, to)
6
- # converted_size = region.size.dup.scale_it!(1 / device_pixel_ratio)
7
- # converted_location = region.location.dup.offset_negative(Applitools::Location.new(0, status_bar_height)).scale_it!(1 / device_pixel_ratio)
8
- # Applitools::Region.from_location_size(converted_location, converted_size)
9
- Applitools::Region.from_location_size(
10
- convert_location(region.location, nil, nil),
11
- region.size
12
- ).scale_it!(1.to_f / device_pixel_ratio)
13
- end
14
-
15
- def convert_location(location, _from, _to)
16
- location.offset_negative(Applitools::Location.new(0, status_bar_height))
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Applitools::Appium
4
- class Driver < Applitools::Selenium::Driver
5
- def initialize(eyes, options)
6
- super(eyes, options)
7
- end
8
- module AppiumLib
9
- extend self
10
- end
11
- end
12
- end
@@ -1,189 +0,0 @@
1
- # frozen_string_literal: false
2
-
3
- class Applitools::Appium::Eyes < Applitools::Selenium::SeleniumEyes
4
- attr_accessor :status_bar_height
5
-
6
- def perform_driver_settings_for_appium_driver
7
- self.region_visibility_strategy = Applitools::Selenium::NopRegionVisibilityStrategy.new
8
- self.force_driver_resolution_as_viewport_size = true
9
- end
10
-
11
- def initialize(*args)
12
- super
13
- self.dont_get_title = true
14
- self.runner = Applitools::ClassicRunner.new unless runner
15
- self.base_agent_id = "eyes.appium.ruby/#{Applitools::VERSION}".freeze
16
- self.status_bar_height = 0
17
- self.utils = Applitools::Appium::Utils
18
- end
19
-
20
- private :perform_driver_settings_for_appium_driver
21
-
22
- def check(*args)
23
- args.compact!
24
- case (first_arg = args.shift)
25
- when String
26
- name = first_arg
27
- target = args.shift
28
- when Applitools::Selenium::Target
29
- target = first_arg
30
- when Hash
31
- target = first_arg[:target]
32
- name = first_arg[:name] || first_arg[:tag]
33
- end
34
-
35
- logger.info "check(#{name}) is called"
36
- self.tag_for_debug = name
37
- Applitools::ArgumentGuard.one_of? target, 'target', [Applitools::Selenium::Target, Applitools::Appium::Target]
38
-
39
- # target.fully(false) if target.options[:stitch_content].nil?
40
-
41
- return universal_check(name, target)
42
- return check_native(name, target) if native_app?
43
- super
44
- end
45
-
46
- attr_accessor :eyes_element_to_check, :region_provider
47
- private :eyes_element_to_check, :eyes_element_to_check=, :region_provider, :region_provider=
48
-
49
- def check_native(name, target)
50
- logger.info "check_native(#{name}) is called"
51
- update_scaling_params
52
- target_to_check = target.finalize
53
- match_data = Applitools::MatchWindowData.new(default_match_settings)
54
- match_data.tag = name
55
- timeout = target_to_check.options[:timeout] || USE_DEFAULT_MATCH_TIMEOUT
56
-
57
- eyes_element = target_to_check.region_to_check.call(driver)
58
- self.eyes_element_to_check = eyes_element
59
- region_provider = region_provider_class.new(driver, eyes_element)
60
- match_data.read_target(target_to_check, driver)
61
-
62
- check_window_base(
63
- region_provider, timeout, match_data
64
- )
65
- end
66
-
67
- def native_app?
68
- return true if driver.current_context == 'NATIVE_APP'
69
- false
70
- end
71
-
72
- def capture_screenshot
73
- logger.info 'Getting screenshot (capture_screenshot() has been invoked)'
74
- case eyes_element_to_check
75
- when Applitools::Region
76
- viewport_screenshot
77
- when Selenium::WebDriver::Element, Applitools::Selenium::Element
78
- element_screenshot
79
- end
80
- end
81
-
82
- def get_app_output_with_screenshot(*args)
83
- result = super do |screenshot|
84
- if scale_provider
85
- scaled_image = scale_provider.scale_image(screenshot.image)
86
- self.screenshot = screenshot_class.new(
87
- Applitools::Screenshot.from_image(
88
- case scaled_image
89
- # when ChunkyPNG::Image
90
- # scaled_image
91
- when Applitools::Screenshot::Datastream
92
- scaled_image.image
93
- else
94
- raise Applitools::EyesError.new('Unknown image format after scale!')
95
- end
96
- ),
97
- status_bar_height: self.utils.status_bar_height(driver),
98
- device_pixel_ratio: self.utils.device_pixel_ratio(driver)
99
- )
100
- end
101
- end
102
- self.screenshot_url = nil
103
- result
104
- end
105
-
106
- def dom_data
107
- {}
108
- end
109
-
110
- def check_window(tag = nil, match_timeout = USE_DEFAULT_MATCH_TIMEOUT)
111
- target = Applitools::Appium::Target.window.tap do |t|
112
- t.timeout(match_timeout)
113
- end
114
- check(tag, target)
115
- end
116
-
117
- def check_region(*args)
118
- options = { timeout: USE_DEFAULT_MATCH_TIMEOUT, tag: nil }.merge! Applitools::Utils.extract_options!(args)
119
- target = Applitools::Appium::Target.new.region(*args).timeout(options[:match_timeout])
120
- check(options[:tag], target)
121
- end
122
-
123
- def set_mobile_capabilities(nmg_caps, nml_api_key, eyes_server_url, proxy_settings)
124
- new_caps = {}
125
-
126
- if nml_api_key.nil? || nml_api_key.empty?
127
- nml_api_key = ENV['APPLITOOLS_API_KEY']
128
- if nml_api_key.nil? || nml_api_key.empty?
129
- raise Applitools::EyesError.new('No API key was given, or is an empty string.')
130
- end
131
- end
132
- new_caps[:NML_API_KEY] = nml_api_key
133
-
134
- if eyes_server_url.nil? || eyes_server_url.empty?
135
- eyes_server_url = ENV['APPLITOOLS_SERVER_URL']
136
- end
137
- new_caps[:NML_SERVER_URL] = eyes_server_url if eyes_server_url
138
-
139
- if proxy_settings.nil? || proxy_settings.empty?
140
- proxy_settings = ENV['APPLITOOLS_HTTP_PROXY']
141
- end
142
- new_caps[:NML_PROXY_URL] = proxy_settings if proxy_settings
143
-
144
- nmg_caps[:optionalIntentArguments] = "--es APPLITOOLS '" + new_caps.to_json + "'"
145
- nmg_caps[:processArguments] = {
146
- args: [],
147
- env: new_caps.merge(DYLD_INSERT_LIBRARIES: "@executable_path/Frameworks/UFG_lib.xcframework/ios-arm64/UFG_lib.framework/UFG_lib:@executable_path/Frameworks/UFG_lib.xcframework/ios-arm64_x86_64-simulator/UFG_lib.framework/UFG_lib")
148
- }
149
- end
150
-
151
- alias set_nmg_capabilities set_mobile_capabilities
152
-
153
- def use_system_screenshot(value = true)
154
- self.screenshot_mode = !value ? 'applitools-lib' : 'default'
155
- self
156
- end
157
-
158
- private
159
-
160
- def viewport_screenshot
161
- logger.info 'Viewport screenshot requested...'
162
- obtain_viewport_screenshot
163
- end
164
-
165
- def element_screenshot
166
- logger.info 'Element screenshot requested...'
167
- obtain_viewport_screenshot
168
- end
169
-
170
- def obtain_viewport_screenshot
171
- self.screenshot = screenshot_class.new(
172
- Applitools::Screenshot.from_datastream(driver.screenshot_as(:png)),
173
- status_bar_height: self.utils.status_bar_height(driver),
174
- device_pixel_ratio: self.utils.device_pixel_ratio(driver)
175
- )
176
- end
177
-
178
- def screenshot_class
179
- return Applitools::Appium::IosScreenshot if self.utils.ios?(Applitools::Appium::Driver::AppiumLib)
180
- return Applitools::Appium::AndroidScreenshot if self.utils.android?(Applitools::Appium::Driver::AppiumLib)
181
- raise Applitools::EyesError, 'Unknown device type'
182
- end
183
-
184
- def region_provider_class
185
- return Applitools::Appium::IosRegionProvider if self.utils.ios?(Applitools::Appium::Driver::AppiumLib)
186
- return Applitools::Appium::AndroidRegionProvider if self.utils.android?(Applitools::Appium::Driver::AppiumLib)
187
- raise Applitools::EyesError, 'Unknown device type'
188
- end
189
- end