Пример #1
0
        public static void EventEditDlg_Select_Handler(string name, IntPtr ptr, Form form)
        {
            EventEditDlg eventDlg = (EventEditDlg)form;

            Assert.IsNotNull(eventDlg.Event);

            SelectCombo("cmbEventType", form, 1);     // Birth(indi) / ?(fam)
            EnterText("txtEventPlace", form, "test place");
            SelectCombo("cmbEventDateType", form, 3); // Between
            EnterMaskedText("txtEventDate1", form, "01.01.1900");
            EnterMaskedText("txtEventDate2", form, "10.01.1900");
            SelectCombo("cmbDate1Calendar", form, 1); // Julian
            SelectCombo("cmbDate2Calendar", form, 1); // Julian
            EnterText("txtEventCause", form, "test cause");
            EnterText("txtEventOrg", form, "test agency");

            SetModalFormHandler(fFormTest, AddressEditDlgTests.AddressEditDlg_btnAccept_Handler);
            ClickButton("btnAddress", form);

            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, LocationEditDlgTests.LocationAdd_Mini_Handler);
            ClickButton("btnPlaceAdd", form);

            ClickButton("btnPlaceDelete", form);

            ClickButton("btnAccept", form);
        }
        public static void RelationshipCalculatorDlg_Handler(string name, IntPtr ptr, Form form)
        {
            RelationshipCalculatorDlg dlg = (RelationshipCalculatorDlg)form;
            IBaseContext baseContext = dlg.Base.Context;

            Assert.IsTrue(baseContext.Tree.RecordsCount > 1);

            GDMIndividualRecord iRec1 = baseContext.Tree.XRefIndex_Find("I1") as GDMIndividualRecord;
            Assert.IsNotNull(iRec1);
            Assert.AreEqual("Ivanov Ivan Ivanovich", GKUtils.GetRecordName(baseContext.Tree, iRec1, false));
            GDMIndividualRecord iRec2 = baseContext.Tree.XRefIndex_Find("I2") as GDMIndividualRecord;
            Assert.IsNotNull(iRec2);
            Assert.AreEqual("Ivanova Maria Petrovna", GKUtils.GetRecordName(baseContext.Tree, iRec2, false));

            WFAppHost.TEST_MODE = true; // FIXME: dirty hack

            RecordSelectDlgTests.SetSelectItemHandler(0);
            ClickButton("btnRec1Select", form);
            RecordSelectDlgTests.SetSelectItemHandler(1);
            ClickButton("btnRec2Select", form);

            var txtResult = new TextBoxTester("txtResult", form);
            // default is not Russian culture
            Assert.AreEqual("Ivanova Maria Petrovna is wife of Ivanov Ivan Ivanovich", txtResult.Text); // :D

            ClickButton("btnClose", form);
        }
