SIL.FieldWorks.FwCoreDlgs.DummyWritingSystemPropertiesDialog.SelectEthnologueCodeDlg C# (CSharp) Method

SelectEthnologueCodeDlg() private method

private SelectEthnologueCodeDlg ( string languageName, string ethnologueCode, string country, DialogResult ethnologueDlgResultToEnforce, ShowMsgBoxStatus expectedMsgBoxes, string expectedOrigIcuLocales, DialogResult resultsToEnforce ) : void
languageName string
ethnologueCode string
country string
ethnologueDlgResultToEnforce DialogResult
expectedMsgBoxes ShowMsgBoxStatus
expectedOrigIcuLocales string
resultsToEnforce DialogResult
return void
		internal void SelectEthnologueCodeDlg(string languageName, string ethnologueCode, string country,
			DialogResult ethnologueDlgResultToEnforce,
			ShowMsgBoxStatus[] expectedMsgBoxes,
			string[] expectedOrigIcuLocales,
			DialogResult[] resultsToEnforce)
		{
			m_selectedLanguageName = languageName;
			m_selectedEthnologueCode = ethnologueCode;
			m_ethnologueDlgResultToEnforce = ethnologueDlgResultToEnforce;

			m_expectedMsgBoxes = new List<ShowMsgBoxStatus>(expectedMsgBoxes);
			if (expectedOrigIcuLocales != null)
				m_expectedOrigWsIds = new List<string>(expectedOrigIcuLocales);
			m_resultsToEnforce = new List<DialogResult>(resultsToEnforce);
			try
			{
				btnModifyEthnologueInfo_Click(this, null);
				Assert.AreEqual(0, m_expectedMsgBoxes.Count);
				Assert.AreEqual(0, m_expectedOrigWsIds.Count);
				Assert.AreEqual(0, m_resultsToEnforce.Count);
			}
			finally
			{
				m_expectedMsgBoxes.Clear();
				m_resultsToEnforce.Clear();
				m_expectedOrigWsIds.Clear();

				m_selectedLanguageName = null;
				m_selectedEthnologueCode = null;
				m_ethnologueDlgResultToEnforce = DialogResult.None;
			}
		}

Usage Example

Ejemplo n.º 1
0
 public void General_AddNewWs_OK()
 {
     m_dlg.ShowDialog(m_wsKalaba);
     // Verify Remove doesn't (yet) do anything for Wss already in the Database.
     m_dlg.VerifyListBox(new[] { "Kalaba", "Kalaba (International Phonetic Alphabet)" });
     m_dlg.PressDeleteButton();
     m_dlg.VerifyListBox(new[] { "Kalaba", "Kalaba (International Phonetic Alphabet)" });
     // Switch tabs, so we can test that Add New Ws will switch to General Tab.
     m_dlg.SwitchTab(FwWritingSystemSetupDlg.kWsFonts);
     m_dlg.VerifyTab(FwWritingSystemSetupDlg.kWsFonts);
     m_dlg.VerifyAddWsContextMenuItems(new[] { "&Writing System for Kalaba..." });
     // Click on Add Button...selecting "Add New..." option.
     m_dlg.PressBtnAdd("&Writing System for Kalaba...");
     // Verify WsList has new item and it is selected
     m_dlg.VerifyListBox(new[] { "Kalaba", "Kalaba", "Kalaba (International Phonetic Alphabet)" });
     m_dlg.VerifyLoadedForListBoxSelection("Kalaba");
     // verify we automatically switched back to General Tab.
     m_dlg.VerifyTab(FwWritingSystemSetupDlg.kWsGeneral);
     // Verify Switching context is not OK (force user to make unique Ws)
     m_dlg.SwitchTab(FwWritingSystemSetupDlg.kWsFonts,
                     DummyWritingSystemPropertiesDialog.ShowMsgBoxStatus.CheckCantCreateDuplicateWs,
                     DialogResult.OK);
     m_dlg.VerifyTab(FwWritingSystemSetupDlg.kWsGeneral);
     // make sure we can't select a different ethnologue code.
     m_dlg.SelectEthnologueCodeDlg("", "", "", DialogResult.OK,
                                   new[] { DummyWritingSystemPropertiesDialog.ShowMsgBoxStatus.CheckCantCreateDuplicateWs },
                                   null,
                                   new[] { DialogResult.OK });
     // Change Region or Variant info.
     m_dlg.SetVariantName("Phonetic");
     m_dlg.VerifyListBox(new[] { "Kalaba", "Kalaba (International Phonetic Alphabet)", "Kalaba (Phonetic)" });
     // Now update the Ethnologue code, and cancel msg box to check we restored the expected newly added language defns.
     m_dlg.SelectEthnologueCodeDlg("WSDialog", "qaa-x-wsd", "", DialogResult.OK,
                                   new[] { DummyWritingSystemPropertiesDialog.ShowMsgBoxStatus.CheckCantCreateDuplicateWs },
                                   new[] { "qaa-x-kal" },
                                   new[] { DialogResult.OK });
     // Verify dialog indicates a list to add to current (vernacular) ws list
     VerifyNewlyAddedWritingSystems(new[] { "qaa-fonipa-x-kal-etic" });
     // Now update the Ethnologue code, check we still have expected newly added language defns.
     m_dlg.SelectEthnologueCodeDlg("Kala", "qaa-x-kal", "", DialogResult.OK,
                                   new DummyWritingSystemPropertiesDialog.ShowMsgBoxStatus[] { }, new string[] { }, new DialogResult[] { });
     // Verify dialog indicates a list to add to current (vernacular) ws list
     VerifyNewlyAddedWritingSystems(new[] { "qaa-fonipa-x-kal-etic" });
     // Now try adding a second/duplicate ws.
     m_dlg.PressBtnAdd("&Writing System for Kala...");
     m_dlg.VerifyListBox(new[] { "Kala", "Kala", "Kala (International Phonetic Alphabet)", "Kala (Phonetic)" });
     m_dlg.VerifyLoadedForListBoxSelection("Kala");
     m_dlg.SetVariantName("Phonetic");
     m_dlg.VerifyListBox(new[] { "Kala", "Kala (International Phonetic Alphabet)", "Kala (Phonetic)", "Kala (Phonetic)" });
     m_dlg.SwitchTab(FwWritingSystemSetupDlg.kWsFonts,
                     DummyWritingSystemPropertiesDialog.ShowMsgBoxStatus.CheckCantCreateDuplicateWs,
                     DialogResult.OK);
     m_dlg.PressDeleteButton();
     m_dlg.VerifyListBox(new[] { "Kala", "Kala (International Phonetic Alphabet)", "Kala (Phonetic)" });
     m_dlg.VerifyLoadedForListBoxSelection("Kala (Phonetic)");
     // Do OK
     m_dlg.PressOk();
     // Verify dialog indicates a list to add to current (vernacular) ws list
     VerifyNewlyAddedWritingSystems(new[] { "qaa-fonipa-x-kal-etic" });
     // Verify we've actually created the new ws.
     VerifyWsNames(
         new[] { "Kala", "Kala (International Phonetic Alphabet)", "Kala (Phonetic)" },
         new[] { "qaa-x-kal", "qaa-fonipa-x-kal", "qaa-fonipa-x-kal-etic" });
 }