Esempio n. 1
0
        private void CropOnTextObjectUnsuccessfully()
        {
            PpOperations.SelectSlide(25);
            PpOperations.SelectShape("selectMe");

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Error",
                "'Crop To Slide' only supports shape or picture objects.",
                PplFeatures.CropToSlide);
        }
Esempio n. 2
0
        public void NoRefSlideUnsuccessful()
        {
            Microsoft.Office.Interop.PowerPoint.Slide refSlide = PpOperations.SelectSlide(1);
            refSlide.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to execute action",
                "No reference slide could be found. Either replace the reference slide or regenerate the agenda.",
                PplFeatures.SynchronizeAgenda);
        }
Esempio n. 3
0
        private void CropOnNothingUnsuccessfully()
        {
            PpOperations.SelectSlide(27);
            // don't select any shape here

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Error",
                "You need to select at least 1 shape or picture before applying 'Crop To Slide'.",
                PplFeatures.CropToSlide);
        }
Esempio n. 4
0
        private static void TestGenerateVisualAgenda()
        {
            MessageBoxUtil.ExpectMessageBoxWillPopUp(AgendaExistsTitle, AgendaExistsContent,
                                                     PplFeatures.GenerateVisualAgenda, buttonNameToClick: "OK");

            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);
        }
Esempio n. 5
0
        private void TestSavePlaceholderToShapesLabWithAddShapesButton(IShapesLabController shapesLab, int shapesSlideNum)
        {
            PpOperations.SelectSlide(shapesSlideNum);
            ExpectAddShapeButtonDisabled(shapesLab);
            PpOperations.SelectShapesByPrefix("Placeholder");
            ExpectAddShapeButtonDisabled(shapesLab);

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                ShapesLabText.ErrorDialogTitle, ShapesLabText.ErrorAddSelectionInvalid,
                shapesLab.ClickAddShapeButton);
        }
        public void NoContentShapeUnsuccessful()
        {
            PpOperations.SelectSlide(1);
            Microsoft.Office.Interop.PowerPoint.Shape contentShape = PpOperations.SelectShapesByPrefix("PptLabsAgenda_&^@ContentShape")[1];
            contentShape.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to execute action",
                "The current reference slide is invalid. Either replace the reference slide or regenerate the agenda.",
                PplFeatures.SynchronizeAgenda);
        }
Esempio n. 7
0
        private void TestDeleteTimerBody(ITimerLabController timerLab)
        {
            PpOperations.SelectSlide(OriginalSlideNo);
            var shapes = PpOperations.SelectShape(TimerBody);

            shapes.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp("Error",
                                                     "Only one timer allowed per slide.", timerLab.ClickCreateButton, "Ok");
            AssertIsSame(OriginalSlideNo, RecreateBodySlideNo);
        }
Esempio n. 8
0
        private void TestStepBackUnsuccessful()
        {
            var slide = PpOperations.SelectSlide(35);

            slide.MoveTo(1);
            PpOperations.SelectShape("Zoom This Shape");
            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to Add Animations",
                "No previous slide is found. Please select the correct slide",
                PplFeatures.StepBack);
        }
Esempio n. 9
0
        private void TestDrillDownUnsuccessful()
        {
            var slide = PpOperations.SelectSlide(34);

            slide.MoveTo(35);
            PpOperations.SelectShape("Zoom This Shape");
            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to Add Animations",
                "No next slide is found. Please select the correct slide",
                PplFeatures.DrillDown);
        }
Esempio n. 10
0
        public void FT_CaptionsMessageOneEmptySlide()
        {
            var 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);
        }
