예제 #1
0
        public void ObjectBrowserBasicTest()
        {
            var app     = new VisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\Outlining.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;

            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[0].Select();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
            Assert.AreEqual(1, nodeCount, "Node Count: " + nodeCount.ToString());

            str = objectBrowser.TypeNavigatorPane.Nodes[0].Value;
            Assert.AreEqual("f()", str.Trim(), "");

            str = objectBrowser.DetailPane.Value;
            Assert.AreEqual("Program.py", str.Trim(), "");
        }
예제 #2
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserTypeBrowserViewTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\MultiModule.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;

            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[1].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            Condition con = new PropertyCondition(
                AutomationElement.ClassNameProperty,
                "ContextMenu"
                );
            AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);

            Assert.IsNotNull(el);
            Menu menu      = new Menu(el);
            int  itemCount = menu.Items.Count;

            Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
            menu.Items[1].Check();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
            Assert.IsNotNull(el);
            menu      = new Menu(el);
            itemCount = menu.Items.Count;
            Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
            Assert.IsTrue(menu.Items[1].ToggleStatus);
            menu.Items[2].Check();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());
        }
예제 #3
0
        public void ObjectBrowserBasicTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\Outlining.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());

                AssertNodes(objectBrowser,
                    new NodeInfo("Outlining", "Outlining"),
                    new NodeInfo("BadForStatement.py", "BadForStatement.py"),
                    new NodeInfo("NestedFuncDef.py", "NestedFuncDef.py", new[] { "f()" }),
                    new NodeInfo("Program.py", "Program.py", new[] { "f()" }));

                app.Dte.Solution.Close(false);

                System.Threading.Thread.Sleep(1000);
                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
            }
        }
예제 #4
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserBasicTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\Outlining.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            AssertNodes(objectBrowser,
                        new NodeInfo("Outlining", "Outlining"),
                        new NodeInfo("BadForStatement.py", "BadForStatement.py"),
                        new NodeInfo("NestedFuncDef.py", "NestedFuncDef.py", new[] { "def f()" }),
                        new NodeInfo("Program.py", "Program.py", new[] { "def f()", "i" }));

            app.Dte.Solution.Close(false);

            System.Threading.Thread.Sleep(1000);
            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
        }
예제 #5
0
        public void ObjectBrowserSearchTextTest()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\ObjectBrowser.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                objectBrowser.EnsureLoaded();

                // Initially, we should have only the top-level collapsed node for the project

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                // Now that it is expanded, we should also get a node for Program.py

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                // Sanity-check the starting view with all nodes expanded.

                var expectedNodesBeforeSearch = new[] {
                new NodeInfo("ObjectBrowser", "ObjectBrowser"),
                new NodeInfo("Program.py", "Program.py", new[] { "frob()" }),
                new NodeInfo("Oar", "class Oar", new[] { "oar(self)" }),
                new NodeInfo("Fob", "class Fob"),
                new NodeInfo("FobOarBaz", "class FobOarBaz", new[] { "frob(self)" }),
            };
                AssertNodes(objectBrowser, expectedNodesBeforeSearch);

                // Do the search and check results

                objectBrowser.SearchText.SetValue("oar");
                System.Threading.Thread.Sleep(1000);

                objectBrowser.SearchButton.Click();
                System.Threading.Thread.Sleep(1000);

                var expectedNodesAfterSearch = new[] {
                new NodeInfo("oar", "def oar(self)"),
                new NodeInfo("Oar", "class Oar", new[] { "oar(self)" }),
                new NodeInfo("FobOarBaz", "class FobOarBaz", new[] { "frob(self)" }),
            };
                AssertNodes(objectBrowser, expectedNodesAfterSearch);

                // Clear the search and check that we get back to the starting view.

                objectBrowser.ClearSearchButton.Click();
                System.Threading.Thread.Sleep(1000);

                AssertNodes(objectBrowser, expectedNodesBeforeSearch);
            }
        }
