Beispiel #1
0
        public void ApplyHighlighting_ToAllUnmaskedWindowsAndViews_WhenMaskingSettingsOnlySpecifyEntireWindowsAndViews()
        {
            firstPage.m_Paragraphs[0].maskingSettings.SetUnmaskedViews(
                new[]
            {
                UnmaskedView.CreateInstanceForGUIView <Toolbar>(),
                UnmaskedView.CreateInstanceForGUIView <AppStatusBar>()
            }
                );
            firstPage.m_Paragraphs[0].maskingSettings.enabled = true;
            firstPage.RaiseTutorialPageMaskingSettingsChangedEvent();

            m_Window.RepaintImmediately();

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

            GUIViewDebuggerHelper.GetViews(views);

            // both the toolbar and status bar should be highlighted
            var rects = new List <Rect>();

            foreach (var view in views)
            {
                if (view == Toolbar.get || view is AppStatusBar)
                {
                    Assert.IsTrue(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                }
                else
                {
                    Assert.IsFalse(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                }
            }
        }
Beispiel #2
0
        public void ApplyHighlighting_ToUnmaskedViews_WhenPageOnlyContainsNarrativeParagraphs()
        {
            firstPage.m_Paragraphs[0].m_Type = ParagraphType.Narrative;
            firstPage.m_Paragraphs[0].maskingSettings.SetUnmaskedViews(new[] { UnmaskedView.CreateInstanceForGUIView <Toolbar>() });
            firstPage.m_Paragraphs[0].maskingSettings.enabled = true;
            firstPage.RaiseTutorialPageMaskingSettingsChangedEvent();

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

            GUIViewDebuggerHelper.GetViews(views);

            // only the specified unmasked view should be highlighted
            var rects = new List <Rect>();

            foreach (var view in views)
            {
                if (view == Toolbar.get)
                {
                    Assert.IsTrue(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                }
                else
                {
                    Assert.IsFalse(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                }
            }
        }
Beispiel #3
0
        public void ApplyHighlighting_ToTutorialWindow_WhenAllTasksAreComplete()
        {
            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);

            // only the tutorial window should be highlighted
            var rects = new List <Rect>();

            foreach (var view in views)
            {
                if (view == m_Window.m_Parent)
                {
                    Assert.IsTrue(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                }
                else
                {
                    Assert.IsFalse(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                }
            }
        }
        public void ApplyHighlighting_ToOnlySpecifiedControls_WhenMaskingSettingsSpecifyControlsAndEntireWindowsAndViews()
        {
            var playButtonContrlSelector = new GuiControlSelector
            {
                SelectorMode = GuiControlSelector.Mode.NamedControl,
                ControlName  = "ToolbarPlayModePlayButton"
            };

            firstPage.m_Paragraphs[0].MaskingSettings.SetUnmaskedViews(
                new[]
            {
                UnmaskedView.CreateInstanceForGUIView <Toolbar>(new[] { playButtonContrlSelector }),
                UnmaskedView.CreateInstanceForGUIView <AppStatusBar>()
            }
                );
            firstPage.m_Paragraphs[0].MaskingSettings.Enabled = true;
            firstPage.RaiseTutorialPageMaskingSettingsChangedEvent();

            m_Window.RepaintImmediately();

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

            GUIViewDebuggerHelper.GetViews(views);

            // only the play button should be highlighted
            var rects = new List <Rect>();

            foreach (var view in views)
            {
                if (view == Toolbar.get)
                {
                    Assert.IsTrue(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                    Assert.AreEqual(1, rects.Count);
                    var viewPosition = view.position;
                    var controlRect  = rects[0];
                    Assert.Greater(controlRect.xMin, viewPosition.xMin);
                    Assert.Greater(controlRect.yMin, viewPosition.yMin);
                    Assert.Less(controlRect.xMax, viewPosition.xMax);
                    Assert.Less(controlRect.yMax, viewPosition.yMax);
                }
                else
                {
                    Assert.IsFalse(MaskingManager.IsHighlighted(new GUIViewProxy(view), rects));
                }
            }
        }