public bool CompleteEdits(out VwChangeInfo _ci) { _ci = default(VwChangeInfo); return true; }
public bool CompleteEdits(out VwChangeInfo _ci) { throw new NotImplementedException(); }
public void GetParagraphProps_InPictureCaption() { CheckDisposed(); ITsStrFactory factory = TsStrFactoryClass.Create(); CmPicture pict = new CmPicture(Cache, "c:\\junk.jpg", factory.MakeString("Test picture", Cache.DefaultVernWs), StringUtils.LocalPictures); Assert.IsNotNull(pict); //CmPicture pic = new CmPicture(); //ICmFolder folder = new CmFolder(); //Cache.LangProject.PicturesOC.Add(folder); //m_basicView.EditingHelper.MakePictureFromText(Cache, ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal); DynamicMock mockedSelection = new DynamicMock(typeof(IVwSelection)); mockedSelection.ExpectAndReturn("IsValid", true); mockedSelection.ExpectAndReturn("Commit", true); VwChangeInfo changeInfo = new VwChangeInfo(); changeInfo.hvo = 0; mockedSelection.ExpectAndReturn("CompleteEdits", true, new object[] {changeInfo}, new string[] {typeof(VwChangeInfo).FullName + "&"}, new object[] {changeInfo}); mockedSelection.ExpectAndReturn("CLevels", 2, false); mockedSelection.ExpectAndReturn("CLevels", 2, true); string sIntType = typeof(int).FullName; string intRef = sIntType + "&"; mockedSelection.ExpectAndReturn("PropInfo", null, new object[] { false, 0, null, null, null, null, null }, new string[] {typeof(bool).FullName, sIntType, intRef, intRef, intRef, intRef, typeof(IVwPropertyStore).FullName + "&"}, new object[] { false, 0, pict.Hvo, (int)CmPicture.CmPictureTags.kflidCaption, 0, 0, null }); mockedSelection.ExpectAndReturn("PropInfo", null, new object[] { true, 0, null, null, null, null, null }, new string[] {typeof(bool).FullName, sIntType, intRef, intRef, intRef, intRef, typeof(IVwPropertyStore).FullName + "&"}, new object[] { true, 0, pict.Hvo, (int)CmPicture.CmPictureTags.kflidCaption, 0, 0, null }); mockedSelection.ExpectAndReturn(2, "EndBeforeAnchor", false); DummyBasicView.DummyEditingHelper editingHelper = (DummyBasicView.DummyEditingHelper)m_basicView.EditingHelper; editingHelper.m_mockedSelection = (IVwSelection)mockedSelection.MockInstance; editingHelper.m_fOverrideGetParaPropStores = true; IVwRootBox rootBox = m_basicView.RootBox; IVwSelection vwsel; int hvoText, tagText, ihvoFirst, ihvoLast; IVwPropertyStore[] vvps; ITsTextProps[] vttp; Assert.IsTrue(m_basicView.GetParagraphProps(out vwsel, out hvoText, out tagText, out vvps, out ihvoFirst, out ihvoLast, out vttp)); Assert.AreEqual((int)CmPicture.CmPictureTags.kflidCaption, tagText); Assert.AreEqual(1, vttp.Length); Assert.AreEqual("Figure caption", vttp[0].GetStrPropValue((int)FwTextPropType.ktptNamedStyle)); }
public void GetParagraphProps_InPictureCaption() { ITsStrFactory factory = Cache.TsStrFactory; string filename; if (Environment.OSVersion.Platform == PlatformID.Unix) filename = "/junk.jpg"; else filename = "c:\\junk.jpg"; ICmPicture pict = Cache.ServiceLocator.GetInstance<ICmPictureFactory>().Create(filename, factory.MakeString("Test picture", Cache.DefaultVernWs), CmFolderTags.LocalPictures); Assert.IsNotNull(pict); ShowForm(Lng.English, DummyBasicViewVc.DisplayType.kNormal); DynamicMock mockedSelection = new DynamicMock(typeof(IVwSelection)); mockedSelection.ExpectAndReturn("IsValid", true); VwChangeInfo changeInfo = new VwChangeInfo(); changeInfo.hvo = 0; mockedSelection.ExpectAndReturn("CompleteEdits", true, new object[] {changeInfo}, new string[] {typeof(VwChangeInfo).FullName + "&"}, new object[] {changeInfo}); mockedSelection.ExpectAndReturn("CLevels", 2, false); mockedSelection.ExpectAndReturn("CLevels", 2, true); string sIntType = typeof(int).FullName; string intRef = sIntType + "&"; mockedSelection.ExpectAndReturn("PropInfo", null, new object[] { false, 0, null, null, null, null, null }, new string[] {typeof(bool).FullName, sIntType, intRef, intRef, intRef, intRef, typeof(IVwPropertyStore).FullName + "&"}, new object[] { false, 0, pict.Hvo, CmPictureTags.kflidCaption, 0, 0, null }); mockedSelection.ExpectAndReturn("PropInfo", null, new object[] { true, 0, null, null, null, null, null }, new string[] {typeof(bool).FullName, sIntType, intRef, intRef, intRef, intRef, typeof(IVwPropertyStore).FullName + "&"}, new object[] { true, 0, pict.Hvo, CmPictureTags.kflidCaption, 0, 0, null }); mockedSelection.ExpectAndReturn(2, "EndBeforeAnchor", false); DummyBasicView.DummyEditingHelper editingHelper = (DummyBasicView.DummyEditingHelper)m_basicView.EditingHelper; editingHelper.m_mockedSelection = (IVwSelection)mockedSelection.MockInstance; editingHelper.m_fOverrideGetParaPropStores = true; IVwSelection vwsel; int hvoText, tagText, ihvoFirst, ihvoLast; IVwPropertyStore[] vvps; ITsTextProps[] vttp; Assert.IsTrue(m_basicView.GetParagraphProps(out vwsel, out hvoText, out tagText, out vvps, out ihvoFirst, out ihvoLast, out vttp)); Assert.AreEqual(CmPictureTags.kflidCaption, tagText); Assert.AreEqual(1, vttp.Length); Assert.AreEqual("Figure caption", vttp[0].GetStrPropValue((int)FwTextPropType.ktptNamedStyle)); }