Esempio n. 11
0
        private void TestCopyUnsupportedPlaceHolders(ISyncLabController syncLab)
        {
            PpOperations.SelectSlide(ChartPlaceHolderSlideNo);
            PpOperations.SelectShape(Chart);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.ErrorDialogTitle,
                                                     SyncLabText.ErrorCopySelectionInvalid, syncLab.Copy, "Ok");

            PpOperations.SelectSlide(TablePlaceHolderSlideNo);
            PpOperations.SelectShape(Table);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.ErrorDialogTitle,
                                                     SyncLabText.ErrorCopySelectionInvalid, syncLab.Copy, "Ok");
        }
        private static void TestGenerateVisualAgendaWithSlideNumbers()
        {
            PpOperations.ShowAllSlideNumbers();
            MessageBoxUtil.ExpectMessageBoxWillPopUp(AgendaExistsTitle, AgendaExistsContent,
                                                     PplFeatures.GenerateVisualAgenda, buttonNameToClick: "OK");

            var actualSlides   = PpOperations.FetchCurrentPresentationData();
            var expectedSlides = PpOperations.FetchPresentationData(
                PathUtil.GetDocTestPresentationPath("AgendaLab\\AgendaSlidesVisualWithSlideNumberDefault.pptx"));

            PresentationUtil.AssertEqual(expectedSlides, actualSlides);
        }
Esempio n. 13
0
        private static void TestGenerateBeamAgenda()
        {
            PpOperations.SelectSlide(1);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(AgendaExistsTitle, AgendaExistsContent,
                                                     PplFeatures.GenerateBeamAgenda, buttonNameToClick: "OK");

            var actualSlides   = PpOperations.FetchCurrentPresentationData();
            var expectedSlides = PpOperations.FetchPresentationData(
                PathUtil.GetDocTestPresentationPath("AgendaSlidesBeamDefault.pptx"));

            PresentationUtil.AssertEqual(expectedSlides, actualSlides);
        }
        public void NoBeamUnsuccessful()
        {
            PpOperations.SelectSlide(1);
            var beamShape = PpOperations.SelectShapesByPrefix("PptLabsAgenda_&^@BeamShapeMainGroup")[1];

            beamShape.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to execute action",
                "The current reference slide is invalid. Either replace the reference slide or regenerate the agenda.",
                PplFeatures.SynchronizeAgenda);
        }
Esempio n. 15
0
        private void CropOnRotatedShapeUnsuccessfully()
        {
            PpOperations.SelectSlide(4);
            var shape = PpOperations.SelectShape("selectMe")[1];

            shape.Rotation = 45;

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to crop",
                "'Crop To Shape' does not currently support rotated shapes.",
                PplFeatures.AutoCrop);
        }
Esempio n. 16
0
        public void NoHighlightedTextUnsuccessful()
        {
            PpOperations.SelectSlide(1);
            Microsoft.Office.Interop.PowerPoint.Shape highlightedText = PpOperations.RecursiveGetShapeWithPrefix("PptLabsAgenda_&^@BeamShapeMainGroup",
                                                                                                                 "PptLabsAgenda_&^@BeamShapeHighlightedText");
            highlightedText.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to execute action",
                "The current reference slide is invalid. Either replace the reference slide or regenerate the agenda.",
                PplFeatures.SynchronizeAgenda);
        }
Esempio n. 17
0
        private void CropOnPictureObjectUnsuccessfully()
        {
            PpOperations.SelectSlide(4);
            PpOperations.SelectShapes(new List <string> {
                "selectMe", "pic"
            });

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to crop",
                "'Crop To Shape' only supports shape objects.",
                PplFeatures.AutoCrop);
        }
        public void NoBeamTextUnsuccessful()
        {
            PpOperations.SelectSlide(1);
            for (int i = 0; i < 5; ++i)
            {
                var beamText = PpOperations.RecursiveGetShapeWithPrefix("PptLabsAgenda_&^@BeamShapeMainGroup",
                                                                        "PptLabsAgenda_&^@BeamShapeText");
                beamText.Delete();
            }

            MessageBoxUtil.ExpectMessageBoxWillPopUp(
                "Unable to execute action",
                "The current reference slide is invalid. Either replace the reference slide or regenerate the agenda.",
                PplFeatures.SynchronizeAgenda);
        }
