public void Copy2Paste3Cell()
        {
            DataTable table = CreateTableForCopyPaste();

            Assert.AreEqual(0, table.Rows[0].ItemArray[1]);
            Assert.AreEqual(1, table.Rows[1].ItemArray[1]);
            Assert.AreEqual(2, table.Rows[2].ItemArray[1]);
            Assert.AreEqual(3, table.Rows[3].ItemArray[1]);
            Assert.AreEqual(4, table.Rows[4].ItemArray[1]);

            var tableView = new TableView { Data = table };
            Action<Form> onShown = delegate
            {
                tableView.Focus();
                SendKeys.SendWait("{RIGHT}"); // goto row 1 column 2
                SendKeys.SendWait("+{DOWN}"); // also select cell below
                SendKeys.SendWait("^c"); // copy cells
                SendKeys.SendWait("{DOWN}"); // navigate to cell below
                SendKeys.SendWait("+{DOWN}+{DOWN}"); // also select 2 cells below
                SendKeys.SendWait("^v"); // paste
                Assert.AreEqual(0, table.Rows[0].ItemArray[1]);
                Assert.AreEqual(1, table.Rows[1].ItemArray[1]);
                Assert.AreEqual(0, table.Rows[2].ItemArray[1]); // paste 0 1 to 2 3 4 expects pattern 0 1 0
                Assert.AreEqual(1, table.Rows[3].ItemArray[1]);
                Assert.AreEqual(0, table.Rows[4].ItemArray[1]);
            };

            WindowsFormsTestHelper.ShowModal(tableView, onShown);
        }
Beispiel #2
0
        public void FillOutCustomClass()
        {
            //don't run on on buildserver because the keys will go everywhere ;)
            if (WindowsFormsTestHelper.IsBuildServer)
                return;
            var persons = new BindingList<Person>();
            var tableView = new TableView { Data = persons };
            bool ranOnShown = false;

            Action<Form> onShown = delegate
            {
                tableView.Focus();
                SendKeys.SendWait("J"); // goto row 1 column 2
                SendKeys.SendWait("{RIGHT}"); // goto row 1 column 2
                SendKeys.SendWait("3"); // also select cell below
                SendKeys.SendWait("{DOWN}"); //commit cells

                Assert.AreEqual(1, persons.Count);
                ranOnShown = true;
            };
            WindowsFormsTestHelper.Show(tableView, onShown);
            Assert.IsTrue(ranOnShown);
        }
Beispiel #3
0
        public void Copy1Paste1Cell()
        {
            DataTable table = CreateTableForCopyPaste();

            Assert.AreEqual(0, table.Rows[0].ItemArray[1]);
            Assert.AreEqual(1, table.Rows[1].ItemArray[1]);

            var tableView = new TableView { Data = table };
            Action<Form> onShown = delegate
            {
                tableView.Focus();
                SendKeys.SendWait("{RIGHT}"); // goto row 1 column 2
                SendKeys.SendWait("^c"); // copy cell
                SendKeys.SendWait("{DOWN}"); // navigate to cell below
                SendKeys.SendWait("^v"); // paste
            };
            WindowsFormsTestHelper.ShowModal(tableView, onShown);
            Assert.AreEqual(0, table.Rows[0].ItemArray[1]);
            Assert.AreEqual(0, table.Rows[1].ItemArray[1]);
        }