public void Test_Names_02() { using (var ctx = TestUtils.LoadResourceGEDCOMFile("test_names_02.ged")) { GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Анна Сидоровна Иванова (Петрова)", iRec1.GetPrimaryFullName()); // std-surn exists and double, and sub-surn same // sub-givn and sub-patn exists var parts = GKUtils.GetNameParts(iRec1); Assert.AreEqual("Иванова (Петрова)", parts.Surname); Assert.AreEqual("Анна", parts.Name); Assert.AreEqual("Сидоровна", parts.Patronymic); GDMIndividualRecord iRec2 = ctx.Tree.XRefIndex_Find("I2") as GDMIndividualRecord; Assert.IsNotNull(iRec2); Assert.AreEqual("Аглая Федоровна Иванова", iRec2.GetPrimaryFullName()); // std-surn exists (maiden), and sub-surn same, and sub-marn exists (married) // sub-givn and sub-patn exists parts = GKUtils.GetNameParts(iRec2); Assert.AreEqual("Иванова", parts.Surname); Assert.AreEqual("Лескова", parts.MarriedSurname); Assert.AreEqual("Аглая", parts.Name); Assert.AreEqual("Федоровна", parts.Patronymic); } }
public void Test_SimpleInput() { SelectTab("PageControl1", fDialog, 0); EnterMaskedText("EditBirthDate", fDialog, "01/01/1890"); EnterMaskedText("EditDeathDate", fDialog, "01/01/1890"); ClickButton("btnMale", fDialog); ClickButton("btnMale", fDialog); ModalFormHandler = MessageBox_OkHandler; // error ClickButton("btnParse", fDialog); EnterText("EditName", fDialog, "Иванов Иван Иванович"); EnterText("MemoNote", fDialog, "note text"); ClickButton("btnParse", fDialog); Assert.AreEqual(2, fBase.Context.Tree.RecordsCount); // indiRec + noteRec GDMIndividualRecord iRec1 = fBase.Context.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Иван Иванович Иванов", iRec1.GetPrimaryFullName()); }
public void Test_SourceInput_MK_Death() { SelectTab("PageControl1", fDialog, 1); ClickRadioButton("rbSK_Met", fDialog); // MK SelectCombo("cbEventType", fDialog, 1); // death event var dataGridView1 = new DataGridViewTester("dataGridView1", fDialog); dataGridView1.EnterCell(0, 0, fLangMan.LS(FLS.LSID_PLPerson)); dataGridView1.EnterCell(0, 1, "Анна"); dataGridView1.EnterCell(0, 2, "Васильевна"); dataGridView1.EnterCell(0, 3, "Иванова"); dataGridView1.EnterCell(0, 4, "90"); dataGridView1.EnterCell(0, 5, "test comment"); EnterCombo("cbSource", fDialog, "test source"); EnterText("edSourceYear", fDialog, "1890"); EnterText("edPage", fDialog, "12"); EnterText("edPlace", fDialog, "Сосновка"); ModalFormHandler = SexCheckDlgTests.SexCheckDlgTests_AcceptF_Handler; // NamesTable not available ClickButton("btnParse", fDialog); Assert.AreEqual(3, fBase.Context.Tree.RecordsCount); // newSourceRec + newIndiRec + newNoteRec GDMIndividualRecord iRec1 = fBase.Context.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Анна Васильевна Иванова", iRec1.GetPrimaryFullName()); }
public CBoxText(GDMIndividualRecord ir) { FirstName = ""; Surname = ""; Concealed = (!GMHelper.GetVisibility(ir)); if (Concealed && !CConfig.Instance.UseWithheldNames) { FirstName = ""; Surname = Name = CConfig.Instance.ConcealedName; } else { var irName = ir.GetPrimaryFullName(); if (irName != "") { Name = GMHelper.CapitaliseName(irName, ref FirstName, ref Surname); } else { FirstName = ""; Surname = Name = CConfig.Instance.UnknownName; } } Date = Concealed ? string.Empty : GMHelper.GetLifeDatesStr(ir); }
public void Test_FamilyHistorian() { using (var ctx = TestUtils.LoadResourceGEDCOMFile("test_famhist.ged")) { GEDCOMChecker.CheckGEDCOMFormat(ctx.Tree, ctx, new ProgressStub()); Assert.AreEqual(GEDCOMFormat.gf_FamilyHistorian, ctx.Tree.Format); GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Tom Thompson", iRec1.GetPrimaryFullName()); } }
public void Test_Names_03() { using (var ctx = TestUtils.LoadResourceGEDCOMFile("test_names_03.ged")) { GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("MaleName1 MaleName2 MaleSurname", iRec1.GetPrimaryFullName()); // std-surn exists and double, and sub-surn same // sub-givn and sub-patn exists var parts = GKUtils.GetNameParts(iRec1); Assert.AreEqual("MaleSurname", parts.Surname); Assert.AreEqual("MaleName1 MaleName2", parts.Name); } }
private static TreeCell AddCell(ExtList <TreeCell> row, GDMIndividualRecord iRec, CellKind cellKind) { TreeCell result = new TreeCell(); result.ColIndex = row.Add(result); result.Kind = cellKind; result.Rec = iRec; result.Row = row; if (iRec != null) { result.Name = iRec.GetPrimaryFullName(); } return(result); }
public void Test_EmptyLines() { using (var ctx = TestUtils.LoadResourceGEDCOMFile("test_empty_lines.ged")) { Assert.AreEqual(GEDCOMFormat.gf_Unknown, ctx.Tree.Format); GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I001") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("John Doe", iRec1.GetPrimaryFullName()); GDMIndividualRecord iRec2 = ctx.Tree.XRefIndex_Find("I002") as GDMIndividualRecord; Assert.IsNotNull(iRec2); Assert.AreEqual("Jane Doe", iRec2.GetPrimaryFullName()); } }
public void Test_FamilyTreeMaker_2008() { // actually need to find the real signature of version for FTM 2008 (wrong in the file) using (var ctx = TestUtils.LoadResourceGEDCOMFile("test_ftm2008.ged")) { Assert.AreEqual(GEDCOMFormat.gf_FamilyTreeMaker, ctx.Tree.Format); GEDCOMChecker.CheckGEDCOMFormat(ctx.Tree, ctx, new ProgressStub()); GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("John Smith", iRec1.GetPrimaryFullName()); // test of conversion var occuEvent = iRec1.FindEvent(GEDCOMTagType.OCCU); Assert.IsNotNull(occuEvent); Assert.AreEqual("test occupation", occuEvent.StringValue); } }
// Creates link HTML for the individual e.g. <a href="indiI1.html">Fred Bloggs</a> protected static string MakeLink(GDMIndividualRecord ir) { string name = ir.GetPrimaryFullName(); string dummy = ""; if (name == "") { name = CConfig.Instance.UnknownName; } else if (!ir.GetVisibility() && !CConfig.Instance.UseWithheldNames) { name = CConfig.Instance.ConcealedName; } else { name = CConfig.Instance.CapitaliseName(name, ref dummy, ref dummy); } return(MakeLink(ir, name)); }
public void Test_SourceInput_MK_Marr() { SelectTab("PageControl1", fDialog, 1); ClickRadioButton("rbSK_Met", fDialog); // MK SelectCombo("cbEventType", fDialog, 2); // marr event var dataGridView1 = new DataGridViewTester("dataGridView1", fDialog); dataGridView1.Properties.Rows.Add(2); dataGridView1.EnterCell(0, 0, fLangMan.LS(FLS.LSID_PLPerson)); dataGridView1.EnterCell(0, 1, "Иван"); dataGridView1.EnterCell(0, 2, "Иванович"); dataGridView1.EnterCell(0, 3, "Иванов"); dataGridView1.EnterCell(0, 4, "20"); dataGridView1.EnterCell(0, 5, "test comment"); dataGridView1.EnterCell(1, 0, fLangMan.LS(FLS.LSID_Spouse)); dataGridView1.EnterCell(1, 1, "Анна"); dataGridView1.EnterCell(1, 2, "Васильевна"); dataGridView1.EnterCell(1, 3, "Иванова"); dataGridView1.EnterCell(1, 4, "19"); dataGridView1.EnterCell(1, 5, "test comment2"); EnterCombo("cbSource", fDialog, "test source"); EnterText("edSourceYear", fDialog, "1890"); EnterText("edPage", fDialog, "12"); EnterText("edPlace", fDialog, "Сосновка"); ClickButton("btnParse", fDialog); Assert.AreEqual(6, fBase.Context.Tree.RecordsCount); // source + indi1 + note1 + family + indi2 + note2 GDMIndividualRecord iRec1 = fBase.Context.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Иван Иванович Иванов", iRec1.GetPrimaryFullName()); GDMIndividualRecord iRec2 = fBase.Context.Tree.XRefIndex_Find("I2") as GDMIndividualRecord; Assert.IsNotNull(iRec2); Assert.AreEqual("Анна Васильевна Иванова", iRec2.GetPrimaryFullName()); }
public void Test_Agelong_PseudoAnsel_Win1251() { using (BaseContext ctx = new BaseContext(null)) { using (Stream stmGed1 = TestUtils.LoadResourceStream("test_agelong_ansel(win1251).ged")) { var charsetRes = GKUtils.DetectCharset(stmGed1); Assert.AreEqual("windows-1251", charsetRes.Charset); Assert.GreaterOrEqual(charsetRes.Confidence, 0.7f); var gedcomProvider = new GEDCOMProvider(ctx.Tree); gedcomProvider.LoadFromStreamExt(stmGed1, stmGed1); Assert.AreEqual(GEDCOMFormat.gf_ALTREE, ctx.Tree.Format); GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Иван ОВЕЧКИН", iRec1.GetPrimaryFullName()); } } }
public void Test_GK_UTF8() { using (BaseContext ctx = new BaseContext(null)) { using (Stream stmGed1 = TestUtils.LoadResourceStream("test_gk_utf8.ged")) { var charsetRes = GKUtils.DetectCharset(stmGed1); Assert.AreEqual("UTF-8", charsetRes.Charset); Assert.AreEqual(1.0f, charsetRes.Confidence); var gedcomProvider = new GEDCOMProvider(ctx.Tree); gedcomProvider.LoadFromStreamExt(stmGed1, stmGed1); Assert.AreEqual(GEDCOMFormat.gf_Native, ctx.Tree.Format); GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Иван Иванович Иванов", iRec1.GetPrimaryFullName()); } } }
public void Test_Ahnenblatt_ANSI_Win1250() { using (BaseContext ctx = new BaseContext(null)) { using (Stream stmGed1 = TestUtils.LoadResourceStream("test_ahn_ansi(win1250).ged")) { var charsetRes = GKUtils.DetectCharset(stmGed1); Assert.AreEqual("windows-1252", charsetRes.Charset); Assert.GreaterOrEqual(charsetRes.Confidence, 0.5f); var gedcomProvider = new GEDCOMProvider(ctx.Tree); gedcomProvider.LoadFromStreamExt(stmGed1, stmGed1); Assert.AreEqual(GEDCOMFormat.gf_Ahnenblatt, ctx.Tree.Format); GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Stanisław Nowak", iRec1.GetPrimaryFullName()); } } }
public void Test_FTB6_ANSI_Win1251() { using (BaseContext ctx = new BaseContext(null)) { using (Stream stmGed1 = TestUtils.LoadResourceStream("test_ftb6_ansi(win1251).ged")) { var charsetRes = GKUtils.DetectCharset(stmGed1); Assert.AreEqual("windows-1251", charsetRes.Charset); Assert.GreaterOrEqual(charsetRes.Confidence, 0.9f); var gedcomProvider = new GEDCOMProvider(ctx.Tree); gedcomProvider.LoadFromStreamExt(stmGed1, stmGed1); Assert.AreEqual(GEDCOMFormat.gf_FTB, ctx.Tree.Format); GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Иван Васильевич Петров", iRec1.GetPrimaryFullName()); } } }
public void Test_Names_01() { using (var ctx = TestUtils.LoadResourceGEDCOMFile("test_names_01.ged")) { GDMIndividualRecord iRec1 = ctx.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Александра Анатольевна Лазорева (Иванова)", iRec1.GetPrimaryFullName()); // std-surn exists and double, but sub-surn has only second part // sub-givn exists, but sub-patn is not var parts = GKUtils.GetNameParts(iRec1); Assert.AreEqual("Иванова", parts.Surname); Assert.AreEqual("Александра", parts.Name); Assert.AreEqual("Анатольевна", parts.Patronymic); GDMIndividualRecord iRec2 = ctx.Tree.XRefIndex_Find("I2") as GDMIndividualRecord; Assert.IsNotNull(iRec2); Assert.AreEqual("Петр Константинович Лазорев", iRec2.GetPrimaryFullName()); // std-surn exists, but sub-surn is not // sub-givn exists, but sub-patn is not parts = GKUtils.GetNameParts(iRec2); Assert.AreEqual("Лазорев", parts.Surname); Assert.AreEqual("Петр", parts.Name); Assert.AreEqual("Константинович", parts.Patronymic); } }
public void Test_SourceInput_RS() { SelectTab("PageControl1", fDialog, 1); ClickRadioButton("rbSK_Rev", fDialog); // RS var dataGridView1 = new DataGridViewTester("dataGridView1", fDialog); dataGridView1.Properties.Rows.Add(5); dataGridView1.EnterCell(0, 0, fLangMan.LS(FLS.LSID_PLPerson)); dataGridView1.EnterCell(0, 1, "Иван"); dataGridView1.EnterCell(0, 2, "Иванович"); dataGridView1.EnterCell(0, 3, "Иванов"); dataGridView1.EnterCell(0, 4, "20"); dataGridView1.EnterCell(0, 5, "test comment"); dataGridView1.EnterCell(1, 0, fLangMan.LS(FLS.LSID_Spouse)); dataGridView1.EnterCell(1, 1, "Анна"); dataGridView1.EnterCell(1, 2, "Васильевна"); dataGridView1.EnterCell(1, 3, "Иванова"); dataGridView1.EnterCell(1, 4, "19"); dataGridView1.EnterCell(1, 5, "test comment2"); dataGridView1.EnterCell(2, 0, fLangMan.LS(FLS.LSID_Father)); dataGridView1.EnterCell(2, 1, "Иван"); dataGridView1.EnterCell(2, 2, "Петрович"); dataGridView1.EnterCell(2, 3, "Иванов"); dataGridView1.EnterCell(2, 4, "40"); dataGridView1.EnterCell(2, 5, ""); dataGridView1.EnterCell(3, 0, fLangMan.LS(FLS.LSID_Child)); dataGridView1.EnterCell(3, 1, "Василий"); dataGridView1.EnterCell(3, 2, "Иванович"); dataGridView1.EnterCell(3, 3, "Иванов"); dataGridView1.EnterCell(3, 4, "1"); dataGridView1.EnterCell(3, 5, ""); dataGridView1.EnterCell(4, 0, fLangMan.LS(FLS.LSID_PLGodparent)); dataGridView1.EnterCell(4, 1, "Иван"); dataGridView1.EnterCell(4, 2, "Григорьевич"); dataGridView1.EnterCell(4, 3, "Иванов"); dataGridView1.EnterCell(4, 4, "60"); dataGridView1.EnterCell(4, 5, ""); EnterCombo("cbSource", fDialog, "test source"); EnterText("edSourceYear", fDialog, "1890"); EnterText("edPage", fDialog, "12"); EnterText("edPlace", fDialog, "Сосновка"); ModalFormHandler = SexCheckDlgTests.SexCheckDlgTests_AcceptM_Handler; // NamesTable not available ClickButton("btnParse", fDialog); Assert.AreEqual(10, fBase.Context.Tree.RecordsCount); GDMIndividualRecord iRec1 = fBase.Context.Tree.XRefIndex_Find("I1") as GDMIndividualRecord; Assert.IsNotNull(iRec1); Assert.AreEqual("Иван Иванович Иванов", iRec1.GetPrimaryFullName()); GDMIndividualRecord iRec2 = fBase.Context.Tree.XRefIndex_Find("I2") as GDMIndividualRecord; Assert.IsNotNull(iRec2); Assert.AreEqual("Анна Васильевна Иванова", iRec2.GetPrimaryFullName()); GDMIndividualRecord iRec3 = fBase.Context.Tree.XRefIndex_Find("I3") as GDMIndividualRecord; Assert.IsNotNull(iRec3); Assert.AreEqual("Иван Петрович Иванов", iRec3.GetPrimaryFullName()); GDMIndividualRecord iRec4 = fBase.Context.Tree.XRefIndex_Find("I4") as GDMIndividualRecord; Assert.IsNotNull(iRec4); Assert.AreEqual("Василий Иванович Иванов", iRec4.GetPrimaryFullName()); }