Esempio n. 1
0
 private void TestGeneratedSlideEffect(int startIdx, Action effectAction)
 {
     PpOperations.SelectSlide(startIdx);
     PpOperations.SelectShape("selectMe");
     effectAction.Invoke();
     ThreadUtil.WaitFor(100);
     AssertIsSame(startIdx, startIdx + 2);
     AssertIsSame(startIdx + 1, startIdx + 3);
 }
Esempio n. 2
0
 private void CopyStyle(ISyncLabController syncLab)
 {
     new Task(() =>
     {
         ThreadUtil.WaitFor(1000);
         syncLab.DialogClickOk();
     }).Start();
     syncLab.Copy();
 }
Esempio n. 3
0
 public void VisualSyncSuccessful()
 {
     PplFeatures.SynchronizeAgenda();
     ThreadUtil.WaitFor(10000);
     System.Collections.Generic.List <TestInterface.ISlideData> actualSlides   = PpOperations.FetchCurrentPresentationData();
     System.Collections.Generic.List <TestInterface.ISlideData> expectedSlides = PpOperations.FetchPresentationData(
         PathUtil.GetDocTestPresentationPath("AgendaLab\\AgendaSlidesVisualAfterSync.pptx"));
     PresentationUtil.AssertEqual(expectedSlides, actualSlides);
 }
Esempio n. 4
0
        public void FT_AutoNarrationTest()
        {
            Microsoft.Office.Interop.PowerPoint.Slide actualSlide = PpOperations.SelectSlide(7);

            PplFeatures.AutoNarrate();
            ThreadUtil.WaitFor(5000);
            Microsoft.Office.Interop.PowerPoint.Slide expSlide = PpOperations.SelectSlide(8);
            ThreadUtil.WaitFor(1000); // need to wait for loading
            SlideUtil.IsSameAnimations(expSlide, actualSlide);
        }
Esempio n. 5
0
        private void TestSyncExplanationItems(IELearningLabController eLearningLab)
        {
            eLearningLab.Sync();
            Slide expSlide = PpOperations.SelectSlide(TestSyncExplanationItemSlideNo);

            ThreadUtil.WaitFor(1000);
            Slide actualSlide = PpOperations.SelectSlide(ExpectedSyncExplanationItemSlideNo);

            SlideUtil.IsSameLooking(expSlide, actualSlide, similarityTolerance: 0.99);
        }
        public void FT_CaptionsMessageOneEmptySlide()
        {
            Microsoft.Office.Interop.PowerPoint.Slide actualSlide = PpOperations.SelectSlide(6);
            ThreadUtil.WaitFor(1000);

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                CaptionsLabText.ErrorDialogTitle,
                "Captions could not be created because there are no notes entered. Please enter something in the notes and try again.",
                PplFeatures.AutoCaptions);
        }
 private static void TestGenerateVisualAgenda()
 {
     MessageBoxUtil.ExpectMessageBoxWillPopUp(AgendaExistsTitle, AgendaExistsContent,
                                              PplFeatures.GenerateVisualAgenda, buttonNameToClick: "OK");
     ThreadUtil.WaitFor(10000); // TODO: Remove delay when it becomes more stable
     System.Collections.Generic.List <TestInterface.ISlideData> actualSlides   = PpOperations.FetchCurrentPresentationData();
     System.Collections.Generic.List <TestInterface.ISlideData> expectedSlides = PpOperations.FetchPresentationData(
         PathUtil.GetDocTestPresentationPath("AgendaLab\\AgendaSlidesVisualDefault.pptx"));
     PresentationUtil.AssertEqual(expectedSlides, actualSlides);
 }
        private void PasteAtCursorPosition(int originalSlideNo, int expSlideNo)
        {
            Microsoft.Office.Interop.PowerPoint.ShapeRange shapes = GetShapesByPrefix(originalSlideNo, ShapeToCopyPrefix);
            shapes.Cut();

            RightClick(GetShapesByPrefix(originalSlideNo, ShapeToClick)[1]);
            // wait for awhile for click to register properly
            ThreadUtil.WaitFor(500);
            PplFeatures.PasteAtCursorPosition();

            AssertIsSame(originalSlideNo, expSlideNo);
        }
        public void FT_AutoCaptionsTest()
        {
            Microsoft.Office.Interop.PowerPoint.Slide actualSlide = PpOperations.SelectSlide(4);
            ThreadUtil.WaitFor(1000);

            PplFeatures.AutoCaptions();

            Microsoft.Office.Interop.PowerPoint.Slide expSlide = PpOperations.SelectSlide(5);
            PpOperations.SelectShape("text 3").Delete();

            SlideUtil.IsSameAnimations(expSlide, actualSlide);
            SlideUtil.IsSameLooking(expSlide, actualSlide);
        }
Esempio n. 10
0
 private void CopyStyle(ISyncLabController syncLab, int[,] dialogItems)
 {
     new Task(() =>
     {
         ThreadUtil.WaitFor(1000);
         for (int i = 0; i < dialogItems.GetLength(0); i++)
         {
             syncLab.DialogSelectItem(dialogItems[i, CategoryIndexPosition], dialogItems[i, FormatItemIndexPosition]);
         }
         syncLab.DialogClickOk();
     }).Start();
     syncLab.Copy();
 }