예제 #6
0
        public void ObjectBrowserExpandTypeBrowserTest()
        {
            var app     = new VisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\Inheritance.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;

            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
        }
예제 #7
0
        public void ObjectBrowserCommentsTest()
        {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\Inheritance.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("Program.py", str, "");
                objectBrowser.TypeBrowserPane.Nodes[1].Select();
                nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node Count: " + nodeCount.ToString());
                str = objectBrowser.TypeNavigatorPane.Nodes[0].Value;
                Assert.AreEqual("members", str.Trim(), "");
                str = objectBrowser.TypeNavigatorPane.Nodes[1].Value;
                Assert.AreEqual("s", str.Trim(), "");
                str = objectBrowser.TypeNavigatorPane.Nodes[2].Value;
                Assert.AreEqual("t", str.Trim(), "");

                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[2].Select();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node Count: " + nodeCount.ToString());
                str = objectBrowser.TypeNavigatorPane.Nodes[0].Value;
                Assert.IsTrue(str.Trim().StartsWith("__init__(self"), str);
                str = objectBrowser.TypeNavigatorPane.Nodes[1].Value;
                Assert.AreEqual("tell(self)", str.Trim(), "");

                str = objectBrowser.DetailPane.Value;
                Assert.IsTrue(str.Trim().Contains("SchoolMember"), str);
                Assert.IsTrue(str.Trim().Contains("Represents any school member."), str);

                objectBrowser.TypeNavigatorPane.Nodes[1].Select();
                System.Threading.Thread.Sleep(1000);

                str = objectBrowser.DetailPane.Value;
                Assert.IsTrue(str.Trim().Contains("def tell(self)"), str);
                Assert.IsTrue(str.Trim().Contains("Tell my detail."), str);

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
            }
        }
예제 #8
0
        public void ObjectBrowserSearchTextTest()
        {
            var app     = new VisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\Outlining.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;

            Assert.AreEqual("Program.py", str, "");

            nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
            Assert.AreEqual(1, nodeCount, "Node Count: " + nodeCount.ToString());

            objectBrowser.SearchText.SetValue("f");
            System.Threading.Thread.Sleep(1000);

            objectBrowser.SearchButton.Click();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.IsTrue(nodeCount >= 1, "Node count: " + nodeCount.ToString());
            if (objectBrowser.TypeBrowserPane.Nodes[0].Value.ToLower().Contains("namespace"))
            {
                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                Assert.AreEqual("f", objectBrowser.TypeBrowserPane.Nodes[1].Value.Trim(), "");
                objectBrowser.TypeBrowserPane.Nodes[1].Select();
                System.Threading.Thread.Sleep(1000);
            }
            else
            {
                Assert.AreEqual("f", objectBrowser.TypeBrowserPane.Nodes[0].Value.Trim(), "");
            }

            str = objectBrowser.DetailPane.Value;
            Assert.AreEqual("def f()", str.Trim(), "");

            objectBrowser.ClearSearchButton.Click();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            str = objectBrowser.TypeBrowserPane.Nodes[0].Value;
            Assert.AreEqual("Program.py", str, "");

            nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
            Assert.AreEqual(1, nodeCount, "Node Count: " + nodeCount.ToString());
        }
예제 #9
0
        public void ObjectBrowserNavigationTest()
        {
            var app     = new VisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\MultiModule.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;

            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[3].Select();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[3].DoubleClick();
            System.Threading.Thread.Sleep(1000);

            str = app.Dte.ActiveDocument.Name;
            Assert.AreEqual("Program.py", str, "");

            int lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;

            Assert.AreEqual(14, lineNo, "Line number: " + lineNo.ToString());

            objectBrowser.TypeBrowserPane.Nodes[1].Select();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[1].DoubleClick();
            System.Threading.Thread.Sleep(1000);

            str = app.Dte.ActiveDocument.Name;
            Assert.AreEqual("MyModule.py", str, "");

            lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
            Assert.AreEqual(1, lineNo, "Line number: " + lineNo.ToString());

            objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
        }
