コード例 #1
0
        public void CreateNumbericBinding()
        {
            AddChannelsToSimulator();

            Helpers.CreateNewSchema(mainWindow);
            Panel schemaView = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("SchemaCanvas"));

            Assert.IsNotNull(schemaView);
            ToolBoxWrapper toolbox = new ToolBoxWrapper(mainWindow);

            toolbox.Select(ToolBoxWrapper.Entries.Rectangle);

            //Draw rect
            System.Drawing.Point pt = new System.Drawing.Point();

            pt.X = Convert.ToInt32(schemaView.Bounds.Left + 100);
            pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 100);
            mainWindow.Mouse.Location = pt;

            Core.InputDevices.Mouse.LeftDown();
            pt.X = Convert.ToInt32(schemaView.Bounds.Left + 200);
            pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 200);
            mainWindow.Mouse.Location = pt;
            Core.InputDevices.Mouse.LeftUp();

            //Select Selection tool
            toolbox.Select(ToolBoxWrapper.Entries.Selection);

            //Select object
            pt.X = Convert.ToInt32(schemaView.Bounds.Left + 150);
            pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 150);
            mainWindow.Mouse.Location = pt;
            mainWindow.Mouse.Click();

            Menu editMenu = mainWindow.MenuBar.MenuItem("Edit");

            Assert.IsNotNull(editMenu);
            editMenu.Click();
            editMenu.SubMenu("Associate with data...").Click();

            //Tune binding
            BindingDialogWrapper bindingDlg = new BindingDialogWrapper(app);

            bindingDlg.SelectProperty("Height");
            bindingDlg.CreateBinding("Bind to numeric value");
            //bindingDlg.CreateBinding("Numeric expression binding");

            bindingDlg.DblClickChannel("Data Simulator", "variable_1");

            Label channelNameLabel = bindingDlg.Window.Get <Label>(SearchCriteria.ByAutomationId("channelNameLabel"));

            Assert.AreEqual("variable_1 [Data Simulator]", channelNameLabel.Text);

            bindingDlg.Close(true);
        }
コード例 #2
0
        public void CreatePolyline()
        {
            Helpers.CreateNewSchema(mainWindow);
            Panel schemaView = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("SchemaCanvas"));

            Assert.IsNotNull(schemaView);
            ToolBoxWrapper toolbox = new ToolBoxWrapper(mainWindow);

            toolbox.Select(ToolBoxWrapper.Entries.Polyline);

            //Draw rect
            System.Drawing.Point pt = new System.Drawing.Point();

            pt.X = Convert.ToInt32(schemaView.Bounds.Left + 100);
            pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 100);
            mainWindow.Mouse.Location = pt;
            mainWindow.Mouse.Click();

            pt.X = Convert.ToInt32(schemaView.Bounds.Left + 200);
            pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 200);
            mainWindow.Mouse.Location = pt;
            mainWindow.Mouse.Click();

            pt.X = Convert.ToInt32(schemaView.Bounds.Left + 300);
            pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 100);
            mainWindow.Mouse.Location = pt;
            mainWindow.Mouse.Click();

            mainWindow.Mouse.RightClick();


            //Select Selection tool
            toolbox.Select(ToolBoxWrapper.Entries.Selection);

            //Select object
            pt.X = Convert.ToInt32(schemaView.Bounds.Left + 200);
            pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 200);
            mainWindow.Mouse.Location = pt;
            mainWindow.Mouse.Click();

            //Check values of property grid
            Assert.IsTrue(Helpers.GetPropertyGridValue(mainWindow, "Height") as string == "100");
            Assert.IsTrue(Helpers.GetPropertyGridValue(mainWindow, "Width") as string == "200");
        }
コード例 #3
0
        public void CreateRectangularElements()
        {
            ToolBoxWrapper.Entries[] elements = new ToolBoxWrapper.Entries[]
            {
                ToolBoxWrapper.Entries.Rectangle,
                ToolBoxWrapper.Entries.TextBox,
                ToolBoxWrapper.Entries.Button,
                ToolBoxWrapper.Entries.ProgressBar,
                ToolBoxWrapper.Entries.ScrollBar,
                ToolBoxWrapper.Entries.Image,
                ToolBoxWrapper.Entries.Slider,
                ToolBoxWrapper.Entries.Checkbox
            };

            foreach (ToolBoxWrapper.Entries entry in elements)
            {
                Helpers.CreateNewSchema(mainWindow);
                Panel schemaView = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("SchemaCanvas"));
                Assert.IsNotNull(schemaView);
                ToolBoxWrapper toolbox = new ToolBoxWrapper(mainWindow);

                toolbox.Select(entry);

                //Draw rect
                DoRectCreationByMouse(schemaView, 100, 100, 200, 200);

                //Select Selection tool
                toolbox.Select(ToolBoxWrapper.Entries.Selection);

                //Select object
                System.Drawing.Point pt = new System.Drawing.Point();
                pt.X = Convert.ToInt32(schemaView.Bounds.Left + 150);
                pt.Y = Convert.ToInt32(schemaView.Bounds.Top + 150);
                mainWindow.Mouse.Location = pt;
                mainWindow.Mouse.Click();

                //Check values of property grid
                Assert.IsTrue(Helpers.GetPropertyGridValue(mainWindow, "Height") as string == "100");
                Assert.IsTrue(Helpers.GetPropertyGridValue(mainWindow, "Width") as string == "100");
            }
        }
コード例 #4
0
        public void CheckCommandsWithoutSelectionTool()
        {
            Helpers.CreateNewSchema(mainWindow);
            Panel schemaView = mainWindow.Get <Panel>(SearchCriteria.ByAutomationId("SchemaCanvas"));

            Assert.IsNotNull(schemaView);
            ToolBoxWrapper toolbox = new ToolBoxWrapper(mainWindow);

            toolbox.Select(ToolBoxWrapper.Entries.Rectangle);

            //Draw rect
            DoRectCreationByMouse(schemaView, 100, 100, 200, 200);


            Menu editMenu = mainWindow.MenuBar.MenuItem("Edit");

            Assert.IsNotNull(editMenu);
            editMenu.Click();

            Menu cutCmd = editMenu.SubMenu("Cut");

            Assert.IsNotNull(cutCmd);
            Assert.IsTrue(cutCmd.Visible);
            Assert.IsTrue(cutCmd.Enabled);

            Menu copyCmd = editMenu.SubMenu("Copy");

            Assert.IsNotNull(copyCmd);
            Assert.IsTrue(copyCmd.Visible);
            Assert.IsTrue(copyCmd.Enabled);

            Menu bindCmd = editMenu.SubMenu("Associate with data...");

            Assert.IsNotNull(bindCmd);
            Assert.IsTrue(bindCmd.Visible);
            Assert.IsTrue(bindCmd.Enabled);
        }