Esempio n. 11
0
        public void FT_CreateExplanationBeforeTemplateTest()
        {
            IELearningLabController eLearningLab = PplFeatures.ELearningLab;

            eLearningLab.OpenPane();
            ThreadUtil.WaitFor(5000);
            ExplanationItemTemplate[] items = CreateStartItems();
            eLearningLab.CreateTemplateExplanations(items);
            eLearningLab.AddAbove(1);
            List <ExplanationItemTemplate> explanationItemTemplates = new List <ExplanationItemTemplate>(items);

            explanationItemTemplates.Insert(1, items[0]);
            AssertEqual(explanationItemTemplates.ToArray(), eLearningLab.GetExplanations());
        }
Esempio n. 12
0
        public void FT_CreateExplanationAtBottomTemplateTest()
        {
            IELearningLabController eLearningLab = PplFeatures.ELearningLab;

            eLearningLab.OpenPane();
            ThreadUtil.WaitFor(5000);
            ExplanationItemTemplate[] items = CreateStartItems();
            eLearningLab.CreateTemplateExplanations(items);
            eLearningLab.AddAtBottom();
            List <ExplanationItemTemplate> explanationItemTemplates = new List <ExplanationItemTemplate>(items);

            explanationItemTemplates.Add(items[items.Length - 1]);
            AssertEqual(explanationItemTemplates.ToArray(), eLearningLab.GetExplanations());
        }
Esempio n. 13
0
        public void FT_AutoCaptionsTest()
        {
            var actualSlide = PpOperations.SelectSlide(4);

            ThreadUtil.WaitFor(1000);

            PplFeatures.AutoCaptions();

            var expSlide = PpOperations.SelectSlide(5);

            PpOperations.SelectShape("text 3").Delete();

            SlideUtil.IsSameAnimations(expSlide, actualSlide);
            SlideUtil.IsSameLooking(expSlide, actualSlide);
        }
 private static IntPtr Gethwnd(int retries = 5)
 {
     while (retries > 0)
     {
         try
         {
             return(PpOperations.Window);
         }
         catch
         {
             retries--;
             ThreadUtil.WaitFor(1500);
         }
     }
     return(IntPtr.Zero);
 }
        private void ConnectPpl()
        {
            const int waitTime   = 3000;
            int       retryCount = 5;

            while (retryCount > 0)
            {
                // if already connected, break
                if (PplFeatures != null && PpOperations != null && WindowStackManager != null)
                {
                    break;
                }
                // otherwise keep trying to connect for some times
                try
                {
                    IPowerPointLabsFT ftInstance = (IPowerPointLabsFT)Activator.GetObject(typeof(IPowerPointLabsFT),
                                                                                          "ipc://PowerPointLabsFT/PowerPointLabsFT");
                    PplFeatures        = ftInstance.GetFeatures();
                    PpOperations       = ftInstance.GetOperations();
                    WindowStackManager = ftInstance.GetWindowStackManager();
                    WindowStackManager.Setup();
                    break;
                }
                catch (RemotingException)
                {
                    retryCount--;
                    ThreadUtil.WaitFor(waitTime);
                }
            }
            if (PplFeatures == null || PpOperations == null)
            {
                Assert.Fail("Failed to connect to PowerPointLabs add-in. You can try to increase retryCount.");
            }

            PpOperations.EnterFunctionalTest();

            // activate the thread of presentation window
            // Sometimes it takes very long for message box to pop up
            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "PowerPointLabs FT", "{*}",
                PpOperations.ActivatePresentation, null, 5, 10000);
            IntPtr window = Gethwnd();

            PPLClipboard.Init(window, true);
        }
Esempio n. 16
0
        private void TestCopyCustomPerspectiveShadow(ISyncLabController syncLab)
        {
            PpOperations.SelectSlide(CustomPerspectiveShadowSlideNo);
            PpOperations.SelectShape(CustomPerspectiveShadow);

            // shadow item
            int categoryIndex = 3;
            int itemIndex     = 0;

            new Task(() =>
            {
                ThreadUtil.WaitFor(1000);
                syncLab.DialogSelectItem(categoryIndex, itemIndex);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.WarningDialogTitle,
                                                         SyncLabText.WarningSyncPerspectiveShadow, syncLab.DialogClickOk, "Ok");
            }).Start();
            syncLab.Copy();
        }
