/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and loads a set of dummy converters to test the /// <see cref="CnvtrPropertiesCtrl"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public override void FixtureSetup() { base.FixtureSetup(); m_fileMaker = new TempSFFileMaker(); m_myDlg = new DummyAddCnvtrDlg(); m_myCtrl = new DummyCnvtrPropertiesCtrl(); SilEncConverters31.EncConverters encConverters = new SilEncConverters31.EncConverters(); string[] ccFileContents = { "'c' > 'C'" }; m_ccFileName = m_fileMaker.CreateFileNoID(ccFileContents, "cct"); encConverters.AddConversionMap("ZZZTestCC", m_ccFileName, ConvType.Legacy_to_Unicode, "SIL.cc", "", "", ProcessTypeFlags.UnicodeEncodingConversion); string[] mapFileContents = { "EncodingName 'ZZZText'", "DescriptiveName 'Silly test file'", "ByteDefault '?'", "UniDefault replacement_character", "0x80 <> euro_sign" }; m_mapFileName = m_fileMaker.CreateFileNoID(mapFileContents, "map"); encConverters.AddConversionMap("ZZZTestMap", m_mapFileName, ConvType.Legacy_to_from_Unicode, "SIL.map", "", "", ProcessTypeFlags.UnicodeEncodingConversion); // TODO: Should test a legitimate compiled TecKit file by embedding a zipped // up one in the resources for testing purposes. // This is a randomly chosen ICU converter. The test may break when we reduce the set of // ICU converters we ship. encConverters.AddConversionMap("ZZZTestICU", "ISO-8859-1", ConvType.Legacy_to_from_Unicode, "ICU.conv", "", "", ProcessTypeFlags.UnicodeEncodingConversion); // Add a 1-step compound converter, which won't be any of the types our dialog // recognizes for now. encConverters.AddCompoundConverterStep("ZZZTestCompound", "ZZZTestCC", true, NormalizeFlags.None); // Load all the mappings after the dummy mappings are added, so the Converter // Mapping File combo box won't contain obsolete versions of the mappings referring // to old temp files from a previous run of the tests. m_myCtrl.CnvtrPropertiesCtrl_Load(null, null); encConverters.Remove("Bogus"); }
public LinguaLinksImportDlg() { InitializeComponent(); // Copied from the LexImportWizard dlg Init (LexImportWizard.cs) // Ensure that we have the default encoding converter (to/from MS Windows Code Page // for Western European languages) SilEncConverters31.EncConverters encConv = new SilEncConverters31.EncConverters(); System.Collections.IDictionaryEnumerator de = encConv.GetEnumerator(); string sEncConvName = "Windows1252<>Unicode"; // REVIEW: SHOULD THIS NAME BE LOCALIZED? bool fMustCreateEncCnv = true; while (de.MoveNext()) { if ((string)de.Key != null && (string)de.Key == sEncConvName) { fMustCreateEncCnv = false; break; } } if (fMustCreateEncCnv) { try { encConv.AddConversionMap(sEncConvName, "1252", ECInterfaces.ConvType.Legacy_to_from_Unicode, "cp", "", "", ECInterfaces.ProcessTypeFlags.CodePageConversion); } catch (SilEncConverters31.ECException exception) { MessageBox.Show(exception.Message, ITextStrings.ksConvMapError, MessageBoxButtons.OK); } } }
public LinguaLinksImportDlg() { InitializeComponent(); // Copied from the LexImportWizard dlg Init (LexImportWizard.cs) // Ensure that we have the default encoding converter (to/from MS Windows Code Page // for Western European languages) SilEncConverters31.EncConverters encConv = new SilEncConverters31.EncConverters(); System.Collections.IDictionaryEnumerator de = encConv.GetEnumerator(); string sEncConvName = "Windows1252<>Unicode"; // REVIEW: SHOULD THIS NAME BE LOCALIZED? bool fMustCreateEncCnv = true; while (de.MoveNext()) { if ((string)de.Key != null && (string)de.Key == sEncConvName) { fMustCreateEncCnv = false; break; } } if (fMustCreateEncCnv) { try { encConv.AddConversionMap(sEncConvName, "1252", ECInterfaces.ConvType.Legacy_to_from_Unicode, "cp", "", "", ECInterfaces.ProcessTypeFlags.CodePageConversion); } catch (SilEncConverters31.ECException exception) { MessageBox.Show(exception.Message, ITextStrings.ksConvMapError, MessageBoxButtons.OK); } } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Creates and loads a set of dummy converters to test the /// <see cref="CnvtrPropertiesCtrl"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public override void FixtureSetup() { base.FixtureSetup(); m_fileMaker = new TempSFFileMaker(); m_myDlg = new DummyAddCnvtrDlg(); m_myCtrl = new DummyCnvtrPropertiesCtrl(); SilEncConverters31.EncConverters encConverters = new SilEncConverters31.EncConverters(); string[] ccFileContents = {"'c' > 'C'"}; m_ccFileName = m_fileMaker.CreateFileNoID(ccFileContents, "cct"); encConverters.AddConversionMap("ZZZTestCC", m_ccFileName, ConvType.Legacy_to_Unicode, "SIL.cc", "", "", ProcessTypeFlags.UnicodeEncodingConversion); string[] mapFileContents = { "EncodingName 'ZZZText'", "DescriptiveName 'Silly test file'", "ByteDefault '?'", "UniDefault replacement_character", "0x80 <> euro_sign" }; m_mapFileName = m_fileMaker.CreateFileNoID(mapFileContents, "map"); encConverters.AddConversionMap("ZZZTestMap", m_mapFileName, ConvType.Legacy_to_from_Unicode, "SIL.map", "", "", ProcessTypeFlags.UnicodeEncodingConversion); // TODO: Should test a legitimate compiled TecKit file by embedding a zipped // up one in the resources for testing purposes. // This is a randomly chosen ICU converter. The test may break when we reduce the set of // ICU converters we ship. encConverters.AddConversionMap("ZZZTestICU", "ISO-8859-1", ConvType.Legacy_to_from_Unicode, "ICU.conv", "", "", ProcessTypeFlags.UnicodeEncodingConversion); // Add a 1-step compound converter, which won't be any of the types our dialog // recognizes for now. encConverters.AddCompoundConverterStep("ZZZTestCompound", "ZZZTestCC", true, NormalizeFlags.None); // Load all the mappings after the dummy mappings are added, so the Converter // Mapping File combo box won't contain obsolete versions of the mappings referring // to old temp files from a previous run of the tests. m_myCtrl.CnvtrPropertiesCtrl_Load(null, null); encConverters.Remove("Bogus"); }