public void PictureCollectorEnv_OnePicture() { using (var site = new RootSiteDataProviderViewBase(m_cache)) { site.StyleSheet = FixtureStyleSheet; site.WritingSystemFactory = m_wsManager; using (new SimpleRootSiteDataProviderTestsHelper(site)) { site.MakeRoot(SimpleRootSiteDataProviderBaseVc.kfragRoot, () => new OnePictureVc()); site.ShowForm(); var pictureSelections = CollectorEnvServices.CollectPictureSelectionPoints(site.RootBox); Assert.AreEqual(1, pictureSelections.Count(), "picture count"); } } }
public void StringPropertyCollectorEnv_MultiStringView_TwoEditableFields() { using (var site = new RootSiteDataProvider_MultiStringView(m_cache)) { site.StyleSheet = FixtureStyleSheet; site.WritingSystemFactory = m_wsManager; using (var helper = new SimpleRootSiteDataProviderTestsHelper(site)) { const string engExpected = "This is the English sentence."; const string frExpected = "This is the French sentence."; string expected = engExpected + Environment.NewLine + frExpected; IList <KeyValuePair <int, string> > vkvp = new List <KeyValuePair <int, string> >(); vkvp.Add(m_wsEng, engExpected); vkvp.Add(m_wsFr, frExpected); site.ShowForm(vkvp, new SimpleRootSiteDataProvider_MultiStringViewVc.DisplayOptions { ReadOnlyView = false, LiteralStringLabels = false }); var editableSelections = site.CollectEditableStringPropSelections(); Assert.IsNotNull(editableSelections); Assert.AreEqual(2, editableSelections.Count); var sli1 = CollectorEnvServices.MakeLocationInfo(site.RootBox, editableSelections[0]); Assert.AreEqual(0, sli1.m_location.Length); Assert.AreEqual(SimpleRootSiteDataProvider_MultiStringViewVc.kflidMultiString, sli1.m_tag); Assert.AreEqual(m_wsEng, sli1.m_ws); Assert.AreEqual(0, sli1.m_ichMin, "m_ichMin"); Assert.AreEqual(0, sli1.m_ichLim, "m_ichLim"); Assert.AreEqual(0, sli1.m_cpropPrev); var sli2 = CollectorEnvServices.MakeLocationInfo(site.RootBox, editableSelections[1]); Assert.AreEqual(SimpleRootSiteDataProvider_MultiStringViewVc.kflidMultiString, sli2.m_tag); Assert.AreEqual(m_wsFr, sli2.m_ws); Assert.AreEqual(0, sli2.m_ichMin, "m_ichMin"); Assert.AreEqual(0, sli2.m_ichLim, "m_ichLim"); Assert.AreEqual(1, sli2.m_cpropPrev); // Verify we can actually use these to make valid selections. var sel1 = editableSelections[0]; Assert.IsNotNull(sel1); Assert.IsTrue(sel1.IsEditable, "sel1.IsEditable"); var sel2 = editableSelections[1]; Assert.IsNotNull(sel2); Assert.IsTrue(sel2.IsEditable, "sel2.IsEditable"); } } }
public void FwListBox_Empty() { using (var site = new TestListBox(m_cache)) { site.StyleSheet = FixtureStyleSheet; site.WritingSystemFactory = m_wsManager; site.WritingSystemCode = m_wsEng; site.ShowHighlight = false; using (new SimpleRootSiteDataProviderTestsHelper(site)) { site.MakeRoot(SimpleRootSiteDataProviderBaseVc.kfragRoot, () => new ListBoxVc(site)); site.ShowForm(); var selections = CollectorEnvServices.CollectStringPropertySelectionPoints(site.RootBox); Assert.AreEqual(0, selections.Count()); } } }
public void FwListBox_OneItem() { using (var fwList = new TestFwList()) { using (var site = new TestListBox(fwList.DataAccess)) { site.StyleSheet = FixtureStyleSheet; site.WritingSystemFactory = m_wsManager; site.WritingSystemCode = m_wsEng; using (new SimpleRootSiteDataProviderTestsHelper(site)) { site.MakeRoot(InnerFwListBox.kfragRoot, () => new ListBoxVc(site)); using (var items = new FwListBox.ObjectCollection(fwList)) { TsStringUtils.MakeTss("Item0", m_wsEng); site.ShowForm(); var selections = CollectorEnvServices.CollectStringPropertySelectionPoints(site.RootBox); Assert.AreEqual(1, selections.Count()); } } } } }
internal IList <IVwSelection> CollectEditableStringPropSelections() { return(CollectorEnvServices.CollectEditableSelectionPoints(RootBox).ToList()); }