Esempio n. 17
0
        private void WaitForPpInstanceToClose()
        {
            int retry = 5;

            while (Process.GetProcessesByName("POWERPNT").Length > 0 &&
                   retry > 0)
            {
                retry--;
                ThreadUtil.WaitFor(1500);
            }

            if (Process.GetProcessesByName("POWERPNT").Length > 0)
            {
                foreach (Process process in Process.GetProcessesByName("POWERPNT"))
                {
                    process.Kill();
                }
            }
        }
        public void FT_CreateSelfExplanationTest()
        {
            PpOperations.SelectSlide(TestSyncExplanationItemSlideNo);
            IELearningLabController eLearningLab = PplFeatures.ELearningLab;

            eLearningLab.OpenPane();
            ThreadUtil.WaitFor(5000);
            eLearningLab.AddSelfExplanationItem();
            TestSyncExplanationItems(eLearningLab);

            PpOperations.SelectSlide(TestReorderExplanationItemSlideNo);
            ThreadUtil.WaitFor(5000);
            eLearningLab.AddSelfExplanationItem();
            TestReorderExplanationItems(eLearningLab);

            PpOperations.SelectSlide(TestDeleteExplanationItemSlideNo);
            ThreadUtil.WaitFor(5000);
            eLearningLab.AddSelfExplanationItem();
            TestDeleteExplanationItems(eLearningLab);
        }
        private void WaitForPpInstanceToClose()
        {
            PPLClipboard.Instance?.Teardown();
            int retry = 5;

            while (Process.GetProcessesByName(Constants.pptProcess).Length > 0 &&
                   retry > 0)
            {
                retry--;
                ThreadUtil.WaitFor(1500);
            }

            if (Process.GetProcessesByName(Constants.pptProcess).Length > 0)
            {
                foreach (Process process in Process.GetProcessesByName(Constants.pptProcess))
                {
                    process.Kill();
                }
            }
        }
Esempio n. 20
0
        private void ConnectPpl()
        {
            const int waitTime   = 3000;
            int       retryCount = 5;

            while (retryCount > 0)
            {
                // if already connected, break
                if (PplFeatures != null && PpOperations != null)
                {
                    break;
                }
                // otherwise keep trying to connect for some times
                try
                {
                    IPowerPointLabsFT ftInstance = (IPowerPointLabsFT)Activator.GetObject(typeof(IPowerPointLabsFT),
                                                                                          "ipc://PowerPointLabsFT/PowerPointLabsFT");
                    PplFeatures  = ftInstance.GetFeatures();
                    PpOperations = ftInstance.GetOperations();
                    break;
                }
                catch (RemotingException)
                {
                    retryCount--;
                    ThreadUtil.WaitFor(waitTime);
                }
            }
            if (PplFeatures == null || PpOperations == null)
            {
                Assert.Fail("Failed to connect to PowerPointLabs add-in. You can try to increase retryCount.");
            }

            PpOperations.EnterFunctionalTest();

            // activate the thread of presentation window
            ThreadUtil.WaitFor(1500);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "PowerPointLabs FT", "{*}",
                PpOperations.ActivatePresentation);
        }
Esempio n. 21
0
        public void FT_QuickPropertyTest()
        {
            PpOperations.SelectSlide(4);

            Microsoft.Office.Interop.PowerPoint.Shape shape = PpOperations.SelectShape("ffs")[1];

            int x = PpOperations.PointsToScreenPixelsX(shape.Left + shape.Width / 2);
            int y = PpOperations.PointsToScreenPixelsY(shape.Top + shape.Height / 2);

            WindowWatcher.AddToWhitelist("Format Shape");
            MouseUtil.SendMouseDoubleClick(x, y);
            ThreadUtil.WaitFor(2000);

            if (PpOperations.IsOffice2010())
            {
                // AKA property handle
                IntPtr formatObjHandle = NativeUtil.FindWindow("NUIDialog", "Format Shape");
                Assert.AreNotEqual(IntPtr.Zero, formatObjHandle, "Failed to find Property handle.");

                NativeUtil.SendMessage(formatObjHandle, 0x10 /*WM_CLOSE*/, IntPtr.Zero, IntPtr.Zero);
            }
            else // for Office 2013 or higher
            {
                // Spy++ helps to look into the handles
                IntPtr pptHandle = NativeUtil.FindWindow("PPTFrameClass", null);
                Assert.AreNotEqual(IntPtr.Zero, pptHandle, "Failed to find PowerPoint handle.");

                IntPtr dockRightHandle =
                    NativeUtil.FindWindowEx(pptHandle, IntPtr.Zero, "MsoCommandBarDock", "MsoDockRight");
                Assert.AreNotEqual(IntPtr.Zero, dockRightHandle, "Failed to find Dock Right handle.");

                // AKA property handle
                IntPtr formatObjHandle =
                    NativeUtil.FindWindowEx(dockRightHandle, IntPtr.Zero, "MsoCommandBar", "Format Object");
                Assert.AreNotEqual(IntPtr.Zero, formatObjHandle, "Failed to find Property handle.");
            }
        }
Esempio n. 22
0
 private void ExpectAddShapeButtonDisabled(IShapesLabController shapesLab)
 {
     ThreadUtil.WaitFor(1000);
     Assert.IsFalse(shapesLab.GetAddShapeButtonStatus());
 }
Esempio n. 23
0
 private void ExpectCopyButtonDisabled(ISyncLabController syncLab)
 {
     ThreadUtil.WaitFor(500);
     Assert.IsFalse(syncLab.GetCopyButtonEnabledStatus());
 }