@@ -65,14 +65,17 @@ def match_images_features(first_image:,
65
65
good_matches_factor : nil ,
66
66
visualize : false )
67
67
unless MATCH_FEATURES [ :detector_name ] . member? ( detector_name . to_s )
68
- raise "detector_name should be #{ MATCH_FEATURES [ :detector_name ] } "
68
+ raise :: Appium :: Core :: Error :: ArgumentError , "detector_name should be #{ MATCH_FEATURES [ :detector_name ] } "
69
69
end
70
70
71
71
unless MATCH_FEATURES [ :match_func ] . member? ( match_func . to_s )
72
- raise "match_func should be #{ MATCH_FEATURES [ :match_func ] } "
72
+ raise :: Appium :: Core :: Error :: ArgumentError , "match_func should be #{ MATCH_FEATURES [ :match_func ] } "
73
73
end
74
74
75
- raise "visualize should be #{ MATCH_FEATURES [ :visualize ] } " unless MATCH_FEATURES [ :visualize ] . member? ( visualize )
75
+ unless MATCH_FEATURES [ :visualize ] . member? ( visualize )
76
+ raise ::Appium ::Core ::Error ::ArgumentError ,
77
+ "visualize should be #{ MATCH_FEATURES [ :visualize ] } "
78
+ end
76
79
77
80
options = { }
78
81
options [ :detectorName ] = detector_name . to_s . upcase
@@ -109,7 +112,10 @@ def match_images_features(first_image:,
109
112
#
110
113
def find_image_occurrence ( full_image :, partial_image :, visualize : false , threshold : nil ,
111
114
multiple : nil , match_neighbour_threshold : nil )
112
- raise "visualize should be #{ MATCH_TEMPLATE [ :visualize ] } " unless MATCH_TEMPLATE [ :visualize ] . member? ( visualize )
115
+ unless MATCH_TEMPLATE [ :visualize ] . member? ( visualize )
116
+ raise ::Appium ::Core ::Error ::ArgumentError ,
117
+ "visualize should be #{ MATCH_TEMPLATE [ :visualize ] } "
118
+ end
113
119
114
120
options = { }
115
121
options [ :visualize ] = visualize
@@ -136,7 +142,10 @@ def find_image_occurrence(full_image:, partial_image:, visualize: false, thresho
136
142
# File.write 'images_similarity_visual.png', Base64.decode64(visual['visualization']) # if the image is PNG
137
143
#
138
144
def get_images_similarity ( first_image :, second_image :, visualize : false )
139
- raise "visualize should be #{ GET_SIMILARITY [ :visualize ] } " unless GET_SIMILARITY [ :visualize ] . member? ( visualize )
145
+ unless GET_SIMILARITY [ :visualize ] . member? ( visualize )
146
+ raise ::Appium ::Core ::Error ::ArgumentError ,
147
+ "visualize should be #{ GET_SIMILARITY [ :visualize ] } "
148
+ end
140
149
141
150
options = { }
142
151
options [ :visualize ] = visualize
@@ -158,7 +167,7 @@ def get_images_similarity(first_image:, second_image:, visualize: false)
158
167
# See the documentation on +appium-support+ module for more details.
159
168
#
160
169
def compare_images ( mode : :matchFeatures , first_image :, second_image :, options : nil )
161
- raise "content_type should be #{ MODE } " unless MODE . member? ( mode )
170
+ raise :: Appium :: Core :: Error :: ArgumentError , "content_type should be #{ MODE } " unless MODE . member? ( mode )
162
171
163
172
params = { }
164
173
params [ :mode ] = mode
0 commit comments