예제 #10
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserInheritanceRelationshipTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\Inheritance.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;

            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[3].Select();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
            Assert.AreEqual(2, nodeCount, "Node Count: " + nodeCount.ToString());
            str = objectBrowser.TypeNavigatorPane.Nodes[0].Value;
            Assert.IsTrue(str.Trim().StartsWith("__init__ (alias of def "), str);
            str = objectBrowser.TypeNavigatorPane.Nodes[1].Value;
            Assert.AreEqual("def tell(self)", str.Trim(), "");

            str = objectBrowser.DetailPane.Value;
            Assert.IsTrue(str.Trim().Contains("Student(SchoolMember)"), str);
            Assert.IsTrue(str.Trim().Contains("Represents a student."), str);

            objectBrowser.TypeNavigatorPane.Nodes[1].Select();
            System.Threading.Thread.Sleep(1000);

            str = objectBrowser.DetailPane.Value;
            Assert.IsTrue(str.Trim().Contains("def tell(self)"), str);

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
        }
예제 #11
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserExpandTypeBrowserTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\Inheritance.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            objectBrowser.EnsureLoaded();

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;

            Assert.AreEqual("Inheritance", str, "");
            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

            str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
        }
예제 #12
0
        public void ObjectBrowserNavigateVarContextMenuTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                objectBrowser.EnsureLoaded();

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[4].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                Condition con = new PropertyCondition(
                                        AutomationElement.ClassNameProperty,
                                        "ContextMenu"
                                    );
                AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                Menu menu = new Menu(el);
                int itemCount = menu.Items.Count;
                Assert.AreEqual(13, itemCount, "Item count: " + itemCount.ToString());
                menu.Items[0].Check();
                System.Threading.Thread.Sleep(1000);

                str = app.Dte.ActiveDocument.Name;
                Assert.AreEqual("Program.py", str, "");

                int lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
                Assert.AreEqual(14, lineNo, "Line number: " + lineNo.ToString());

                app.OpenObjectBrowser();
                objectBrowser.TypeBrowserPane.Nodes[5].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                menu.Items[0].Check();
                System.Threading.Thread.Sleep(1000);

                lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
                Assert.AreEqual(3, lineNo, "Line number: " + lineNo.ToString());
            }
        }
예제 #13
0
        public void ObjectBrowserTypeBrowserSortTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[1].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                Condition con = new PropertyCondition(
                                        AutomationElement.ClassNameProperty,
                                        "ContextMenu"
                                    );
                AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                Menu menu = new Menu(el);
                int itemCount = menu.Items.Count;
                Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
                menu.Items[6].Check();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());
                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());
                Assert.AreEqual("Namespaces", objectBrowser.TypeBrowserPane.Nodes[3].Value, "");
                Assert.AreEqual("Namespaces", objectBrowser.TypeBrowserPane.Nodes[1].Value, "");
                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                objectBrowser.TypeBrowserPane.Nodes[0].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                itemCount = menu.Items.Count;
                Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
                Assert.IsTrue(menu.Items[6].ToggleStatus);
                menu.Items[3].Check();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("SchoolMember", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[3].Value;
                Assert.AreEqual("Program.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[4].Value;
                Assert.AreEqual("Student", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[5].Value;
                Assert.AreEqual("Teacher", str, "");
            }
        }
예제 #14
0
        public void ObjectBrowserContextMenuBasicTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[1].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                Condition con = new PropertyCondition(
                                        AutomationElement.ClassNameProperty,
                                        "ContextMenu"
                                    );
                AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                Menu menu = new Menu(el);
                int itemCount = menu.Items.Count;
                Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
                Assert.AreEqual("Copy", menu.Items[0].Value.Trim(), "");
                Assert.AreEqual("View Namespaces", menu.Items[1].Value.Trim(), "");
                Assert.AreEqual("View Containers", menu.Items[2].Value.Trim(), "");
                Assert.AreEqual("Sort Alphabetically", menu.Items[3].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Type", menu.Items[4].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Access", menu.Items[5].Value.Trim(), "");
                Assert.AreEqual("Group By Object Type", menu.Items[6].Value.Trim(), "");
                Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);

                objectBrowser.TypeBrowserPane.Nodes[2].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                itemCount = menu.Items.Count;
                Assert.AreEqual(13, itemCount, "Item count: " + itemCount.ToString());
                Assert.AreEqual("Go To Definition", menu.Items[0].Value.Trim(), "");
                Assert.AreEqual("Go To Declaration", menu.Items[1].Value.Trim(), "");
                Assert.AreEqual("Go To Reference", menu.Items[2].Value.Trim(), "");
                Assert.AreEqual("Browse Definition", menu.Items[3].Value.Trim(), "");
                Assert.AreEqual("Find All References", menu.Items[4].Value.Trim(), "");
                Assert.AreEqual("Filter To Type", menu.Items[5].Value.Trim(), "");
                Assert.AreEqual("Copy", menu.Items[6].Value.Trim(), "");
                Assert.AreEqual("View Namespaces", menu.Items[7].Value.Trim(), "");
                Assert.AreEqual("View Containers", menu.Items[8].Value.Trim(), "");
                Assert.AreEqual("Sort Alphabetically", menu.Items[9].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Type", menu.Items[10].Value.Trim(), "");
                Assert.AreEqual("Sort By Object Access", menu.Items[11].Value.Trim(), "");
                Assert.AreEqual("Group By Object Type", menu.Items[12].Value.Trim(), "");
                Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);
            }
        }
