public void works_with_good_lang()
        {
            WindowsOcrService windowsOcrExecutor = new WindowsOcrService();
            var res = windowsOcrExecutor.GetOcrResult(path, "en-US", false);

            Assert.IsNotNull(res);
            var isOutputEmpty = string.IsNullOrEmpty(windowsOcrExecutor.DebugPsOutput);

            Assert.IsTrue(isOutputEmpty);
        }
        public void works_with_bad_lang()
        {
            WindowsOcrService windowsOcrExecutor = new WindowsOcrService();
            var res = windowsOcrExecutor.GetOcrResult(path, "_BAD_LANGUAGE_", true);

            Assert.IsNotNull(res);
            var isOutputEmpty = string.IsNullOrEmpty(windowsOcrExecutor.DebugPsOutput);

            Assert.IsTrue(isOutputEmpty);
        }
예제 #3
0
        public async Task WindowsOcr()
        {
            WindowsOcrService windowsOcrExecutor = new WindowsOcrService();
            WindowsOcrResult  result             = await windowsOcrExecutor.GetOcrResultAsync(@"data/abc.JPG", "en");

            Assert.IsNotNull(result);
            GenericOcrResponse genericResult = result.Map();

            Assert.IsNotNull(genericResult);
        }
        public void reads_abc()
        {
            WindowsOcrService windowsOcrExecutor = new WindowsOcrService();
            var res      = windowsOcrExecutor.GetOcrResult(abc, "ro", true);
            var text     = string.Join("\r\n", res.Lines.Select(l => l.Text));
            var expected =
                @"abc
DEF
Total
3";

            Assert.AreEqual(expected, text);
        }
        public void fails_with_bad_lang()
        {
            WindowsOcrService windowsOcrExecutor = new WindowsOcrService();

            try
            {
                var res = windowsOcrExecutor.GetOcrResult(path, "_BAD_LANGUAGE_", false);
                Assert.Fail();
            }
            catch (Exception e)
            {
                var isOutputEmpty = string.IsNullOrEmpty(windowsOcrExecutor.DebugPsOutput);
                Assert.IsFalse(isOutputEmpty);
            }
        }