Пример #1
0
        public static void StatsWin_Handler(CustomWindowTest formTest, Form frm, string stageMessage)
        {
            Assert.IsInstanceOf(typeof(StatisticsWin), frm, stageMessage);

            formTest.ModalFormHandler = SaveFile_Cancel_Handler;
            ClickToolStripButton("tbExcelExport", frm);

            KeyDownForm(frm.Name, Keys.Escape);
            frm.Dispose();
        }
Пример #2
0
        public static void MapsViewerWin_Handler(CustomWindowTest formTest, Form form, string stageMessage)
        {
            Assert.IsInstanceOf(typeof(MapsViewerWin), form, stageMessage);

            ClickRadioButton("radTotal", form);

            formTest.ModalFormHandler = SaveFile_Cancel_Handler;
            ClickButton("btnSaveImage", form);

            KeyDownForm(form.Name, Keys.Escape);
            form.Dispose();
        }
Пример #3
0
        public static void TreeChartWin_Tests(CustomWindowTest formTest, Form mainWin, Form frm, TreeChartKind kind, string stage, string checkXRef)
        {
            Assert.IsInstanceOf(typeof(TreeChartWin), frm, stage);

            TreeChartWin tcWin = frm as TreeChartWin;

            IBaseWindow curBase = tcWin.Base;

            Assert.IsNotNull(curBase);

            Assert.AreEqual(kind, ((ITreeChartWin)tcWin).TreeBox.Model.Kind);
            tcWin.UpdateSettings();

            Assert.IsTrue(tcWin.AllowFilter());
            Assert.IsTrue(tcWin.AllowQuickSearch());
            Assert.IsTrue(tcWin.AllowPrint());

            // forced update
            tcWin.Refresh();

            Assert.Throws(typeof(ArgumentNullException), () => { tcWin.SelectByRec(null); });

            GDMIndividualRecord iRec = curBase.GetSelectedPerson();

            Assert.AreEqual(checkXRef, iRec.XRef);
            tcWin.SelectByRec(iRec);

            KeyDownForm(tcWin.Name, Keys.F5);
            KeyDownForm(tcWin.Name, Keys.F6);
            KeyDownForm(tcWin.Name, Keys.F7);

            //KeyDownForm(tcWin.Name, Keys.F | Keys.Control);

            tcWin.NavPrev();
            tcWin.NavNext();

            formTest.ModalFormHandler = TreeFilterDlgTests.TreeFilterDlg_btnAccept_Handler;
            tcWin.SetFilter();

            IList <ISearchResult> search = tcWin.FindAll("Maria");

            Assert.AreEqual(1, search.Count);

            ClickToolStripMenuItem("miGens9", tcWin);
            ClickToolStripMenuItem("miGens8", tcWin);
            ClickToolStripMenuItem("miGens7", tcWin);
            ClickToolStripMenuItem("miGens6", tcWin);
            ClickToolStripMenuItem("miGens5", tcWin);
            ClickToolStripMenuItem("miGens4", tcWin);
            ClickToolStripMenuItem("miGens3", tcWin);
            ClickToolStripMenuItem("miGens2", tcWin);
            ClickToolStripMenuItem("miGens1", tcWin);
            ClickToolStripMenuItem("miGensInf", tcWin);

            ClickToolStripMenuItem("miModeBoth", tcWin);
            ClickToolStripMenuItem("miModeAncestors", tcWin);
            ClickToolStripMenuItem("miModeDescendants", tcWin);

            ClickToolStripMenuItem("miCertaintyIndex", tcWin);
            ClickToolStripMenuItem("miTraceKinships", tcWin);
            ClickToolStripMenuItem("miTraceSelected", tcWin);

            var ctl = new ControlTester("fTreeBox", frm);

            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Add));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Subtract));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Back));
            ctl.FireEvent("DoubleClick", new EventArgs());

            formTest.Mouse.UseOn(ctl);

            int sx = 10 + 20;
            int sy = ctl.Properties.Height / 2;

            formTest.Mouse.Hover(sx, sy);
            formTest.Mouse.Press(MouseButtons.Left);
            formTest.Mouse.Hover(sx, sy + 20); // generations control
            formTest.Mouse.Release(MouseButtons.Left);

            sx = ctl.Properties.Width - 10 - 30;
            formTest.Mouse.Hover(sx, sy);
            formTest.Mouse.Press(MouseButtons.Left);
            formTest.Mouse.Hover(sx, sy + 20); // scale control
            formTest.Mouse.Release(MouseButtons.Left);

            //

            var tbox = ctl.Properties as TreeChartBox;

            Assert.IsNotNull(tbox);

            // handlers tests
            //ClickToolStripMenuItem("miEdit", tcWin);
            //ClickToolStripMenuItem("miFatherAdd", tcWin);
            //ClickToolStripMenuItem("miMotherAdd", tcWin);
            //ClickToolStripMenuItem("miSpouseAdd", tcWin);
            //ClickToolStripMenuItem("miSonAdd", tcWin);
            //ClickToolStripMenuItem("miDaughterAdd", tcWin);
            //ClickToolStripMenuItem("miFamilyAdd", tcWin);
            //ClickToolStripMenuItem("miDelete", tcWin);
            //ClickToolStripMenuItem("miRebuildKinships", tcWin);
            //ClickToolStripMenuItem("miFillColor", tcWin);
            //ClickToolStripMenuItem("miFillImage", tcWin);
            //ClickToolStripMenuItem("miRebuildTree", tcWin);

            formTest.ModalFormHandler = SaveFileJPG_Handler;
            ClickToolStripButton("tbImageSave", tcWin);

            // FIXME exception!
            //ModalFormHandler = SaveSnapshotEMF_Handler;
            //ClickToolStripButton("tbImageSave", tcWin);

            formTest.ModalFormHandler = SaveFileSVG_Handler;
            ClickToolStripButton("tbImageSave", tcWin);

            //ModalFormHandler = PrintPreviewDialog_Handler;
            //ClickToolStripButton("tbDocPrint", fMainWin);

            try {
                formTest.ModalFormHandler = PrintDialog_Handler;
                ClickToolStripButton("tbDocPreview", mainWin);
            } catch (Exception) {
                // AppVeyor tests crashed, because "No printers are installed"
                // No Fail, or Ignore, or etc - not yet divide this test into smaller correct parts
            }

            KeyDownForm(frm.Name, Keys.Escape);
            frm.Dispose();
        }