예제 #15
0
        public void ObjectBrowserNavigationTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                objectBrowser.EnsureLoaded();

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[4].Select();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[4].DoubleClick();
                System.Threading.Thread.Sleep(1000);

                str = app.Dte.ActiveDocument.Name;
                Assert.AreEqual("Program.py", str, "");

                int lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
                Assert.AreEqual(14, lineNo, "Line number: " + lineNo.ToString());

                app.OpenObjectBrowser();
                objectBrowser.TypeBrowserPane.Nodes[2].Select();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[2].DoubleClick();
                System.Threading.Thread.Sleep(1000);

                str = app.Dte.ActiveDocument.Name;
                Assert.AreEqual("MyModule.py", str, "");

                lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
                Assert.AreEqual(1, lineNo, "Line number: " + lineNo.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
            }
        }
예제 #16
0
        public void ObjectBrowserInheritanceRelationshipTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\Inheritance.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[3].Select();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeNavigatorPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node Count: " + nodeCount.ToString());
                str = objectBrowser.TypeNavigatorPane.Nodes[0].Value;
                Assert.IsTrue(str.Trim().StartsWith("__init__(self"), str);
                str = objectBrowser.TypeNavigatorPane.Nodes[1].Value;
                Assert.AreEqual("tell(self)", str.Trim(), "");

                str = objectBrowser.DetailPane.Value;
                Assert.IsTrue(str.Trim().Contains("Student(SchoolMember)"), str);
                Assert.IsTrue(str.Trim().Contains("Represents a student."), str);

                objectBrowser.TypeNavigatorPane.Nodes[1].Select();
                System.Threading.Thread.Sleep(1000);

                str = objectBrowser.DetailPane.Value;
                Assert.IsTrue(str.Trim().Contains("def tell(self)"), str);

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
            }
        }
예제 #17
0
        public void ObjectBrowserExpandTypeBrowserTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\Inheritance.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                objectBrowser.EnsureLoaded();

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;
                Assert.AreEqual("Inheritance", str, "");
                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

                str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());
            }
        }
