예제 #1
0
 public void Setup()
 {
     CultureUtil.SetDefaultCulture(CultureInfo.GetCultureInfo("en-US"));
     App = new PowerPoint.Application();
     Pres = App.Presentations.Open(
         PathUtil.GetDocTestPath() + GetTestingSlideName(),
         WithWindow: MsoTriState.msoFalse);
     PpOperations = new UnitTestPpOperations(Pres, App);
 }
예제 #2
0
 public void Setup()
 {
     CultureUtil.SetDefaultCulture(CultureInfo.GetCultureInfo("en-US"));
     App  = new PowerPoint.Application();
     Pres = App.Presentations.Open(
         PathUtil.GetDocTestPath() + GetTestingSlideName(),
         WithWindow: MsoTriState.msoFalse);
     PpOperations = new UnitTestPpOperations(Pres, App);
 }
 private void CloseActivePpInstance()
 {
     Process[] processes = Process.GetProcessesByName(Constants.pptProcess);
     if (processes.Length > 0)
     {
         foreach (Process p in processes)
         {
             p.CloseMainWindow();
         }
     }
     WaitForPpInstanceToClose();
     PpOperations = null;
     PplFeatures  = null;
 }
예제 #4
0
 public void Setup()
 {
     CultureUtil.SetDefaultCulture(CultureInfo.GetCultureInfo("en-US"));
     try
     {
         App = new PowerPoint.Application();
     }
     catch (COMException)
     {
         // in case a warm-up is needed
         App = new PowerPoint.Application();
     }
     Pres = App.Presentations.Open(
         PathUtil.GetDocTestPath() + GetTestingSlideName(),
         WithWindow: MsoTriState.msoFalse);
     PpOperations = new UnitTestPpOperations(Pres, App);
 }
 public void Setup()
 {
     CultureUtil.SetDefaultCulture(CultureInfo.GetCultureInfo("en-US"));
     try
     {
         App = new PowerPoint.Application();
     }
     catch (COMException)
     {
         // in case a warm-up is needed
         App = new PowerPoint.Application();
     }
     Pres = App.Presentations.Open(
         PathUtil.GetDocTestPath() + GetTestingSlideName(),
         WithWindow: MsoTriState.msoFalse);
     PpOperations = new UnitTestPpOperations(Pres, App);
 }
        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);
        }
예제 #7
0
        public void Setup()
        {
            CultureUtil.SetDefaultCulture(CultureInfo.GetCultureInfo("en-US"));
            try
            {
                App = new PowerPoint.Application();
            }
            catch (COMException)
            {
                // in case a warm-up is needed
                App = new PowerPoint.Application();
            }
            Pres = App.Presentations.Open(
                PathUtil.GetDocTestPath() + GetTestingSlideName(),
                WithWindow: MsoTriState.msoFalse);
            PpOperations = new UnitTestPpOperations(Pres, App);
            PPLClipboard.Init(PpOperations.Window, true);
            int processId = Process.GetCurrentProcess().Id;

            WindowWatcher.HeadlessSetup(processId);
        }
예제 #8
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);
        }
예제 #9
0
        private void ConnectPpl()
        {
            const int waitTime = 3000;
            var retryCount = 5;
            while (retryCount > 0)
            {
                // if already connected, break
                if (PplFeatures != null && PpOperations != null)
                {
                    break;
                }
                // otherwise keep trying to connect for some times
                try
                {
                    var 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);
        }
예제 #10
0
 private void CloseActivePpInstance()
 {
     var processes = Process.GetProcessesByName("POWERPNT");
     if (processes.Length > 0)
     {
         foreach (Process p in processes)
         {
             p.CloseMainWindow();
         }
     }
     WaitForPpInstanceToClose();
     PpOperations = null;
     PplFeatures = null;
 }