Пример #4
0
        public static void CircleChartWin_Tests(CustomWindowTest formTest, Form frm, string stage)
        {
            Assert.IsInstanceOf(typeof(CircleChartWin), frm, stage);

            CircleChartWin ccWin = frm as CircleChartWin;

            IBaseWindow curBase = ccWin.Base;

            Assert.IsNotNull(curBase);

            ccWin.UpdateSettings();

            Assert.IsFalse(ccWin.AllowFilter());
            Assert.IsFalse(ccWin.AllowQuickSearch());
            Assert.IsTrue(ccWin.AllowPrint());

            // forced update
            ccWin.Refresh();

            Assert.IsFalse(ccWin.NavCanBackward());
            ccWin.NavPrev();
            Assert.IsFalse(ccWin.NavCanForward());
            ccWin.NavNext();

            var ctl = new ControlTester("fCircleChart", frm);

            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Add));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Subtract));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Left));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Back));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Right));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.D0 | Keys.Control));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Up));
            ctl.FireEvent("KeyDown", new KeyEventArgs(Keys.Down));

            ctl.FireEvent("DoubleClick", new EventArgs());
            ctl.Properties.Refresh();
            ctl.FireEvent("DoubleClick", new EventArgs());

            // empty methods
            Assert.IsNotNull(ccWin.FindAll(""));
            ccWin.QuickSearch();
            ccWin.SelectByRec(null);
            ccWin.SetFilter();

            try {
                formTest.ModalFormHandler = SaveFileJPG_Handler;
                ClickToolStripButton("tbImageSave", ccWin);
            } finally {
                TestUtils.RemoveTestFile(TestUtils.GetTempFilePath("test.jpg"));
            }

            // FIXME exception!
            //ModalFormHandler = SaveFileEMF_Handler;
            //ClickToolStripButton("tbImageSave", ccWin);

            try {
                formTest.ModalFormHandler = SaveFileSVG_Handler;
                ClickToolStripButton("tbImageSave", ccWin);
            } finally {
                TestUtils.RemoveTestFile(TestUtils.GetTempFilePath("test.svg"));
            }

            KeyDownForm(frm.Name, Keys.Escape);
            frm.Dispose();
        }