예제 #18
0
        public void ObjectBrowserSearchTextTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\ObjectBrowser.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                objectBrowser.EnsureLoaded();

                // Initially, we should have only the top-level collapsed node for the project

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                // Now that it is expanded, we should also get a node for Program.py

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                // Sanity-check the starting view with all nodes expanded.

                var expectedNodesBeforeSearch = new[] {
                new NodeInfo("ObjectBrowser", "ObjectBrowser"),
                new NodeInfo("Program.py", "Program.py", new[] { "frob()" }),
                new NodeInfo("Oar", "class Oar", new[] { "oar(self)" }),
                new NodeInfo("Fob", "class Fob"),
                new NodeInfo("FobOarBaz", "class FobOarBaz", new[] { "frob(self)" }),
            };
                AssertNodes(objectBrowser, expectedNodesBeforeSearch);

                // Do the search and check results

                objectBrowser.SearchText.SetValue("oar");
                System.Threading.Thread.Sleep(1000);

                objectBrowser.SearchButton.Click();
                System.Threading.Thread.Sleep(1000);

                var expectedNodesAfterSearch = new[] {
                new NodeInfo("oar", "def oar(self)"),
                new NodeInfo("Oar", "class Oar", new[] { "oar(self)" }),
                new NodeInfo("FobOarBaz", "class FobOarBaz", new[] { "frob(self)" }),
            };
                AssertNodes(objectBrowser, expectedNodesAfterSearch);

                // Clear the search and check that we get back to the starting view.

                objectBrowser.ClearSearchButton.Click();
                System.Threading.Thread.Sleep(1000);

                AssertNodes(objectBrowser, expectedNodesBeforeSearch);
            }
        }
예제 #19
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserFindAllReferencesTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\MultiModule.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;

            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[4].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            Condition con = new PropertyCondition(
                AutomationElement.ClassNameProperty,
                "ContextMenu"
                );
            AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);

            Assert.IsNotNull(el);
            Menu menu      = new Menu(el);
            int  itemCount = menu.Items.Count;

            Assert.AreEqual(13, itemCount, "Item count: " + itemCount.ToString());
            menu.Items[4].Check();
            System.Threading.Thread.Sleep(1000);

            //this needs to be updated for bug #4840
            str = app.Dte.ActiveWindow.Caption;
            Assert.IsTrue(str.Contains("2 matches found"), str);

            objectBrowser.TypeBrowserPane.Nodes[2].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
            Assert.IsNotNull(el);
            menu = new Menu(el);
            menu.Items[4].Check();
            System.Threading.Thread.Sleep(1000);

            str = app.Dte.ActiveWindow.Caption;
            Assert.IsTrue(str.Contains("2 matches found"), str);
        }
예제 #20
0
        public void ObjectBrowserFindAllReferencesTest() {
            using (var app = new VisualStudioApp()) {
                var project = app.OpenProject(@"TestData\MultiModule.sln");
                System.Threading.Thread.Sleep(1000);

                app.OpenObjectBrowser();
                var objectBrowser = app.ObjectBrowser;
                System.Threading.Thread.Sleep(1000);

                int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

                string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
                Assert.AreEqual("MyModule.py", str, "");
                str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
                Assert.AreEqual("Program.py", str, "");

                objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);
                objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
                System.Threading.Thread.Sleep(1000);

                nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
                Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

                objectBrowser.TypeBrowserPane.Nodes[4].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                Condition con = new PropertyCondition(
                                        AutomationElement.ClassNameProperty,
                                        "ContextMenu"
                                    );
                AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                Menu menu = new Menu(el);
                int itemCount = menu.Items.Count;
                Assert.AreEqual(13, itemCount, "Item count: " + itemCount.ToString());
                menu.Items[4].Check();
                System.Threading.Thread.Sleep(1000);

                //this needs to be updated for bug #4840
                str = app.Dte.ActiveWindow.Caption;
                Assert.IsTrue(str.Contains("2 matches found"), str);

                objectBrowser.TypeBrowserPane.Nodes[2].ShowContextMenu();
                System.Threading.Thread.Sleep(1000);
                el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
                Assert.IsNotNull(el);
                menu = new Menu(el);
                menu.Items[4].Check();
                System.Threading.Thread.Sleep(1000);

                str = app.Dte.ActiveWindow.Caption;
                Assert.IsTrue(str.Contains("2 matches found"), str);
            }
        }