Пример #3
0
        public static void ResearchEditDlg_Handler(ResearchEditDlg dlg)
        {
            GDMResearchRecord resRecord = dlg.Research;

            // tasks
            SelectTab("tabsData", dlg, 0);
            Assert.AreEqual(0, resRecord.Tasks.Count);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, TaskEditDlgTests.TaskAdd_Mini_Handler);
            ClickToolStripButton("fTasksList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, resRecord.Tasks.Count);

            SelectSheetListItem("fTasksList", dlg, 0);
            SetModalFormHandler(fFormTest, TaskEditDlgTests.TaskAdd_Mini_Handler);
            ClickToolStripButton("fTasksList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, resRecord.Tasks.Count);

            SelectSheetListItem("fTasksList", dlg, 0);
            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            ClickToolStripButton("fTasksList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, resRecord.Tasks.Count);

            // communications
            SelectTab("tabsData", dlg, 1);
            Assert.AreEqual(0, resRecord.Communications.Count);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, CommunicationEditDlgTests.CommunicationAdd_Mini_Handler);
            ClickToolStripButton("fCommunicationsList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, resRecord.Communications.Count);

            SelectSheetListItem("fCommunicationsList", dlg, 0);
            SetModalFormHandler(fFormTest, CommunicationEditDlgTests.CommunicationAdd_Mini_Handler);
            ClickToolStripButton("fCommunicationsList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, resRecord.Communications.Count);

            SelectSheetListItem("fCommunicationsList", dlg, 0);
            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            ClickToolStripButton("fCommunicationsList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, resRecord.Communications.Count);

            // groups
            SelectTab("tabsData", dlg, 2);
            Assert.AreEqual(0, resRecord.Groups.Count);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, GroupEditDlgTests.GroupAdd_Mini_Handler);
            ClickToolStripButton("fGroupsList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, resRecord.Groups.Count);
            Assert.AreEqual("sample group", ((GDMGroupRecord)resRecord.Groups[0].Value).GroupName);

            SelectSheetListItem("fGroupsList", dlg, 0);
            SetModalFormHandler(fFormTest, GroupEditDlgTests.GroupAdd_Mini_Handler);
            ClickToolStripButton("fGroupsList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, resRecord.Groups.Count);

            SelectSheetListItem("fGroupsList", dlg, 0);
            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            ClickToolStripButton("fGroupsList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, resRecord.Groups.Count);

            ClickButton("btnAccept", dlg);
        }
Пример #4
0
        private void StructsDlg_Handler(GDMRecordWithEvents record, Form dlg, TabControlTester tabs, int[] tabIndexes)
        {
            WFAppHost.TEST_MODE = true; // FIXME: dirty hack

            // notes
            Assert.AreEqual(0, record.Notes.Count);
            tabs.SelectTab(tabIndexes[0]);
            RecordSelectDlgTests.SetSelectItemHandler(0);
            ClickToolStripButton("fNotesList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, record.Notes.Count);

            SelectSheetListItem("fNotesList", dlg, 0);
            ClickToolStripButton("fNotesList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, record.Notes.Count);

            ModalFormHandler = MessageBox_YesHandler;
            SelectSheetListItem("fNotesList", dlg, 0);
            ClickToolStripButton("fNotesList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, record.Notes.Count);

            // media
            Assert.AreEqual(0, record.MultimediaLinks.Count);
            tabs.SelectTab(tabIndexes[1]);
            RecordSelectDlgTests.SetSelectItemHandler(0);
            ClickToolStripButton("fMediaList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, record.MultimediaLinks.Count);

            SelectSheetListItem("fMediaList", dlg, 0);
            ClickToolStripButton("fMediaList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, record.MultimediaLinks.Count);

            ModalFormHandler = MessageBox_YesHandler;
            SelectSheetListItem("fMediaList", dlg, 0);
            ClickToolStripButton("fMediaList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, record.MultimediaLinks.Count);

            // sources
            Assert.AreEqual(0, record.SourceCitations.Count);
            tabs.SelectTab(tabIndexes[2]);
            ModalFormHandler = SourceCitEditDlgTests.AcceptModalHandler;
            ClickToolStripButton("fSourcesList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, record.SourceCitations.Count);

            SelectSheetListItem("fSourcesList", dlg, 0);
            ClickToolStripButton("fSourcesList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, record.SourceCitations.Count);

            ModalFormHandler = MessageBox_YesHandler;
            SelectSheetListItem("fSourcesList", dlg, 0);
            ClickToolStripButton("fSourcesList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, record.SourceCitations.Count);
        }
Пример #5
0
        public static void GroupEditDlg_Handler(GroupEditDlg dlg)
        {
            GDMGroupRecord groupRecord = dlg.Group;

            // members
            Assert.AreEqual(0, groupRecord.Members.Count);
            RecordSelectDlgTests.SetSelectItemHandler(fFormTest, 0);
            ClickToolStripButton("fMembersList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, groupRecord.Members.Count);

            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            SelectSheetListItem("fMembersList", dlg, 0);
            ClickToolStripButton("fMembersList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, groupRecord.Members.Count);

            ClickButton("btnAccept", dlg);
        }
Пример #6
0
        public static void SourceEditDlg_Handler(SourceEditDlg dlg)
        {
            GDMSourceRecord srcRecord = dlg.Model;

            SelectTab("tabsData", dlg, 2);

            // repositories
            Assert.AreEqual(0, srcRecord.RepositoryCitations.Count);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, TaskEditDlgTests.TaskAdd_Mini_Handler);
            ClickToolStripButton("fRepositoriesList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, srcRecord.RepositoryCitations.Count);

            SelectSheetListItem("fRepositoriesList", dlg, 0);
            SetModalFormHandler(fFormTest, MessageBox_YesHandler);
            ClickToolStripButton("fRepositoriesList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, srcRecord.RepositoryCitations.Count);

            ClickButton("btnAccept", dlg);
        }
Пример #7
0
        public static void TaskEditDlg_Handler(TaskEditDlg dlg)
        {
            SelectCombo("cmbGoalType", dlg, 3);
            ClickButton("btnGoalSelect", dlg);

            SelectCombo("cmbGoalType", dlg, 2);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, SourceEditDlgTests.SourceAdd_Mini_Handler);
            ClickButton("btnGoalSelect", dlg);

            SelectCombo("cmbGoalType", dlg, 1);
            RecordSelectDlgTests.SetCreateItemHandler(fFormTest, FamilyEditDlgTests.FamilyAdd_Mini_Handler);
            ClickButton("btnGoalSelect", dlg);

            SelectCombo("cmbGoalType", dlg, 0);
            PersonEditDlgTests.SetCreateIndividualHandler(fFormTest, GDMSex.svMale);
            ClickButton("btnGoalSelect", dlg);

            ClickButton("btnAccept", dlg);
        }
Пример #8
0
        public static void RecMergeDlg_Handler(string name, IntPtr ptr, Form form)
        {
            var tabs = new TabControlTester("tabsTools", form);

            CheckBox("chkBookmarkMerged", form, true);
            CheckBox("chkBookmarkMerged", form, false);

            var radPersons = new RadioButtonTester("radPersons", form);

            radPersons.Properties.Checked = true;

            RecordSelectDlgTests.SetSelectItemHandler(0);
            ClickButton("MergeControl.btnRec1Select", form);

            RecordSelectDlgTests.SetSelectItemHandler(1);
            ClickButton("MergeControl.btnRec2Select", form);

            ClickButton("btnAutoSearch", form);

            ClickButton("btnSkip", form);

            form.Close();
        }
Пример #9
0
 public static void SetCreateIndividualHandler(NUnitFormTest formTest, GDMSex needIndividualSex)
 {
     fNeedIndividualSex = needIndividualSex;
     RecordSelectDlgTests.SetCreateItemHandler(formTest, IndividualAdd_Mini_Handler);
 }
Пример #10
0
        private void PersonEditDlg_Handler(PersonEditDlg dlg)
        {
            GDMIndividualRecord indiRecord = dlg.Person;

            SelectCombo("cmbSex", dlg, 1); // male

            var tabs = new TabControlTester("tabsPersonData", dlg);

            var cmbRestriction = new ComboBoxTester("cmbRestriction", dlg);

            cmbRestriction.Select(3);
            cmbRestriction.Select(2);
            cmbRestriction.Select(1);
            cmbRestriction.Select(0);

            var txtSurname = new TextBoxTester("txtSurname", dlg);

            txtSurname.FireEvent("KeyDown", new KeyEventArgs(Keys.Down | Keys.Control));

            // parents
            RecordSelectDlgTests.SetCreateItemHandler(this, FamilyEditDlgTests.FamilyAdd_Mini_Handler);
            ClickButton("btnParentsAdd", dlg);
            ModalFormHandler = MessageBox_YesHandler;
            ClickButton("btnParentsDelete", dlg);

            // father
            PersonEditDlgTests.SetCreateIndividualHandler(this, GDMSex.svMale);
            ClickButton("btnFatherAdd", dlg);
            ModalFormHandler = MessageBox_YesHandler;
            ClickButton("btnFatherDelete", dlg);

            // mother
            PersonEditDlgTests.SetCreateIndividualHandler(this, GDMSex.svFemale);
            ClickButton("btnMotherAdd", dlg);
            ModalFormHandler = MessageBox_YesHandler;
            ClickButton("btnMotherDelete", dlg);

            ClickButton("btnNameCopy", dlg);

            // events
            tabs.SelectTab(0);
            Assert.AreEqual(1, indiRecord.Events.Count);
            SetModalFormHandler(this, EventEditDlgTests.EventEditDlg_Select_Handler);
            ClickToolStripButton("fEventsList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(2, indiRecord.Events.Count);

            SelectSheetListItem("fEventsList", dlg, 1);
            SetModalFormHandler(this, EventEditDlgTests.EventEditDlg_Select_Handler);
            ClickToolStripButton("fEventsList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(2, indiRecord.Events.Count);

            ModalFormHandler = MessageBox_YesHandler;
            SelectSheetListItem("fEventsList", dlg, 1);
            ClickToolStripButton("fEventsList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(1, indiRecord.Events.Count);

            // spouses
            tabs.SelectTab(1);
            Assert.AreEqual(0, indiRecord.SpouseToFamilyLinks.Count);
            ModalFormHandler = FamilyEditDlgTests.SpouseEdit_Handler;
            ClickToolStripButton("fSpousesList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, indiRecord.SpouseToFamilyLinks.Count);

            SelectSheetListItem("fSpousesList", dlg, 1);
            ModalFormHandler = FamilyEditDlgTests.SpouseEdit_Handler;
            ClickToolStripButton("fSpousesList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(1, indiRecord.SpouseToFamilyLinks.Count);

            SelectSheetListItem("fSpousesList", dlg, 1);
            ModalFormHandler = MessageBox_YesHandler;
            ClickToolStripButton("fSpousesList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, indiRecord.SpouseToFamilyLinks.Count);

            // names
            tabs.SelectTab(2);
            Assert.AreEqual(1, indiRecord.PersonalNames.Count);
            ModalFormHandler = PersonalNameEditDlgTests.NameEditAdd_Handler;
            ClickToolStripButton("fNamesList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(2, indiRecord.PersonalNames.Count);
            Assert.AreEqual("sample surname", indiRecord.PersonalNames[1].Surname);

            SelectSheetListItem("fNamesList", dlg, 1);
            ModalFormHandler = PersonalNameEditDlgTests.NameEditEdit_Handler;
            ClickToolStripButton("fNamesList_ToolBar_btnEdit", dlg);
            Assert.AreEqual(2, indiRecord.PersonalNames.Count);
            Assert.AreEqual("sample surname2", indiRecord.PersonalNames[1].Surname);

            SelectSheetListItem("fNamesList", dlg, 1);
            ModalFormHandler = MessageBox_YesHandler;
            ClickToolStripButton("fNamesList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(1, indiRecord.PersonalNames.Count);

            // associations
            tabs.SelectTab(3);
            Assert.AreEqual(0, indiRecord.Associations.Count);
            ModalFormHandler = AssociationEditDlgTests.AcceptModalHandler;
            ClickToolStripButton("fAssociationsList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, indiRecord.Associations.Count);
            Assert.AreEqual("sample relation", indiRecord.Associations[0].Relation);

            ModalFormHandler = MessageBox_YesHandler;
            SelectSheetListItem("fAssociationsList", dlg, 0);
            ClickToolStripButton("fAssociationsList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, indiRecord.Associations.Count);

            // groups
            tabs.SelectTab(4);
            Assert.AreEqual(0, indiRecord.Groups.Count);
            RecordSelectDlgTests.SetCreateItemHandler(this, GroupEditDlgTests.GroupAdd_Mini_Handler);
            ClickToolStripButton("fGroupsList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, indiRecord.Groups.Count);
            Assert.AreEqual("sample group", fCurBase.Context.Tree.GetPtrValue <GDMGroupRecord>(indiRecord.Groups[0]).GroupName);

            ModalFormHandler = MessageBox_YesHandler;
            SelectSheetListItem("fGroupsList", dlg, 0);
            ClickToolStripButton("fGroupsList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, indiRecord.Groups.Count);


            StructsDlg_Handler(indiRecord, dlg, tabs, new int[] { 5, 6, 7 });


            // userrefs
            tabs.SelectTab(8);
            Assert.AreEqual(0, indiRecord.UserReferences.Count);
            ModalFormHandler = UserRefEditDlgTests.AcceptHandler;
            ClickToolStripButton("fUserRefList_ToolBar_btnAdd", dlg);
            Assert.AreEqual(1, indiRecord.UserReferences.Count);
            Assert.AreEqual("sample reference", indiRecord.UserReferences[0].StringValue);

            ModalFormHandler = MessageBox_YesHandler;
            SelectSheetListItem("fUserRefList", dlg, 0);
            ClickToolStripButton("fUserRefList_ToolBar_btnDelete", dlg);
            Assert.AreEqual(0, indiRecord.UserReferences.Count);

            ClickButton("btnAccept", dlg);
        }