Esempio n. 19
0
        private void TestEditLineColorAndDeleteTimeMarker(ITimerLabController timerLab)
        {
            PpOperations.SelectSlide(ChangeLineColorAndRecreateTimeMarkerSlideNo);
            int expectedColor = PpOperations.SelectShape(TimerLineMarkerGroup)[1].Line.ForeColor.RGB;

            PpOperations.SelectSlide(OriginalSlideNo);
            var lineMarkerGroup = PpOperations.SelectShape(TimerLineMarkerGroup);

            lineMarkerGroup.Line.ForeColor.RGB = expectedColor;
            var timeMarkerGroup = PpOperations.SelectShape(TimerTimeMarkerGroup);

            timeMarkerGroup.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp("Error",
                                                     "Only one timer allowed per slide.", timerLab.ClickCreateButton, "Ok");
            AssertIsSame(OriginalSlideNo, ChangeLineColorAndRecreateTimeMarkerSlideNo);
        }
Esempio n. 20
0
        private void TestEditTextColorAndDeleteProgressBarPb(ITimerLabController timerLab)
        {
            PpOperations.SelectSlide(ChangeTextColorAndRecreateSliderSlideNo);
            int expectedColor = PpOperations.SelectShape(TimerTimeMarkerGroup)[1].TextFrame.TextRange.Font.Color.RGB;

            PpOperations.SelectSlide(PbOriginalSlideNo);
            ShapeRange timeMarkerGroup = PpOperations.SelectShape(TimerTimeMarkerGroup);

            timeMarkerGroup.TextFrame.TextRange.Font.Color.RGB = expectedColor;
            ShapeRange progressBar = PpOperations.SelectShape(ProgressBar);

            progressBar.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp("Error",
                                                     "Only one timer allowed per slide.", timerLab.ClickCreateButton, "Ok");
            AssertIsSame(PbOriginalSlideNo, PbChangeTextColorAndRecreateSliderSlideNo);
        }
        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. 22
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. 23
0
        public void NoSectionUnsuccessful(bool isTestingSynchronize)
        {
            PpOperations.DeleteSection(1, false);

            string title   = "Unable to execute action";
            string message = "Please group the slides into sections before generating agenda.";

            if (isTestingSynchronize)
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.SynchronizeAgenda);
            }
            else
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateBeamAgenda);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateVisualAgenda);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateBeamAgenda);
            }
        }
Esempio n. 24
0
        private void TestErrorDialogs(ISyncLabController syncLab)
        {
            PpOperations.SelectSlide(OriginalSyncGroupToShapeSlideNo);

            // no selection copy
            ExpectCopyButtonDisabled(syncLab);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.ErrorDialogTitle,
                                                     SyncLabText.ErrorCopySelectionInvalid, syncLab.Copy, "Ok");

            // 2 item selected copy
            List <String> shapes = new List <string> {
                Line, RotatedArrow
            };

            PpOperations.SelectShapes(shapes);
            ExpectCopyButtonEnabled(syncLab);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.ErrorDialogTitle,
                                                     SyncLabText.ErrorCopySelectionInvalid, syncLab.Copy, "Ok");

            // group selected copy
            PpOperations.SelectShape(Group);
            ExpectCopyButtonEnabled(syncLab);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.ErrorDialogTitle,
                                                     SyncLabText.ErrorCopySelectionInvalid, syncLab.Copy, "Ok");

            // copy blank item for the paste error dialog test
            PpOperations.SelectShape(Line);
            ExpectCopyButtonEnabled(syncLab);
            CopyStyle(syncLab);

            // no selection sync
            PpOperations.SelectSlide(ExpectedSyncShapeToGroupSlideNo);
            ExpectCopyButtonDisabled(syncLab);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.ErrorDialogTitle,
                                                     SyncLabText.ErrorPasteSelectionInvalid, () => syncLab.Sync(0), "Ok");

            // smart art
            PpOperations.SelectSlide(SmartArtSlideNo);
            PpOperations.SelectShape(SmartArt);
            ExpectCopyButtonEnabled(syncLab);
            MessageBoxUtil.ExpectMessageBoxWillPopUp(SyncLabText.ErrorDialogTitle,
                                                     SyncLabText.ErrorSmartArtUnsupported, syncLab.Copy, "Ok");
        }
        private void ConvertShapesToTooltipAndCompare(string[] shapeNames, int testSlideNo, int expectedSlideNo, bool isSuccessful)
        {
            Slide           slide          = PpOperations.SelectSlide(testSlideNo);
            PowerPointSlide currentSlide   = PowerPointSlide.FromSlideFactory(slide);
            ShapeRange      selectedShapes = PpOperations.SelectShapes(shapeNames);

            if (isSuccessful)
            {
                Assert.AreEqual(ConvertToTooltip.AddTriggerAnimation(currentSlide, selectedShapes), isSuccessful);
            }
            else
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(
                    TooltipsLabText.ErrorTooltipsDialogTitle,
                    TooltipsLabText.ErrorLessThanTwoShapesSelected,
                    () => { ConvertToTooltip.AddTriggerAnimation(currentSlide, selectedShapes); });
            }
            AssertIsSame(testSlideNo, expectedSlideNo);
        }
