self.assertEqual(width, 1120)
self.assertEqual(height, 832)
- @skipUnless(tesseract_available(3), 'tesseract v3 OCR tool not available')
- def test_bootrom_framebuffer_ocr_with_tesseract_v3(self):
- screenshot_path = os.path.join(self.workdir, "dump.ppm")
- self.check_bootrom_framebuffer(screenshot_path)
- lines = tesseract_ocr(screenshot_path, tesseract_version=3)
- text = '\n'.join(lines)
- self.assertIn('Backplane', text)
- self.assertIn('Ethernet address', text)
-
# Tesseract 4 adds a new OCR engine based on LSTM neural networks. The
# new version is faster and more accurate than version 3. The drawback is
# that it is still alpha-level software.
- @skipUnless(tesseract_available(4), 'tesseract v4 OCR tool not available')
- def test_bootrom_framebuffer_ocr_with_tesseract_v4(self):
+ @skipUnless(tesseract_available(4), 'tesseract OCR tool not available')
+ def test_bootrom_framebuffer_ocr_with_tesseract(self):
screenshot_path = os.path.join(self.workdir, "dump.ppm")
self.check_bootrom_framebuffer(screenshot_path)
lines = tesseract_ocr(screenshot_path, tesseract_version=4)
text = '\n'.join(lines)
- self.assertIn('Testing the FPU, SCC', text)
+ self.assertIn('Testing the FPU', text)
self.assertIn('System test failed. Error code', text)
self.assertIn('Boot command', text)
self.assertIn('Next>', text)
version = res.stdout_text.split()[1]
except IndexError:
version = res.stderr_text.split()[1]
- return int(version.split('.')[0]) == expected_version
+ return int(version.split('.')[0]) >= expected_version
match = re.match(r'tesseract\s(\d)', res)
if match is None:
return False
# now this is guaranteed to be a digit
- return int(match.groups()[0]) == expected_version
+ return int(match.groups()[0]) >= expected_version
def tesseract_ocr(image_path, tesseract_args='', tesseract_version=3):