public void CutButton_ToolTip_Blocked()
        {
            WndImagePro wndImagePro = new WndImagePro();

            wndImagePro.ClickTabAutomate();

            wndImagePro.BtnOutput.SetFocus();
            Mouse.HoverDuration = 2000;
            Mouse.Hover(wndImagePro.BtnOutput);
            // var test = wndImagePro.BtnRecordMacro.ToolTipText;

            WinToolTip toolTip = new WinToolTip(wndImagePro);

            toolTip.SearchProperties.Add(new PropertyExpression(WinToolTip.PropertyNames.Name, "Record Macro", PropertyExpressionOperator.Contains));


            var text = wndImagePro.BtnOutput.ToolTipText;
            var stri = toolTip.HelpText;
            var test = (WinButton)wndImagePro.BtnOutput.FindMatchingControls()[0];
        }
Exemple #2
0
        public void TestRecordMacroWithAction()
        {
            #region TestData
            string imagesPath    = FileUtilities.CheckAndCreateDirectory(testImagesPath + System.Reflection.MethodBase.GetCurrentMethod().Name + @"\");
            string originalImage = testImagesPath + "Actual.jpg";
            string runTimeImage1 = imagesPath + "First.jpg";
            string runTimeImage2 = imagesPath + "Second.jpg";
            string newMacroName  = "AutoTest" + rand.Next(100, 999999);
            float  diff;
            #endregion

            wndImagePro.ClickTabAutomate();
            wndImagePro.StartRecodingMacro(newMacroName);

            #region Record New Macro and Save

            FileUtilities.OpenFile(originalImage);
            wndImagePro.ClickTabAdjust();
            wndImagePro.ClickBtnRotate();
            System.Threading.Thread.Sleep(3000);

            wndImagePro.WndRecording.PauseRecording();
            System.Threading.Thread.Sleep(1000);

            wndImagePro.WndRecording.ResumeRecording();
            wndImagePro.ClickTabMeasure();
            wndImagePro.ClickBtnCreate();
            System.Threading.Thread.Sleep(3000);

            wndImagePro.WndRecording.StopRecording();

            ////WndProjectWorkbench WndProjectWorkbench = new WndProjectWorkbench();
            ////WndProjectWorkbench.ConfirmSave();
            wndImagePro.ImageViewer.CaptureImage(runTimeImage1);

            #endregion

            #region ReOpen Saved Macro
            wndImagePro.CloseAllToolsAndViews(true);

            wndImagePro.ClickTabAutomate();
            Assert.IsTrue(wndImagePro.CheckRecordedMacroExists(newMacroName), "Should be true");
            wndImagePro.ClickTabAutomate();
            wndImagePro.SelectRecordedMacro(newMacroName);
            System.Threading.Thread.Sleep(5000); //Wait for macro execution
            wndImagePro.ImageViewer.CaptureImage(runTimeImage2);

            #endregion

            #region Verify Macro Output Images
            //ColorDifference diff = new ColorDifference(0);
            //Image image1 = Image.FromFile(runTimeImage1);
            //Image image2 = Image.FromFile(runTimeImage2);

            //Image outPutFile = null;
            //bool compar2e = ImageComparer.Compare(image1, image2, diff, out outPutFile);
            //outPutFile.Save(imagesPath + "Output.jpg");
            //Assert.IsTrue(compar2e, "Images should match");

            diff = ImageUtilities.GetPercentageDifference(runTimeImage1, runTimeImage2);
            Assert.IsTrue(diff < 0.02, "Images should be Identical");
            #endregion
        }