Пример #1
0
        public void TestGetFormattedText()
        {
            FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]());

            //テストデータ
            dataGridview.EmulateChangeCellText(0, 0, "a");
            dataGridview.EmulateChangeCellText(0, 1, "b");
            dataGridview.EmulateChangeCellText(0, 2, "c");
            dataGridview.EmulateCellCheck(1, 0, true);
            dataGridview.EmulateCellCheck(1, 2, true);
            dataGridview.EmulateChangeCellText(5, 0, "1234");
            dataGridview.EmulateChangeCellText(5, 1, "5678");

            Assert.AreEqual(false.ToString(), dataGridview.GetFormattedText(1, 1));
            Assert.AreEqual(@"¥1,234.00", dataGridview.GetFormattedText(5, 0));
            AssertEx.AreEqual(new string[][] {
                new string[] { "a", true.ToString(), string.Empty, string.Empty, "link", @"¥1,234.00" },
                new string[] { "b", false.ToString(), string.Empty, string.Empty, "link", @"¥5,678.00" },
                new string[] { "c", true.ToString(), string.Empty, string.Empty, "link", string.Empty }
            },
                              dataGridview.GetFormattedText(0, 0, 5, 2));

            //行クリア
            dataGridview["Rows"]()["Clear"]();
        }
Пример #2
0
        public void TestRowCount()
        {
            FormsDataGridView datagridview = new FormsDataGridView(testDlg["dataGridView"]());

            datagridview.EmulateChangeCellText(0, 0, "a");
            Assert.AreEqual(2, datagridview.RowCount);
            datagridview["Rows"]()["Clear"]();
        }
Пример #3
0
        public void TestEmulateChangeCellText()
        {
            FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]());

            //テキスト変更
            dataGridview.EmulateChangeCellText(0, 0, "abc");
            Assert.AreEqual("abc", dataGridview.GetText(0, 0));

            //非同期
            app[GetType(), "CellEndEditEvent"](dataGridview.AppVar);
            dataGridview.EmulateChangeCellText(0, 0, "efg", new Async());
            new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK");
            Assert.AreEqual("efg", dataGridview.GetText(0, 0));

            //行クリア
            dataGridview["Rows"]()["Clear"]();
        }
Пример #4
0
        public void TestGetText()
        {
            FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]());

            //テストデータ
            dataGridview.EmulateChangeCellText(0, 0, "a");
            dataGridview.EmulateChangeCellText(0, 1, "b");
            dataGridview.EmulateChangeCellText(0, 2, "c");
            dataGridview.EmulateCellCheck(1, 0, true);
            dataGridview.EmulateCellCheck(1, 2, true);

            Assert.AreEqual("b", dataGridview.GetText(0, 1));
            AssertEx.AreEqual(new string[][] { new string[] { "a", true.ToString() },
                                               new string[] { "b", string.Empty },
                                               new string[] { "c", true.ToString() } }, dataGridview.GetText(0, 0, 1, 2));

            //行クリア
            dataGridview["Rows"]()["Clear"]();
        }
        public void WinForms()
        {
            var app = new WindowsAppFriend(Process.Start("WinForms.exe"));
            var form = app.Type().System.Windows.Forms.Application.OpenForms[0];
            WindowsAppExpander.LoadAssembly(app, GetType().Assembly);

            var _grid = form._grid;
            _grid.CurrentCell = _grid[0, 0];
            app.Type(GetType()).Edit(_grid, "abc");

            var wrap = new FormsDataGridView(_grid);
            wrap.EmulateChangeCellText(0, 1, "xyz");

            Process.GetProcessById(app.ProcessId).Kill();
        }