Example #1
0
        public void ApplyMasking_WhenPageIsActivated()
        {
            firstPage.m_Paragraphs[0].maskingSettings.SetUnmaskedViews(new[] { UnmaskedView.CreateInstanceForGUIView <Toolbar>() });
            firstPage.m_Paragraphs[0].maskingSettings.enabled = true;
            firstPage.RaiseTutorialPageMaskingSettingsChangedEvent();
            //m_Window.RepaintImmediately(); TODO disabled, was causing problems after adding localisation support

            List <GUIView> views = new List <GUIView>();

            GUIViewDebuggerHelper.GetViews(views);

            // the tutorial window and the specified unmasked view should both be unmasked
            var rects = new List <Rect>();

            foreach (var view in views)
            {
                if (view == m_Window.m_Parent || view == Toolbar.get || view is TooltipView)
                {
                    Assert.IsFalse(MaskingManager.IsMasked(new GUIViewProxy(view), rects));
                }
                else
                {
                    Assert.IsTrue(MaskingManager.IsMasked(new GUIViewProxy(view), rects));
                }
            }
        }
Example #2
0
        public IEnumerator ApplyMasking_ToAllViewsExceptTutorialWindowAndTooltips_WhenRevisitingCompletedPage()
        {
            firstPage.m_Paragraphs[0].maskingSettings.SetUnmaskedViews(new[] { UnmaskedView.CreateInstanceForGUIView <Toolbar>() });
            firstPage.m_Paragraphs[0].maskingSettings.enabled = true;
            firstPage.RaiseTutorialPageMaskingSettingsChangedEvent();

            firstPageCriterion.Complete(true);

            m_Window.RepaintImmediately();

            List <GUIView> views = new List <GUIView>();

            GUIViewDebuggerHelper.GetViews(views);

            // masking of final instruction still applied when it is complete
            var rects = new List <Rect>();

            foreach (var view in views)
            {
                if (view == m_Window.m_Parent || view == Toolbar.get || view is TooltipView)
                {
                    Assert.IsFalse(MaskingManager.IsMasked(new GUIViewProxy(view), rects));
                }
                else
                {
                    Assert.IsTrue(MaskingManager.IsMasked(new GUIViewProxy(view), rects));
                }
            }

            using (var automatedWindow = new AutomatedWindow <TutorialWindow>(m_Window))
            {
                m_Window.RepaintImmediately();

                // go to next page and then come back
                automatedWindow.Click(FindElementWithText(automatedWindow, nextButtonText, "next button"));
                yield return(null);

                m_Window.RepaintImmediately();
                automatedWindow.Click(FindElementWithStyle(automatedWindow, m_Window.allTutorialStyles.backButton, "back button"));
                yield return(null);

                m_Window.RepaintImmediately();
            }

            // now only tutorial window should be unmasked
            foreach (var view in views)
            {
                if (view == m_Window.m_Parent || view is TooltipView)
                {
                    Assert.IsFalse(MaskingManager.IsMasked(new GUIViewProxy(view), rects));
                }
                else
                {
                    Assert.IsTrue(MaskingManager.IsMasked(new GUIViewProxy(view), rects));
                }
            }
        }