public MultiTextControl(IList <string> writingSystemIds, MultiText multiTextToCopyFormsFrom, string nameForTesting, bool showAnnotationWidget, IWritingSystemRepository allWritingSystems, CommonEnumerations.VisibilitySetting visibility, bool isSpellCheckingEnabled, bool isMultiParagraph, IServiceProvider serviceProvider) : this(allWritingSystems, serviceProvider) { Name = nameForTesting + "-mtc"; _writingSystemsForThisField = new List <IWritingSystemDefinition>(); // foreach (KeyValuePair<string, WritingSystem> pair in allWritingSystems) // { // if (writingSystemIds.Contains(pair.Key)) // { // _writingSystemsForThisField.Add(pair.Value); // } // } foreach (var id in writingSystemIds) { if (allWritingSystems.Contains(id)) //why wouldn't it? { _writingSystemsForThisField.Add(allWritingSystems.Get(id)); } } _showAnnotationWidget = showAnnotationWidget; _visibility = visibility; IsSpellCheckingEnabled = isSpellCheckingEnabled; _isMultiParagraph = isMultiParagraph; BuildBoxes(multiTextToCopyFormsFrom); }
public void Save_WritingSystemReadFromLdmlAndChanged_ChangesSaved() { using (var e = new TestEnvironment()) { e.CreateLdmlWritingSystemDefinitionFile(); IWritingSystemRepository loadedWsCollection = GetWritingSystemRepository(e.PathToWritingSystemsFolder); ((WritingSystemDefinition)loadedWsCollection.Get("en")).Keyboard = "changed"; loadedWsCollection.Save(); IWritingSystemRepository reloadedWsCollection = GetWritingSystemRepository(e.PathToWritingSystemsFolder); TestEnvironment.AssertWritingSystemCollectionsAreEqual(loadedWsCollection, reloadedWsCollection); } }
public void SetSameDefinitionTwice_UpdatesStore() { _writingSystem.Language = "one"; RepositoryUnderTest.Set(_writingSystem); Assert.AreEqual(1, RepositoryUnderTest.Count); Assert.AreNotEqual("lang1", _writingSystem.Language.Name); _writingSystem.Language = new LanguageSubtag((LanguageSubtag)"two", "lang1"); RepositoryUnderTest.Set(_writingSystem); WritingSystemDefinition ws2 = RepositoryUnderTest.Get("two"); Assert.AreEqual("lang1", ws2.Language.Name); Assert.AreEqual(1, RepositoryUnderTest.Count); }
public static void AssertWritingSystemCollectionsAreEqual(IWritingSystemRepository lhs, IWritingSystemRepository rhs) { foreach (var lhsWritingSystem in lhs.AllWritingSystems) { var rhsWritingSystem = rhs.Get(lhsWritingSystem.Id); Assert.IsTrue(rhs.Contains(lhsWritingSystem.Id)); Assert.AreEqual(lhsWritingSystem.Id, rhsWritingSystem.Id); Assert.AreEqual(lhsWritingSystem.Abbreviation, rhsWritingSystem.Abbreviation); Assert.AreEqual(lhsWritingSystem.DefaultFontName, rhsWritingSystem.DefaultFontName); Assert.AreEqual(lhsWritingSystem.DefaultFontSize, rhsWritingSystem.DefaultFontSize); Assert.AreEqual(lhsWritingSystem.IsVoice, rhsWritingSystem.IsVoice); Assert.AreEqual(lhsWritingSystem.IsUnicodeEncoded, rhsWritingSystem.IsUnicodeEncoded); Assert.AreEqual(((WritingSystemDefinition)lhsWritingSystem).Keyboard, ((WritingSystemDefinition)rhsWritingSystem).Keyboard); Assert.AreEqual(lhsWritingSystem.RightToLeftScript, rhsWritingSystem.RightToLeftScript); Assert.AreEqual(lhsWritingSystem.SortUsing, rhsWritingSystem.SortUsing); Assert.AreEqual(lhsWritingSystem.SortRules, rhsWritingSystem.SortRules); Assert.AreEqual(lhsWritingSystem.SpellCheckingId, rhsWritingSystem.SpellCheckingId); } }
public void SetSameDefinitionTwice_UpdatesStore() { _writingSystem.Language = "one"; RepositoryUnderTest.Set(_writingSystem); Assert.AreEqual(1, RepositoryUnderTest.Count); Assert.AreNotEqual("one font", _writingSystem.DefaultFontName); _writingSystem.Language = "two"; _writingSystem.DefaultFontName = "one font"; RepositoryUnderTest.Set(_writingSystem); var ws2 = RepositoryUnderTest.Get("two"); Assert.AreEqual("one font", ws2.DefaultFontName); Assert.AreEqual(1, RepositoryUnderTest.Count); }
public IList <IWritingSystemDefinition> WritingSystemsFromIds(IEnumerable <string> writingSystemIds) { return(writingSystemIds.Select(id => WritingSystems.Get(id)).ToList()); }
public static IList <LanguageForm> GetAudioForms(MultiText field, IWritingSystemRepository writingSytems) { var x = field.Forms.Where(f => writingSytems.Get(f.WritingSystemId).IsVoice); return(new List <LanguageForm>(x)); }