public void TestEmulateDelete() { FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]()); //行追加 dataGridview.EmulateCellCheck(1, 0, true); dataGridview.EmulateCellCheck(1, 1, true); dataGridview.EmulateCellCheck(1, 2, true); //削除 dataGridview.EmulateClearSelection(); dataGridview.EmulateChangeRowSelected(new RowSelectedInfo(1, true)); dataGridview.EmulateDelete(); Assert.AreEqual(3, dataGridview.RowCount); //非同期 dataGridview.EmulateClearSelection(); dataGridview.EmulateChangeRowSelected(new RowSelectedInfo(1, true)); app[GetType(), "UserDeletedRowEvent"](dataGridview.AppVar); dataGridview.EmulateDelete(new Async()); new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK"); Assert.AreEqual(2, dataGridview.RowCount); //行クリア dataGridview["Rows"]()["Clear"](); }
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"](); }
public void TestEmulateClickCellContent() { FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]()); //行追加 dataGridview.EmulateCellCheck(1, 0, true); //ボタンクリック app[GetType(), "_testCol"](-1); app[GetType(), "CellContentClickEvent"](dataGridview.AppVar); dataGridview.EmulateClickCellContent(3, 0); Assert.AreEqual(3, (int)app[GetType(), "_testCol"]().Core); //リンククリック app[GetType(), "_testCol"](-1); app[GetType(), "CellContentClickEvent"](dataGridview.AppVar); dataGridview.EmulateClickCellContent(4, 0); Assert.AreEqual(4, (int)app[GetType(), "_testCol"]().Core); //非同期 app[GetType(), "_testCol"](-1); app[GetType(), "CellContentClickEventMessage"](dataGridview.AppVar); dataGridview.EmulateClickCellContent(3, 0, new Async()); new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK"); Assert.AreEqual(3, (int)app[GetType(), "_testCol"]().Core); //行クリア dataGridview["Rows"]()["Clear"](); }
public void TestEmulateCellCheck() { FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]()); //チェック dataGridview.EmulateCellCheck(1, 0, true); Assert.AreEqual(true.ToString(), dataGridview.GetText(1, 0)); //非同期 app[GetType(), "CellEndEditEvent"](dataGridview.AppVar); dataGridview.EmulateCellCheck(1, 0, false, new Async()); new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK"); Assert.AreEqual(false.ToString(), dataGridview.GetText(1, 0)); //行クリア dataGridview["Rows"]()["Clear"](); }
public void TestEmulateChangeRowSelectedSelectedRows2() { FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]()); //行追加 dataGridview.EmulateCellCheck(1, 0, true); dataGridview.EmulateCellCheck(1, 1, true); dataGridview.EmulateCellCheck(1, 2, true); //行選択テスト dataGridview.EmulateClearSelection(); dataGridview.EmulateChangeRowSelected(new RowSelectedInfo(1, true)); dataGridview.EmulateChangeRowSelected(new RowSelectedInfo(2, true)); AssertEx.AreEqual(new int[] { 1, 2 }, dataGridview.SelectedRows); //行クリア dataGridview["Rows"]()["Clear"](); }
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 TestEmulateChangeRowSelectedSelectedRows() { FormsDataGridView dataGridview = new FormsDataGridView(testDlg["dataGridView"]()); //行追加 dataGridview.EmulateCellCheck(1, 0, true); dataGridview.EmulateCellCheck(1, 1, true); dataGridview.EmulateCellCheck(1, 2, true); //行選択テスト dataGridview.EmulateClearSelection(); dataGridview.EmulateChangeRowSelected(new RowSelectedInfo(1, true), new RowSelectedInfo(2, true)); AssertEx.AreEqual(new int[] { 1, 2 }, dataGridview.SelectedRows); //非同期 app[GetType(), "SelectionChangedEvent"](dataGridview.AppVar); dataGridview.EmulateChangeRowSelected(new Async(), new RowSelectedInfo(1, false)); new NativeMessageBox(testDlg.WaitForNextModal()).EmulateButtonClick("OK"); AssertEx.AreEqual(new int[] { 2 }, dataGridview.SelectedRows); //行クリア dataGridview["Rows"]()["Clear"](); }