예제 #21
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserContextMenuBasicTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\MultiModule.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;

            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[1].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            Condition con = new PropertyCondition(
                AutomationElement.ClassNameProperty,
                "ContextMenu"
                );
            AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);

            Assert.IsNotNull(el);
            Menu menu      = new Menu(el);
            int  itemCount = menu.Items.Count;

            Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
            Assert.AreEqual("Copy", menu.Items[0].Value.Trim(), "");
            Assert.AreEqual("View Namespaces", menu.Items[1].Value.Trim(), "");
            Assert.AreEqual("View Containers", menu.Items[2].Value.Trim(), "");
            Assert.AreEqual("Sort Alphabetically", menu.Items[3].Value.Trim(), "");
            Assert.AreEqual("Sort By Object Type", menu.Items[4].Value.Trim(), "");
            Assert.AreEqual("Sort By Object Access", menu.Items[5].Value.Trim(), "");
            Assert.AreEqual("Group By Object Type", menu.Items[6].Value.Trim(), "");
            Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);

            objectBrowser.TypeBrowserPane.Nodes[2].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
            Assert.IsNotNull(el);
            menu      = new Menu(el);
            itemCount = menu.Items.Count;
            Assert.AreEqual(13, itemCount, "Item count: " + itemCount.ToString());
            Assert.AreEqual("Go To Definition", menu.Items[0].Value.Trim(), "");
            Assert.AreEqual("Go To Declaration", menu.Items[1].Value.Trim(), "");
            Assert.AreEqual("Go To Reference", menu.Items[2].Value.Trim(), "");
            Assert.AreEqual("Browse Definition", menu.Items[3].Value.Trim(), "");
            Assert.AreEqual("Find All References", menu.Items[4].Value.Trim(), "");
            Assert.AreEqual("Filter To Type", menu.Items[5].Value.Trim(), "");
            Assert.AreEqual("Copy", menu.Items[6].Value.Trim(), "");
            Assert.AreEqual("View Namespaces", menu.Items[7].Value.Trim(), "");
            Assert.AreEqual("View Containers", menu.Items[8].Value.Trim(), "");
            Assert.AreEqual("Sort Alphabetically", menu.Items[9].Value.Trim(), "");
            Assert.AreEqual("Sort By Object Type", menu.Items[10].Value.Trim(), "");
            Assert.AreEqual("Sort By Object Access", menu.Items[11].Value.Trim(), "");
            Assert.AreEqual("Group By Object Type", menu.Items[12].Value.Trim(), "");
            Keyboard.PressAndRelease(System.Windows.Input.Key.Escape);
        }
예제 #22
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserNavigationTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\MultiModule.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            objectBrowser.EnsureLoaded();

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;

            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[4].Select();
            System.Threading.Thread.Sleep(1000);
            app.ExecuteCommand("Edit.GoToDefinition");
            System.Threading.Thread.Sleep(1000);

            str = app.Dte.ActiveDocument.Name;
            Assert.AreEqual("Program.py", str, "");

            int lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;

            Assert.AreEqual(14, lineNo, "Line number: " + lineNo.ToString());

            app.OpenObjectBrowser();
            objectBrowser.TypeBrowserPane.Nodes[2].Select();
            System.Threading.Thread.Sleep(1000);
            app.ExecuteCommand("Edit.GoToDefinition");
            System.Threading.Thread.Sleep(1000);

            str = app.Dte.ActiveDocument.Name;
            Assert.AreEqual("MyModule.py", str, "");

            lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
            Assert.AreEqual(1, lineNo, "Line number: " + lineNo.ToString());

            objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
        }
