当前位置: 首页>>代码示例>>C#>>正文


C# Cellar.StTxtPara类代码示例

本文整理汇总了C#中SIL.FieldWorks.FDO.Cellar.StTxtPara的典型用法代码示例。如果您正苦于以下问题:C# StTxtPara类的具体用法?C# StTxtPara怎么用?C# StTxtPara使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StTxtPara类属于SIL.FieldWorks.FDO.Cellar命名空间,在下文中一共展示了StTxtPara类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: system

		int m_wsUr; // Urdu writing system (used for Foreign style)
		#endregion

		#region Test setup
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void CreateTestData()
		{
			m_inMemoryCache.InitializeWritingSystemEncodings();

			// create footnote
			m_footnote = new StFootnote();
			m_book = (ScrBook)m_scrInMemoryCache.AddBookToMockedScripture(1, "Genesis");
			m_book.FootnotesOS.Append(m_footnote);
			m_footnote.FootnoteMarker.Text = "o";
			m_footnote.DisplayFootnoteMarker = true;
			m_footnote.DisplayFootnoteReference = false;

			// create one empty footnote para
			StTxtPara para = new StTxtPara();
			m_footnote.ParagraphsOS.Append(para);
			para.StyleRules = StyleUtils.ParaStyleTextProps(ScrStyleNames.NormalFootnoteParagraph);

			m_strFact = TsStrFactoryClass.Create();
			m_vernWs = Cache.LangProject.DefaultVernacularWritingSystem;
			para.Contents.UnderlyingTsString = m_strFact.MakeString(string.Empty, m_vernWs);
			m_footnotePara = (StTxtPara)m_footnote.ParagraphsOS[0];

			m_wsUr = InMemoryFdoCache.s_wsHvos.Ur; // used with 'foreign' character style
			m_wsDe = InMemoryFdoCache.s_wsHvos.De; // used for back translations
			m_wsEs = InMemoryFdoCache.s_wsHvos.Es;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:35,代码来源:StFootnoteTests.cs

示例2: VerifyParaDiff

		/// <summary>overload for same end ref</summary>
		public static void VerifyParaDiff(Difference diff,
			BCVRef startAndEnd, DifferenceType type,
			StTxtPara paraCurr, int ichMinCurr, int ichLimCurr,
			StTxtPara paraRev, int ichMinRev, int ichLimRev)
		{
			VerifyParaDiff(diff, startAndEnd, startAndEnd, type,
				paraCurr, ichMinCurr, ichLimCurr,
				paraRev, ichMinRev, ichLimRev);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:10,代码来源:DiffTestHelper.cs

示例3: SetupTexts

		public void SetupTexts()
		{
			// First make a regular text.
			using (new UndoRedoTaskHelper(Cache, "ConstituentChartDatabaseTests - SetupTexts()", "ConstituentChartDatabaseTests - SetupTexts()"))
			{
				m_text1 = Cache.LangProject.TextsOC.Add(new Text());
				m_text1.ContentsOA = new StText();
				StTxtPara para0 = new StTxtPara();
				m_text1.ContentsOA.ParagraphsOS.Append(para0);
				//m_text1.ContentsOA.ParagraphsOS.Append(para1);
				//           1         2         3         4         5         6
				// 0123456789012345678901234567890123456789012345678901234567890123456789
				// this is the first paragraph for our constituent chart database tests.
				para0.Contents.UnderlyingTsString = m_tsf.MakeString("this is the first paragraph for our constituent chart database tests.",
					Cache.DefaultVernWs);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:17,代码来源:ConstituentChartDatabaseTests.cs

示例4: SetTitle

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Create a title paragrpaph for the given book.
		/// </summary>
		/// <param name="scrInMemoryCache">in-memory cache to use for testing</param>
		/// <param name="book">The book</param>param>
		/// <param name="sTitle">The text of the title. Can be a simple string or a format
		/// string. (See InMemoryFdoCache.CreateFormatText for the definition of the
		/// format string)</param>
		/// ------------------------------------------------------------------------------------
		internal static void SetTitle(ScrInMemoryFdoCache scrInMemoryCache, IScrBook book, string sTitle)
		{
			book.TitleOA = new StText();

			if (sTitle[0] != '\\')
			{
				scrInMemoryCache.AddTitleToMockedBook(book.Hvo, sTitle);
			}
			else
			{
				// Create a more complex title from the given format string
				// insert a new para in the title
				StTxtPara para = new StTxtPara();
				book.TitleOA.ParagraphsOS.Append(para);
				// set the para's fields
				scrInMemoryCache.AddFormatTextToMockedPara(book, para, sTitle, scrInMemoryCache.Cache.DefaultVernWs);
				para.StyleRules = StyleUtils.ParaStyleTextProps(ScrStyleNames.MainBookTitle);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:29,代码来源:ExportHelper.cs

示例5: OnFormClosing

		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// ------------------------------------------------------------------------------------
		protected override void OnFormClosing(FormClosingEventArgs e)
		{
			base.OnFormClosing(e);

			if (DialogResult == DialogResult.Cancel)
				return;

			FdoOwningSequence<IStPara> oldParas = m_error.ResolutionOA.ParagraphsOS;
			ITsString[] newParas = m_text.Paragraphs;

			// If there are fewer paragraphs in the new comment, then remove from the end
			// of the old comment the number paragraphs that is the difference between
			// the number of old and new paragraphs.
			if (newParas.Length < oldParas.Count)
			{
				for (int i = oldParas.Count - 1; i >= newParas.Length; i--)
					oldParas.RemoveAt(i);
			}

			for (int i = 0; i < newParas.Length; i++)
			{
				if (i < oldParas.Count)
				{
					// Reuse the old paragraph.
					((StTxtPara)oldParas[i]).Contents.UnderlyingTsString = newParas[i];
				}
				else
				{
					// Create a new paragraph
					StTxtPara newStPara = new StTxtPara();
					oldParas.Append(newStPara);
					newStPara.Contents.UnderlyingTsString = newParas[i];
					ITsPropsFactory tspf = TsPropsFactoryClass.Create();
					newStPara.StyleRules = tspf.MakeProps(ScrStyleNames.Remark, m_text.CurrentWs, 0);
				}
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:42,代码来源:CheckingErrorCommentDlg.cs

示例6: VerifyParaAddedDiff

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// A helper method for book merger tests-
		/// Verifies the contents of the given difference
		/// for types: missing/added paragraphs.
		/// </summary>
		/// <param name="diff">the given Difference</param>
		/// <param name="start">The verse ref start.</param>
		/// <param name="end">The verse ref end.</param>
		/// <param name="type">Type of the diff.</param>
		/// <param name="paraAdded">The paragraph added.</param>
		/// <param name="paraDest">the destination paragraph</param>
		/// <param name="ichDest">The character index in the destination paragraph,
		/// where the added items could be inserted in the other book.</param>
		/// ------------------------------------------------------------------------------------
		public static void VerifyParaAddedDiff(Difference diff,
			BCVRef start, BCVRef end, DifferenceType type,
			StTxtPara paraAdded, StTxtPara paraDest, int ichDest)
		{
			Assert.AreEqual(start, diff.RefStart);
			Assert.AreEqual(end, diff.RefEnd);
			Assert.AreEqual(type, diff.DiffType);
			switch (type)
			{
				case DifferenceType.ParagraphAddedToCurrent:
					Assert.IsNull(diff.HvosSectionsRev);

					Assert.AreEqual(paraAdded.Hvo, diff.HvoCurr);
					Assert.AreEqual(0, diff.IchMinCurr);
					Assert.AreEqual(paraAdded.Contents.Length, diff.IchLimCurr);

					Assert.AreEqual(paraDest.Hvo, diff.HvoRev);
					Assert.AreEqual(ichDest, diff.IchMinRev);
					Assert.AreEqual(ichDest, diff.IchLimRev);

					Assert.IsNull(diff.StyleNameCurr);
					Assert.IsNull(diff.StyleNameRev);
					break;

				case DifferenceType.ParagraphMissingInCurrent:
					Assert.IsNull(diff.HvosSectionsRev);

					Assert.AreEqual(paraDest.Hvo, diff.HvoCurr);
					Assert.AreEqual(ichDest, diff.IchMinCurr);
					Assert.AreEqual(ichDest, diff.IchLimCurr);

					Assert.AreEqual(paraAdded.Hvo, diff.HvoRev);
					Assert.AreEqual(0, diff.IchMinRev);
					Assert.AreEqual(paraAdded.Contents.Length, diff.IchLimRev);

					Assert.IsNull(diff.StyleNameCurr);
					Assert.IsNull(diff.StyleNameRev);
					break;
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:55,代码来源:DiffTestHelper.cs

示例7: VerifyStanzaBreakAddedDiff

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// A helper method for book merger tests-
		/// Verifies the contents of the given difference
		/// for types: missing/added empty paragraphs.
		/// </summary>
		/// <param name="diff">the given Difference</param>
		/// <param name="startAndEnd">The starting and ending verse ref start.</param>
		/// <param name="type">Type of the diff.</param>
		/// <param name="paraAdded">The paragraph added.</param>
		/// <param name="paraDest">the destination paragraph</param>
		/// <param name="ichDest">The character index in the destination paragraph,
		/// where the added items could be inserted in the other book.</param>
		/// ------------------------------------------------------------------------------------
		public static void VerifyStanzaBreakAddedDiff(Difference diff,
			BCVRef startAndEnd, DifferenceType type,
			StTxtPara paraAdded, /*string strAddedParaStyle,*/ StTxtPara paraDest, int ichDest)
		{
			Assert.IsTrue(diff.DiffType == DifferenceType.StanzaBreakAddedToCurrent ||
				diff.DiffType == DifferenceType.StanzaBreakMissingInCurrent);
			//string addedParaStyle = (diff.DiffType == DifferenceType.StanzaBreakAddedToCurrent) ?
			//    diff.StyleNameCurr : diff.StyleNameRev;
			//Assert.AreEqual(strAddedParaStyle, addedParaStyle);

			VerifyParaAddedDiff(diff, startAndEnd, startAndEnd, type, paraAdded, paraDest, ichDest);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:26,代码来源:DiffTestHelper.cs

示例8: CreateParagraph

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Append a new <see cref="StTxtPara"/> to the given <see cref="StText"/>.
		/// Set it with data accumulated in this builder.
		/// </summary>
		/// <param name="hvoOwner">HVO of the <see cref="StText"/> that is to own the new
		/// paragraph</param>
		/// <returns>A new StTextPara whose contents are built up from the prior calls
		/// to <see cref="AppendRun"/> and whose style is set based on the current value of
		/// <see cref="ParaStylePropsProxy"/>.</returns>
		/// ------------------------------------------------------------------------------------
		public StTxtPara CreateParagraph(int hvoOwner)
		{
			CheckDisposed();
			// insert a new para in the owner's collection
			StTxtPara para = new StTxtPara();
			StText text = new StText(m_cache, hvoOwner);
			text.ParagraphsOS.Append(para);

			SetStTxtParaPropertiesAndClearBuilder(para, 0);

			return para;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:23,代码来源:StTxtParaBldr.cs

示例9: CreateFromStringRep_twoParas

		public void CreateFromStringRep_twoParas()
		{
			CheckDisposed();

			ITsStrBldr bldr = m_footnotePara.Contents.UnderlyingTsString.GetBldr();
			bldr.Replace(0, 0, "Paragraph One", null);
			m_footnotePara.Contents.UnderlyingTsString = bldr.GetString();

			// create second para
			StTxtPara para = new StTxtPara();
			m_footnote.ParagraphsOS.Append(para);
			para.StyleRules = StyleUtils.ParaStyleTextProps("Note Exegesis Paragraph");
			bldr = TsStrBldrClass.Create();
			bldr.Replace(0, 0, "Paragraph Two", StyleUtils.CharStyleTextProps("Foreign", m_wsUr));
			para.Contents.UnderlyingTsString = bldr.GetString();

			string footnoteRep = @"<FN><M>o</M><ShowMarker/><P><PS>Note General Paragraph</PS>" +
				@"<RUN WS='fr'>Paragraph One</RUN></P><P><PS>Note Exegesis Paragraph</PS>" +
				@"<RUN WS='ur' CS='Foreign'>Paragraph Two</RUN></P></FN>";
			StFootnote footnote = StFootnote.CreateFromStringRep(m_book,
				(int)ScrBook.ScrBookTags.kflidFootnotes, footnoteRep, 0, "Note Marker");
			CompareFootnote(footnote);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:23,代码来源:StFootnoteTests.cs

示例10: VerifySubDiffTextCompared

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// A helper method for book merger tests-
		/// Verifies the contents of the given sub-difference
		/// for a two-sided subDiff representing a text comparison. This overload does not
		/// check for the starting and ending references for sub-diffs that are created without
		/// that information.
		/// </summary>
		/// <param name="rootDiff">The root difference.</param>
		/// <param name="iSubDiff">The sub difference to verify.</param>
		/// <param name="subDiffType">Type of the sub difference.</param>
		/// <param name="paraCurr">The current paragraph.</param>
		/// <param name="ichMinCurr">The beginning character offset of the difference in the
		/// current.</param>
		/// <param name="ichLimCurr">The ending character offset of the difference in the
		/// current.</param>
		/// <param name="paraRev">The revision paragraph.</param>
		/// <param name="ichMinRev">The beginning character offset of the difference in the
		/// revision.</param>
		/// <param name="ichLimRev">The ending character offset of the difference in the
		/// current.</param>
		/// <remarks>char styles are not verified here; test code should just check
		/// those directly if relevant</remarks>
		/// ------------------------------------------------------------------------------------
		//TODO: use an iSubDiff parameter instead of the subDiff itself;
		// use the following method as a model to verify the root diff type
		// make a separate method for footnote subdiffs
		public static void VerifySubDiffTextCompared(Difference rootDiff, int iSubDiff,
			DifferenceType subDiffType,
			StTxtPara paraCurr, int ichMinCurr, int ichLimCurr,
			StTxtPara paraRev, int ichMinRev, int ichLimRev)
		{
			Difference subDiff = rootDiff.SubDiffsForParas[iSubDiff];
			// the Current para stuff
			Assert.AreEqual((paraCurr != null) ? paraCurr.Hvo : 0, subDiff.HvoCurr);
			Assert.AreEqual(ichMinCurr, subDiff.IchMinCurr);
			Assert.AreEqual(ichLimCurr, subDiff.IchLimCurr);

			// the Revision para stuff
			Assert.AreEqual((paraRev != null) ? paraRev.Hvo : 0, subDiff.HvoRev);
			Assert.AreEqual(ichMinRev, subDiff.IchMinRev);
			Assert.AreEqual(ichLimRev, subDiff.IchLimRev);

			// section stuff should be null
			Assert.IsNull(subDiff.HvosSectionsRev);
			Assert.IsNull(subDiff.HvosSectionsCurr);

			// subDiffs may not have subDiffs, so far
			Assert.IsNull(subDiff.SubDiffsForORCs);
			Assert.IsNull(subDiff.SubDiffsForParas);

			Assert.AreEqual(subDiffType, subDiff.DiffType);

			if ((rootDiff.DiffType & DifferenceType.ParagraphSplitInCurrent) != 0 ||
				(rootDiff.DiffType & DifferenceType.ParagraphMergedInCurrent) != 0 ||
				(rootDiff.DiffType & DifferenceType.ParagraphStructureChange) != 0)
			{
				// check the subDiff for consistency with the root diff.
				Assert.IsTrue((subDiff.DiffType & DifferenceType.TextDifference) != 0 ||
					(subDiff.DiffType & DifferenceType.FootnoteAddedToCurrent) != 0 ||
					(subDiff.DiffType & DifferenceType.FootnoteMissingInCurrent) != 0 ||
					(subDiff.DiffType & DifferenceType.FootnoteDifference) != 0 ||
					(subDiff.DiffType & DifferenceType.MultipleCharStyleDifferences) != 0 ||
					(subDiff.DiffType & DifferenceType.CharStyleDifference) != 0 ||
					(subDiff.DiffType & DifferenceType.PictureAddedToCurrent) != 0 ||
					(subDiff.DiffType & DifferenceType.PictureMissingInCurrent) != 0 ||
					(subDiff.DiffType & DifferenceType.PictureDifference) != 0 ||
					subDiff.DiffType == DifferenceType.NoDifference, // (structure change only)
					subDiff.DiffType.ToString() +
					" is not a consistent subtype with split or merged paragraph differences.");
			}
			else
			{
				Assert.IsNotNull(paraCurr, "The current paragraph cannot be null except for para split/merge root diff");
				Assert.IsNotNull(paraRev, "The revision paragraph cannot be null except for para split/merge root diff");

				//check the root difference for consistency with this subDiff
				if (subDiff.DiffType == DifferenceType.VerseMoved)
				// ||
				// subDiff.DiffType == DifferenceType.ParagraphMoved)
				{
					// this subDiff verse or paragraph was moved into an added section
					Assert.IsTrue(rootDiff.DiffType == DifferenceType.SectionAddedToCurrent ||
						rootDiff.DiffType == DifferenceType.SectionMissingInCurrent,
						"inconsistent type of root difference");
				}
				else if (subDiff.DiffType == DifferenceType.TextDifference)
				{
					// this subDiff text difference is within a footnote
					Assert.AreEqual(DifferenceType.FootnoteDifference, rootDiff.DiffType);
				}
				else
					Assert.Fail("unexpected type of sub-diff");
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:95,代码来源:DiffTestHelper.cs

示例11: AppendRunToBt

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Append a run of text to a back translation of a paragraph.
		/// </summary>
		/// <param name="para">given paragraph</param>
		/// <param name="ws">given writing system for the back translation</param>
		/// <param name="runText">given text to append to back translation</param>
		/// ------------------------------------------------------------------------------------
		private void AppendRunToBt(StTxtPara para, int ws, string runText)
		{
			ICmTranslation trans = para.GetOrCreateBT();
			ITsStrBldr bldr = trans.Translation.GetAlternative(ws).UnderlyingTsString.GetBldr();
			ITsTextProps ttp = StyleUtils.CharStyleTextProps(null, ws);
			int bldrLength = bldr.Length;
			bldr.ReplaceRgch(bldrLength, bldrLength, runText, runText.Length, ttp);
			trans.Translation.SetAlternative(bldr.GetString(), ws);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:17,代码来源:FdoScriptureTests.cs

示例12: NotifyParagraph

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Notifies a paragraph that needs to have its highlighting refreshed.
		/// </summary>
		/// <param name="hvoPara"></param>
		/// ------------------------------------------------------------------------------------
		private void NotifyParagraph(int hvoPara)
		{
			if (m_cache.IsRealObject(hvoPara, StTxtPara.kClassId))
			{
				StTxtPara para = new StTxtPara(m_cache, hvoPara);
				m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, hvoPara,
					(int)StTxtPara.StParaTags.kflidStyleRules, 0, 1, 1);
			}
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:15,代码来源:DiffDialog.cs

示例13: ArchiveDraft_TestFootnoteOrder

		public void ArchiveDraft_TestFootnoteOrder()
		{
			CheckDisposed();
			int draftCount = m_scr.ArchivedDraftsOC.Count;
			ScrBook james = (ScrBook)m_scr.ScriptureBooksOS[1];
			int hvoBookRef = m_fdoCache.ScriptureReferenceSystem.BooksOS[58].Hvo;

			// Add a footnote to the first content para2 of the second section.
			FdoOwningSequence<IStPara> contentParas = james.SectionsOS[1].ContentOA.ParagraphsOS;
			StTxtPara para2 = (StTxtPara)contentParas[0];
			StFootnote footnoteOrig3 = InsertTestFootnote(james, para2, 0, 0);
			StTxtPara para1 = new StTxtPara();
			contentParas.InsertAt(para1, 0);
			StFootnote footnoteOrig2 = InsertTestFootnote(james, para1, 0, 0);
			StText titleText = new StText();
			StTxtPara title = new StTxtPara();
			james.TitleOA = titleText;
			titleText.ParagraphsOS.Append(title);
			StFootnote footnoteOrig1 = InsertTestFootnote(james, title, 0, 0);

			// archive draft
			IScrDraft draft = m_scr.CreateSavedVersion("FootnoteOrder james", new int[] { james.Hvo });

			Assert.AreEqual(draftCount + 1, m_scr.ArchivedDraftsOC.Count);
			Assert.AreEqual("FootnoteOrder james", draft.Description);
			Assert.AreEqual(1, draft.BooksOS.Count);
			IScrBook revision = draft.BooksOS.FirstItem;
			Assert.IsFalse(james.Hvo == revision.Hvo);
			Assert.AreEqual(james.SectionsOS.Count, revision.SectionsOS.Count);
			IScrSection revSection1 = revision.SectionsOS[0];
			IScrSection revSection2 = revision.SectionsOS[1];
			Assert.IsTrue(james.SectionsOS[0].Hvo != revSection1.Hvo);
			Assert.IsTrue(james.SectionsOS[0].Hvo != revSection2.Hvo);
			Assert.IsTrue(james.SectionsOS[1].Hvo != revSection1.Hvo);
			Assert.IsTrue(james.SectionsOS[1].Hvo != revSection2.Hvo);
			FdoOwningSequence<IStPara> s2Paras = revSection2.ContentOA.ParagraphsOS;
			Assert.AreEqual(james.SectionsOS[1].ContentOA.ParagraphsOS.Count,
				s2Paras.Count);

			StTxtPara titleRev = (StTxtPara)revision.TitleOA.ParagraphsOS[0];
			StTxtPara paraRev1 = (StTxtPara)s2Paras[0];
			StTxtPara paraRev2 = (StTxtPara)s2Paras[1];
			Assert.IsFalse(title.Hvo == titleRev.Hvo);
			Assert.IsFalse(para1.Hvo == paraRev1.Hvo);
			Assert.IsFalse(para2.Hvo == paraRev2.Hvo);

			Assert.AreEqual(hvoBookRef, revision.BookIdRAHvo);

			// Check the footnote
			Assert.AreEqual(james.FootnotesOS.Count, revision.FootnotesOS.Count);
			Assert.AreEqual(footnoteOrig1.Hvo, james.FootnotesOS[0].Hvo);
			Assert.AreEqual(footnoteOrig2.Hvo, james.FootnotesOS[1].Hvo);
			Assert.AreEqual(footnoteOrig3.Hvo, james.FootnotesOS[2].Hvo);
			IStFootnote footnoteRev1 = revision.FootnotesOS[0];
			IStFootnote footnoteRev2 = revision.FootnotesOS[1];
			IStFootnote footnoteRev3 = revision.FootnotesOS[2];
			Assert.IsTrue(footnoteRev1.Hvo != footnoteOrig1.Hvo);
			Assert.IsTrue(footnoteRev2.Hvo != footnoteOrig2.Hvo);
			Assert.IsTrue(footnoteRev3.Hvo != footnoteOrig3.Hvo);

			VerifyFootnote(footnoteRev1, titleRev, 0);
			VerifyFootnote(footnoteRev2, paraRev1, 0);
			VerifyFootnote(footnoteRev3, paraRev2, 0);
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:64,代码来源:FdoScriptureTests.cs

示例14: GetTextTokens_EmptyTsStringWithMissingWs

		public void GetTextTokens_EmptyTsStringWithMissingWs()
		{
			ScrChecksDataSource dataSource = new ScrChecksDataSource(Cache);
			int iExodus = 2;
			IScrBook exodus = m_scrInMemoryCache.AddBookToMockedScripture(iExodus, "Exodus");
			m_scrInMemoryCache.AddTitleToMockedBook(exodus.Hvo, "Exodus");
			IScrSection section = m_scrInMemoryCache.AddIntroSectionToMockedBook(exodus.Hvo);

			// Make the heading paragraph empty, and with no writing system set
			CacheBase cachebase = m_inMemoryCache.CacheAccessor;
			StTxtPara paraIntroSectHead = new StTxtPara(Cache, cachebase.NewHvo(StTxtPara.kClassId));
			cachebase.AppendToFdoVector(section.HeadingOAHvo,
				(int)StText.StTextTags.kflidParagraphs, paraIntroSectHead.Hvo);
			cachebase.SetBasicProps(paraIntroSectHead.Hvo, section.HeadingOAHvo, (int)StTxtPara.kClassId,
				(int)StText.StTextTags.kflidParagraphs, 1);
			ITsPropsFactory propFact = TsPropsFactoryClass.Create();
			paraIntroSectHead.StyleRules = propFact.MakeProps(ScrStyleNames.IntroSectionHead, 0, 0);
			ITsStrBldr strBldr = TsStrBldrClass.Create();
			strBldr.Replace(0, 0, "", null);
			paraIntroSectHead.Contents.UnderlyingTsString = strBldr.GetString();
			cachebase.SetGuid(paraIntroSectHead.Hvo, (int)CmObjectFields.kflidCmObject_Guid, Guid.NewGuid());

			// Set up the intro section contents
			StTxtPara paraIntroSectContent = m_scrInMemoryCache.AddParaToMockedText(section.ContentOAHvo,
				ScrStyleNames.IntroParagraph);
			m_scrInMemoryCache.AddRunToMockedPara(paraIntroSectContent, "There's not much to say, really.", null);
			section.AdjustReferences();

			Assert.IsTrue(dataSource.GetText(iExodus, 0));
			IEnumerator<ITextToken> tokens = dataSource.TextTokens().GetEnumerator();
			VerifyToken(tokens, "Exodus", ScrStyleNames.MainBookTitle, string.Empty, exodus.TitleOA.ParagraphsOS[0]);
			BCVRef expectedRef = new BCVRef(iExodus, 1, 0);
			VerifyToken(tokens, string.Empty, ScrStyleNames.IntroSectionHead, string.Empty, expectedRef, expectedRef,
				true, TextType.Other, null, paraIntroSectHead, (int)StTxtPara.StTxtParaTags.kflidContents);
			VerifyToken(tokens, "There's not much to say, really.", ScrStyleNames.IntroParagraph, string.Empty, paraIntroSectContent);
			Assert.IsFalse(tokens.MoveNext());
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:37,代码来源:FdoScriptureTests.cs

示例15: Dispose

		public void Dispose()
		{
			m_stText = null;
			m_tsf = null;
			m_text = null;
			m_firstPara = null;
			m_cache = null;
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:8,代码来源:DiscourseTestHelper.cs


注:本文中的SIL.FieldWorks.FDO.Cellar.StTxtPara类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。