Esempio n. 26
0
        private void TestEditTextColorAndDeleteSlider(ITimerLabController timerLab)
        {
            PpOperations.SelectSlide(ChangeTextColorAndRecreateSliderSlideNo);
            int expectedColor = PpOperations.SelectShape(TimerTimeMarkerGroup)[1].TextFrame.TextRange.Font.Color.RGB;

            PpOperations.SelectSlide(OriginalSlideNo);
            var timeMarkerGroup = PpOperations.SelectShape(TimerTimeMarkerGroup);

            timeMarkerGroup.TextFrame.TextRange.Font.Color.RGB = expectedColor;
            List <string> sliderComponentNames = new List <string> {
                TimerSliderHead, TimerSliderBody
            };
            var sliderComponents = PpOperations.SelectShapes(sliderComponentNames);

            sliderComponents.Delete();

            MessageBoxUtil.ExpectMessageBoxWillPopUp("Error",
                                                     "Only one timer allowed per slide.", timerLab.ClickCreateButton, "Ok");
            AssertIsSame(OriginalSlideNo, ChangeTextColorAndRecreateSliderSlideNo);
        }
Esempio n. 27
0
        public void OneSectionUnsuccessful(bool isTestingSynchronize)
        {
            PpOperations.DeleteSection(5, false);
            PpOperations.DeleteSection(4, false);
            PpOperations.DeleteSection(3, false);
            PpOperations.DeleteSection(2, false);

            string title   = "Unable to execute action";
            string message = "Please divide the slides into two or more sections.";

            if (isTestingSynchronize)
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.SynchronizeAgenda);
            }
            else
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateBeamAgenda);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateVisualAgenda);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateBeamAgenda);
            }
        }
Esempio n. 28
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. 29
0
        public void LongSectionNameUnsuccessful(bool isTestingSynchronize)
        {
            string longName = new string('x', 200);

            PpOperations.RenameSection(2, longName);

            string title   = "Unable to execute action";
            string message = "One of the section names exceeds the maximum size allowed by Agenda Lab. Please rename the section accordingly.";

            if (isTestingSynchronize)
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.SynchronizeAgenda);
            }
            else
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateBeamAgenda);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateVisualAgenda);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateBeamAgenda);
            }

            PpOperations.RenameSection(2, "One Slide");
        }
Esempio n. 30
0
        public void EmptySectionUnsuccessful(bool isTestingSynchronize)
        {
            Microsoft.Office.Interop.PowerPoint.Slide slide = PpOperations.SelectSlide(27);
            slide.Delete();

            string title   = "Unable to execute action";
            string message = "Presentation contains empty section(s). Please fill them up or remove them.";

            if (isTestingSynchronize)
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.SynchronizeAgenda);
            }
            else
            {
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, () =>
                                                         MessageBoxUtil.ExpectMessageBoxWillPopUp(AgendaExistsTitle, AgendaExistsContent,
                                                                                                  PplFeatures.GenerateBeamAgenda, buttonNameToClick: "OK"));
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateVisualAgenda);
                MessageBoxUtil.ExpectMessageBoxWillPopUp(title, message, PplFeatures.GenerateBeamAgenda);
            }

            PpOperations.DeleteSection(6, true);
        }