예제 #23
0
        ////[TestMethod, Priority(0)]
        //[HostType("VSTestHost"), TestCategory("Installed")]
        public void ObjectBrowserNavigateVarContextMenuTest(VisualStudioApp app)
        {
            var project = app.OpenProject(@"TestData\MultiModule.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            objectBrowser.EnsureLoaded();

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(1, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(3, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[1].Value;

            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(6, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[4].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            Condition con = new PropertyCondition(
                AutomationElement.ClassNameProperty,
                "ContextMenu"
                );
            AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);

            Assert.IsNotNull(el);
            Menu menu      = new Menu(el);
            int  itemCount = menu.Items.Count;

            Assert.AreEqual(13, itemCount, "Item count: " + itemCount.ToString());
            menu.Items[0].Check();
            System.Threading.Thread.Sleep(1000);

            str = app.Dte.ActiveDocument.Name;
            Assert.AreEqual("Program.py", str, "");

            int lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;

            Assert.AreEqual(14, lineNo, "Line number: " + lineNo.ToString());

            app.OpenObjectBrowser();
            objectBrowser.TypeBrowserPane.Nodes[5].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
            Assert.IsNotNull(el);
            menu = new Menu(el);
            menu.Items[0].Check();
            System.Threading.Thread.Sleep(1000);

            lineNo = ((TextSelection)app.Dte.ActiveDocument.Selection).ActivePoint.Line;
            Assert.AreEqual(3, lineNo, "Line number: " + lineNo.ToString());
        }
예제 #24
0
        public void ObjectBrowserTypeBrowserSortTest()
        {
            var app     = new VisualStudioApp(VsIdeTestHostContext.Dte);
            var project = DebugProject.OpenProject(@"Python.VS.TestData\MultiModule.sln");

            System.Threading.Thread.Sleep(1000);

            app.OpenObjectBrowser();
            var objectBrowser = app.ObjectBrowser;

            System.Threading.Thread.Sleep(1000);

            int nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;

            Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

            string str = objectBrowser.TypeBrowserPane.Nodes[0].Value;

            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
            Assert.AreEqual("Program.py", str, "");

            objectBrowser.TypeBrowserPane.Nodes[0].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            Condition con = new PropertyCondition(
                AutomationElement.ClassNameProperty,
                "ContextMenu"
                );
            AutomationElement el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);

            Assert.IsNotNull(el);
            Menu menu      = new Menu(el);
            int  itemCount = menu.Items.Count;

            Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
            menu.Items[6].Check();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());
            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(4, nodeCount, "Node count: " + nodeCount.ToString());
            Assert.AreEqual("Namespaces", objectBrowser.TypeBrowserPane.Nodes[3].Value, "");
            Assert.AreEqual("Namespaces", objectBrowser.TypeBrowserPane.Nodes[1].Value, "");
            objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(7, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[3].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            objectBrowser.TypeBrowserPane.Nodes[0].ShowContextMenu();
            System.Threading.Thread.Sleep(1000);
            el = AutomationElement.RootElement.FindFirst(TreeScope.Descendants, con);
            Assert.IsNotNull(el);
            menu      = new Menu(el);
            itemCount = menu.Items.Count;
            Assert.AreEqual(7, itemCount, "Item count: " + itemCount.ToString());
            Assert.IsTrue(menu.Items[6].ToggleStatus);
            menu.Items[3].Check();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(2, nodeCount, "Node count: " + nodeCount.ToString());

            objectBrowser.TypeBrowserPane.Nodes[1].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);

            nodeCount = objectBrowser.TypeBrowserPane.Nodes.Count;
            Assert.AreEqual(5, nodeCount, "Node count: " + nodeCount.ToString());

            str = objectBrowser.TypeBrowserPane.Nodes[0].Value;
            Assert.AreEqual("MyModule.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[1].Value;
            Assert.AreEqual("SchoolMember", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[2].Value;
            Assert.AreEqual("Program.py", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[3].Value;
            Assert.AreEqual("Student", str, "");
            str = objectBrowser.TypeBrowserPane.Nodes[4].Value;
            Assert.AreEqual("Teacher", str, "");

            objectBrowser.TypeBrowserPane.Nodes[2].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
            objectBrowser.TypeBrowserPane.Nodes[0].ExpandCollapse();
            System.Threading.Thread.Sleep(1000);
        }