Esempio n. 1
0
        public void LanguageTest()
        {
            scripter.Text = ($"ocrabbyy.processfile {SpecialChars.Variable}file language Polish");
            scripter.Run();
            int documentId = scripter.Variables.GetVariableValue <int>("result");

            FineReaderDocument document = AbbyyManager.Instance.GetDocument(documentId);

            Assert.IsNotNull(document);
            string plainText = document.GetAllText();

            Assert.AreNotEqual(Properties.Resources.documentText, plainText);
        }
Esempio n. 2
0
        public void PagesTest()
        {
            string doc4Path       = Assembly.GetExecutingAssembly().UnpackResourceToFile("Resources." + nameof(Resources.dokument4), "pdf");
            string endOfFirstPage = @"Nowa sekcja 3 Strona 1";

            List <GStructures.Structure> list = new List <GStructures.Structure>()
            {
                new GStructures.IntegerStructure(1)
            };

            scripter.InitVariables.Add(nameof(list), new GStructures.ListStructure(list));
            scripter.Text = ($"ocrabbyy.processfile {SpecialChars.Text}{doc4Path}{SpecialChars.Text} pages {SpecialChars.Variable}{nameof(list)}");
            scripter.Run();
            FineReaderDocument document = AbbyyManager.Instance.GetDocument(scripter.Variables.GetVariableValue <int>("result"));

            Assert.IsTrue(document.GetAllText().Trim().EndsWith(endOfFirstPage));
        }
        public void RelativeTest()
        {
            IntPtr hTesterAppWindow = testerApp.MainWindowHandle;

            RobotWin32.Rect windowRect = new RobotWin32.Rect();
            RobotWin32.GetWindowRectangle(hTesterAppWindow, ref windowRect);
            int titleBarHeight = 24;

            scripter.Text = ($"ocrabbyy.processscreen area {SpecialChars.Text}0,0,{windowRect.Right - windowRect.Left},{titleBarHeight}{SpecialChars.Text} relative true");
            scripter.Run();
            int documentId = scripter.Variables.GetVariableValue <int>("result");

            FineReaderDocument document = AbbyyManager.Instance.GetDocument(documentId);

            Assert.IsNotNull(document);
            string plainText = document.GetAllText();

            Assert.IsTrue(plainText.Contains(appTitle));
        }
        public void LanguageTest()
        {
            IntPtr hTesterAppWindow = testerApp.MainWindowHandle;

            RobotWin32.Rect windowRect = new RobotWin32.Rect();
            RobotWin32.GetWindowRectangle(hTesterAppWindow, ref windowRect);
            int titleBarHeight = 24;

            string appTitle2 = "шестьсот";  // in case someone worry what this mean, it's six hundred

            scripter.Text = ($@"keyboard {SpecialChars.Text}title {appTitle2}{SpecialChars.Text}{SpecialChars.KeyBegin}enter{SpecialChars.KeyEnd}
                                ocrabbyy.processscreen area {SpecialChars.Text}{windowRect.Left},{windowRect.Top},{windowRect.Right},{windowRect.Top + titleBarHeight}{SpecialChars.Text} language russian");
            scripter.Run();

            int documentId = scripter.Variables.GetVariableValue <int>("result");

            FineReaderDocument document = AbbyyManager.Instance.GetDocument(documentId);

            Assert.IsNotNull(document);
            string plainText = document.GetAllText();

            Assert.IsTrue(plainText.Contains(appTitle2));
        }