diff --git a/core/utils/image_utils.py b/core/utils/image_utils.py index 76f5ac67..18cb298d 100644 --- a/core/utils/image_utils.py +++ b/core/utils/image_utils.py @@ -105,7 +105,8 @@ def get_main_color(image_path): @staticmethod def get_text(image_path, use_cv2=True): - char_whitelist = string.digits + char_whitelist = string.whitespace + char_whitelist += string.digits char_whitelist += string.ascii_lowercase char_whitelist += string.ascii_uppercase diff --git a/core_tests/unit/utils/image_tests.py b/core_tests/unit/utils/image_tests.py index 2c9ee9fd..244866b5 100644 --- a/core_tests/unit/utils/image_tests.py +++ b/core_tests/unit/utils/image_tests.py @@ -23,6 +23,7 @@ class ImageUtilsTests(unittest.TestCase): app_image = os.path.join(current_folder, 'resources', 'app.png') app_image_ng = os.path.join(current_folder, 'resources', 'app_ng.png') app_image_ios = os.path.join(current_folder, 'resources', 'app_ios.png') + app_image_default_ios = os.path.join(current_folder, 'resources', 'app_ios_default.png') iphone_image = os.path.join(current_folder, 'resources', 'screenshot.png') unicode_image = os.path.join(current_folder, 'resources', 'unicode.png') blue = numpy.array([255, 188, 48]) @@ -43,6 +44,12 @@ def test_03_get_main_color(self): @unittest.skipIf(os.environ.get('TRAVIS', None) is not None, 'Skip on Travis.') def test_04_get_text(self): + # OCR on iOS 13 + text = ImageUtils.get_text(self.app_image_default_ios) + assert 'taps left' in text + assert 'Tap the button' in text + assert 'TAP' in text + # OCR on Hello-World app text = ImageUtils.get_text(self.app_image_ios) assert 'My App' in text diff --git a/core_tests/unit/utils/resources/app_ios_default.png b/core_tests/unit/utils/resources/app_ios_default.png new file mode 100644 index 00000000..ca2a6c1c Binary files /dev/null and b/core_tests/unit/utils/resources/app_ios_default.png differ