Пример #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Creates a simulated range selection
		/// </summary>
		/// <param name="hvoPara1"></param>
		/// <param name="hvoPara2"></param>
		/// <param name="ichAnchor"></param>
		/// <param name="ichEnd"></param>
		/// ------------------------------------------------------------------------------------
		public void SetupSelectionForParas(int hvoPara1, int hvoPara2, int ichAnchor, int ichEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("NumberOfLevels", 1);
			SelLevInfo[] topInfo = new SelLevInfo[1];
			topInfo[0].tag = StTextTags.kflidParagraphs;
			topInfo[0].hvo = hvoPara1;
			SelLevInfo[] bottomInfo = new SelLevInfo[1];
			bottomInfo[0].tag = StTextTags.kflidParagraphs;
			bottomInfo[0].hvo = hvoPara2;
			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichAnchor);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichAnchor,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
Пример #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up a range selection in the specified back translation.
		/// </summary>
		/// <param name="wsStart">The writing system of the BT where the selection is to start,
		/// or -1 to start in the vernacular.</param>
		/// <param name="wsEnd">The writing system of the BT where the selection is to end,
		/// or -1 to end in the vernacular.</param>
		/// <param name="bookStart">The starting book.</param>
		/// <param name="iBookStart">The index of the starting book.</param>
		/// <param name="sectionStart">The starting section.</param>
		/// <param name="iSecStart">The index of the starting section.</param>
		/// <param name="paraStart">The starting paragraph.</param>
		/// <param name="iParaStart">The index of the starting paragraph.</param>
		/// <param name="ichStart">The starting character offset.</param>
		/// <param name="setupForHeadingStart">if set to <c>true</c> setup selection to start in
		/// section heading; otherwise, set up selection in contents.</param>
		/// <param name="bookEnd">The ending book.</param>
		/// <param name="iBookEnd">The index of the ending book.</param>
		/// <param name="sectionEnd">The ending section.</param>
		/// <param name="iSecEnd">The index of the ending section.</param>
		/// <param name="paraEnd">The ending paragraph.</param>
		/// <param name="iParaEnd">The index of the para end.</param>
		/// <param name="ichEnd">The ending character offset.</param>
		/// <param name="setupForHeadingEnd">if set to <c>true</c> setup selection to end in
		/// section heading; otherwise, set up selection in contents.</param>
		/// ------------------------------------------------------------------------------------
		public void SetupRangeSelection(int wsStart, int wsEnd, IScrBook bookStart, int iBookStart,
			IScrSection sectionStart, int iSecStart, IStTxtPara paraStart, int iParaStart, int ichStart,
			bool setupForHeadingStart, IScrBook bookEnd, int iBookEnd, IScrSection sectionEnd,
			int iSecEnd, IStTxtPara paraEnd, int iParaEnd, int ichEnd, bool setupForHeadingEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			int cLevelsTop = wsStart > 0 ? 5 : 4;
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[cLevelsTop];
			int iLev = 0;
			if (wsStart > 0)
			{
				topInfo[iLev].tag = -1;
				topInfo[iLev].ihvo = 0;
				topInfo[iLev].hvo = paraStart.TranslationsOC.HvoArray[0];
				iLev++;
			}
			topInfo[iLev].tag = (int)StText.StTextTags.kflidParagraphs;
			topInfo[iLev].ihvo = iParaStart;
			topInfo[iLev].hvo = paraStart.Hvo;
			topInfo[++iLev].tag = setupForHeadingStart ? (int)ScrSection.ScrSectionTags.kflidHeading :
				(int)ScrSection.ScrSectionTags.kflidContent;
			topInfo[iLev].ihvo = 0;
			topInfo[iLev].hvo = setupForHeadingStart ? sectionStart.HeadingOA.Hvo :
				sectionStart.ContentOA.Hvo;
			topInfo[++iLev].tag = (int)ScrBook.ScrBookTags.kflidSections;
			topInfo[iLev].ihvo = iSecStart;
			topInfo[iLev].hvo = sectionStart.Hvo;
			topInfo[++iLev].tag = BookFilter.Tag;
			topInfo[iLev].ihvo = iBookStart;
			topInfo[iLev].hvo = bookStart.Hvo;

			// Setup the end
			int cLevelsBottom = wsEnd > 0 ? 5 : 4;
			SelLevInfo[] bottomInfo = new SelLevInfo[cLevelsBottom];
			iLev = 0;
			if (wsEnd > 0)
			{
				bottomInfo[iLev].tag = -1;
				bottomInfo[iLev].ihvo = 0;
				bottomInfo[iLev].hvo = paraEnd.TranslationsOC.HvoArray[0];
				iLev++;
			}
			bottomInfo[iLev].tag = (int)StText.StTextTags.kflidParagraphs;
			bottomInfo[iLev].ihvo = iParaEnd;
			bottomInfo[iLev].hvo = paraEnd.Hvo;
			bottomInfo[++iLev].tag = setupForHeadingEnd ? (int)ScrSection.ScrSectionTags.kflidHeading :
				(int)ScrSection.ScrSectionTags.kflidContent;
			bottomInfo[iLev].ihvo = 0;
			bottomInfo[iLev].hvo = setupForHeadingEnd ? sectionEnd.HeadingOA.Hvo :
				sectionEnd.ContentOA.Hvo;
			bottomInfo[++iLev].tag = (int)ScrBook.ScrBookTags.kflidSections;
			bottomInfo[iLev].ihvo = iSecEnd;
			bottomInfo[iLev].hvo = sectionEnd.Hvo;
			bottomInfo[++iLev].tag = BookFilter.Tag;
			bottomInfo[iLev].ihvo = iBookEnd;
			bottomInfo[iLev].hvo = bookEnd.Hvo;

			fakeSelHelper.SetupResult("NumberOfLevels", cLevelsTop);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsTop,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsTop,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsBottom,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetNumberOfLevels", cLevelsBottom,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichStart);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResult("Ws", wsStart);
			fakeSelHelper.SetupResult("IsValid", true);
			fakeSelHelper.SetupResult("AssocPrev", false);
			fakeSelHelper.Ignore("get_IsRange");
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsStart > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsStart > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsEnd > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetTextPropId", wsEnd > 0 ?
				(int)CmTranslation.CmTranslationTags.kflidTranslation :
				(int)StTxtPara.StTxtParaTags.kflidContents,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsStart == -1 ? m_cache.DefaultVernWs : wsStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsStart == -1 ? m_cache.DefaultVernWs : wsStart,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsEnd == -1 ? m_cache.DefaultVernWs : wsEnd,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetWritingSystem", wsEnd == -1 ? m_cache.DefaultVernWs : wsEnd,
				SelectionHelper.SelLimitType.End);
			m_viewSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
Пример #3
0
		/// <summary></summary>
		public DummySCTextEnum(IScrImportSet settings, ImportDomain domain,
			BCVRef startRef, BCVRef endRef) :
			base(settings, domain, startRef, endRef)
		{
			DynamicMock mockConverters = new DynamicMock(typeof(IEncConverters));
			mockConverters.SetupResultForParams("Item", new DummyEncConverter(), "UPPERCASE");
			m_encConverters = (IEncConverters)mockConverters.MockInstance;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up expected values for selection and action handler
		/// </summary>
		/// <param name="para">The paragraph.</param>
		/// <param name="section">The section.</param>
		/// <param name="ich">The character offset of the IP in the para.</param>
		/// <returns>Mock selection</returns>
		/// ------------------------------------------------------------------------------------
		private DynamicMock SetupInsertVerseSelection(IStTxtPara para, IScrSection section, int ich)
		{
			int hvoPara = para.Hvo;

#if DEBUG
			m_selHelper.SetupResult("IsRange", false);
#endif
			m_selHelper.SetupResult("IchAnchor", ich);
			m_selHelper.SetupResult("IchEnd", ich);
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.Anchor });
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.End });
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.Top });
			m_selHelper.SetupResultForParams("GetIch", ich, new object[] { SelectionHelper.SelLimitType.Bottom });

			DynamicMock sel = new DynamicMock(typeof(IVwSelection));
			m_rootBox.SetupResult("Selection", sel.MockInstance);
			sel.Strict = true;
			sel.SetupResult("IsValid", true);

			m_selHelper.ExpectAndReturn("ReduceSelectionToIp",
				m_selHelper.MockInstance, SelectionHelper.SelLimitType.Top, false, false);
			m_selHelper.SetupResultForParams("GetTextPropId",
				StTextTags.kflidParagraphs, SelectionHelper.SelLimitType.Anchor);
			m_selHelper.ExpectAndReturn("GetTextPropId", StTxtParaTags.kflidContents,
				new object[] { SelectionHelper.SelLimitType.Top });

			ITsPropsBldr builder = TsPropsBldrClass.Create();
			ITsTextProps selProps = builder.GetTextProps();
			m_selHelper.ExpectAndReturn("SelProps", selProps);
			m_selHelper.ExpectAndReturn("SetSelection", sel.MockInstance, false);
			m_selHelper.Expect("AssocPrev", true);
			m_selHelper.Expect("SetIPAfterUOW");
			m_selHelper.ExpectAndReturn("GetTextPropId", StTxtParaTags.kflidContents,
				new object[] { SelectionHelper.SelLimitType.Top });

			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsEnd, m_TextSelInfoTypes,
				new object[] { true, para.Contents, ich,
							 false, para.Hvo, kflidParaContent, 0 });
			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsAnchor, m_TextSelInfoTypes,
				new object[] { false, para.Contents, ich,
							 false, para.Hvo, kflidParaContent, 0 });
			m_selHelper.ExpectAndReturn("GetTextPropId", StTxtParaTags.kflidContents,
				new object[] { SelectionHelper.SelLimitType.Top });
			m_selHelper.SetupResultForParams("GetTss", para.Contents,
				new object[] { SelectionHelper.SelLimitType.Anchor });

			SetupSelection(sel, para, section);

			return sel;
		}
Пример #5
0
		//[ExpectedException(typeof(ArgumentException),
		//	ExpectedMessage = "The character \u0301 (U+0301) is not valid\r\nParameter name: chars")]
		public void ParseCharString_BogusCharacter()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x0301);
			cpe.SetupResultForParams("get_IsLetter", false, 0x0301);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResultForParams("get_IsMark", true, 0x0301);
			List<string> invalidChars;
			var validChars = TsStringUtils.ParseCharString("\u0301", " ",
				(ILgCharacterPropertyEngine)cpe.MockInstance, out invalidChars);
			Assert.AreEqual(0, validChars.Count);
			Assert.AreEqual(1, invalidChars.Count);
			Assert.AreEqual("\u0301", invalidChars[0]);
		}
Пример #6
0
		public void ParseCharString_LeadingSpace()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'a');
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'b');
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccZs, (int)' ');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'a');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'b');
			cpe.SetupResultForParams("get_IsLetter", false, (int)' ');
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			List<string> invalidChars;
			var validChars = TsStringUtils.ParseCharString("  a b", " ",
				(ILgCharacterPropertyEngine)cpe.MockInstance, out invalidChars);
			Assert.AreEqual(3, validChars.Count);
			Assert.AreEqual(" ", validChars[0]);
			Assert.AreEqual("a", validChars[1]);
			Assert.AreEqual("b", validChars[2]);
			Assert.AreEqual(0, invalidChars.Count);
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Sets up expected values for selection and action handler
		/// </summary>
		/// <param name="para">The paragraph.</param>
		/// <param name="iPara">The index of the para.</param>
		/// <param name="hvoSection">The hvo of the section.</param>
		/// <param name="iSection">The index of the section.</param>
		/// <param name="hvoBook">The hvo of the book.</param>
		/// <param name="ich">The character offset of the IP in the para.</param>
		/// <returns>Mock selection</returns>
		/// ------------------------------------------------------------------------------------
		private DynamicMock SetupInsertChapterSelection(StTxtPara para, int iPara,
			int hvoSection, int iSection, int hvoBook, int ich)
		{
			int hvoPara = para.Hvo;

			DynamicMock sel = new DynamicMock(typeof(IVwSelection));
			sel.Strict = true;
			sel.SetupResult("IsValid", true);
			sel.SetupResult("SelType", VwSelType.kstText);
			sel.SetupResult("IsRange", false);

			sel.ExpectAndReturn("Commit", true);
			m_rootBox.SetupResult("Selection", sel.MockInstance);

			// set up expected calls to action handler
			m_selHelper.SetupResult("Selection", sel.MockInstance);
			SelLevInfo[] info = new SelLevInfo[4];
			info[0] = new SelLevInfo();
			info[0].tag = (int)StText.StTextTags.kflidParagraphs;
			info[0].hvo = hvoPara;
			info[0].ihvo = iPara;
			info[1] = new SelLevInfo();
			info[1].tag = (int)ScrSection.ScrSectionTags.kflidContent;
			info[1].hvo = Cache.LangProject.Hvo; // hvo of text. Who cares?
			info[2] = new SelLevInfo();
			info[2].tag = (int)ScrBook.ScrBookTags.kflidSections;
			info[2].hvo = hvoSection;
			info[2].ihvo = iSection;
			info[3] = new SelLevInfo();
			info[3].tag = m_draftView.BookFilter.Tag;
			info[3].hvo = hvoBook;
			m_selHelper.SetupResult("GetLevelInfo", info,
				new Type[] { typeof(SelectionHelper.SelLimitType)});
			m_selHelper.SetupResult("LevelInfo", info);
			m_selHelper.SetupResultForParams("GetTextPropId",
				(int)StText.StTextTags.kflidParagraphs, SelectionHelper.SelLimitType.Anchor);

			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsEnd, m_TextSelInfoTypes,
				new object[] { true, para.Contents.UnderlyingTsString, ich, false, hvoPara,
					kflidParaContent, 0 });
			sel.SetupResultForParams("TextSelInfo", null, m_TextSelInfoArgsAnchor, m_TextSelInfoTypes,
				new object[] { false, para.Contents.UnderlyingTsString, ich, false, hvoPara,
					kflidParaContent, 0 });
			m_selHelper.ExpectAndReturn("GetTextPropId", (int)StTxtPara.StTxtParaTags.kflidContents, new object[] { SelectionHelper.SelLimitType.Top });
			m_selHelper.SetupResultForParams("GetTss", para.Contents.UnderlyingTsString,
				new object[] { SelectionHelper.SelLimitType.Anchor });
			m_selHelper.SetupResult("IsValid", true);

			return sel;
		}
Пример #8
0
		public void ValidateCharacterSequence_MultipleBaseCharsThatComposeIntoASingleBaseChar()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1100);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1161);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x11B7);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0xAC10);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1100);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1161);
			cpe.SetupResultForParams("get_IsLetter", true, 0x11B7);
			cpe.SetupResultForParams("get_IsLetter", true, 0xAC10);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", true, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			Assert.AreEqual("\uAC10",
				TsStringUtils.ValidateCharacterSequence("\u1100\u1161\u11B7",
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
Пример #9
0
		public void IsValidChar_MultipleBaseCharsThatComposeIntoASingleBaseChar()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1100);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x1161);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0x11B7);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLo, 0xAC10);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1100);
			cpe.SetupResultForParams("get_IsLetter", true, 0x1161);
			cpe.SetupResultForParams("get_IsLetter", true, 0x11B7);
			cpe.SetupResultForParams("get_IsLetter", true, 0xAC10);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", true, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			cpe.SetupResultForParams("NormalizeD", "\u1100\u1161\u11B7", "\uAC10");
			cpe.SetupResultForParams("NormalizeD", "\u1100\u1161\u11B7", "\u1100\u1161\u11B7");
			Assert.IsTrue(ReflectionHelper.GetBoolResult(typeof(TsStringUtils), "IsValidChar",
				"\u1100\u1161\u11B7", (ILgCharacterPropertyEngine)cpe.MockInstance));
		}
Пример #10
0
		public void ValidateCharacterSequence_MultipleLetters()
		{
			DynamicMock cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'n');
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'o');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'n');
			cpe.SetupResultForParams("get_IsLetter", true, (int)'o');
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResult("get_IsMark", false, typeof(int));
			Assert.AreEqual("n", StringUtils.ValidateCharacterSequence("no", null,
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
Пример #11
0
		public void ValidateCharacterSequence_DiacriticBeforeLetter()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, 0x0301);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, (int)'o');
			cpe.SetupResultForParams("get_IsLetter", false, 0x0301);
			cpe.SetupResultForParams("get_IsLetter", true, (int)'o');
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResultForParams("get_IsMark", true, 0x0301);
			cpe.SetupResultForParams("get_IsMark", false, (int)'o');
			Assert.AreEqual("o", TsStringUtils.ValidateCharacterSequence("\u0301o",
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
Пример #12
0
		public void ValidateCharacterSequence_BaseCharacterPlusMultipleDiacritics()
		{
			DynamicMock cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, 0x05E9);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x05C1);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x05B4);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x0596);
			cpe.SetupResultForParams("get_IsLetter", true, 0x05E9);
			cpe.SetupResultForParams("get_IsLetter", false, 0x05C1);
			cpe.SetupResultForParams("get_IsLetter", false, 0x05B4);
			cpe.SetupResultForParams("get_IsLetter", false, 0x0596);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", false, typeof(int));
			cpe.SetupResultForParams("get_IsMark", false, 0x05E9);
			cpe.SetupResultForParams("get_IsMark", true, 0x05C1);
			cpe.SetupResultForParams("get_IsMark", true, 0x05B4);
			cpe.SetupResultForParams("get_IsMark", true, 0x0596);
			Assert.AreEqual("\u05E9\u05C1\u05B4\u0596",
				StringUtils.ValidateCharacterSequence("\u05E9\u05C1\u05B4\u0596", null,
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
Пример #13
0
		public void AddDefaultMappingIfNeeded_btMappingsWithNonDefaultMappings()
		{
			DynamicMock mockStylesheet = new DynamicMock(typeof(IVwStylesheet));
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.General, "Emphasis");
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstCharacter, "Emphasis");

			ScrMappingList list = new ScrMappingList(MappingSet.Main, (IVwStylesheet)mockStylesheet.MockInstance);
			list.Add(new ImportMappingInfo(@"\p", null, "Emphasis"));
			list.AddDefaultMappingIfNeeded(@"\btp", ImportDomain.Main, true);
			Assert.AreEqual(2, list.Count);

			// Test that \btp maps automatically to the corresponding vernacular style ("Emphasis")
			// but does not map into the Back-trans marker domain because Emphasis is a character style.
			ImportMappingInfo info = list[@"\btp"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btp should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual("Emphasis", info.StyleName);
		}
Пример #14
0
		public void AddDefaultMappingIfNeeded_btMappings()
		{
			DynamicMock mockStylesheet = new DynamicMock(typeof(IVwStylesheet));
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.Note, ScrStyleNames.NormalFootnoteParagraph);
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.Text, ScrStyleNames.NormalParagraph);
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.General, "Emphasis");
			mockStylesheet.SetupResultForParams("GetContext", (int)ContextValues.Annotation, ScrStyleNames.Remark);
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstParagraph, ScrStyleNames.NormalFootnoteParagraph);
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstParagraph, ScrStyleNames.NormalParagraph);
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstCharacter, "Emphasis");
			mockStylesheet.SetupResultForParams("GetType", (int)StyleType.kstParagraph, ScrStyleNames.Remark);

			ScrMappingList list = new ScrMappingList(MappingSet.Main, (IVwStylesheet)mockStylesheet.MockInstance);
			list.AddDefaultMappingIfNeeded(@"\bt", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btc", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btf", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btp", ImportDomain.Main, true);
			list.Add(new ImportMappingInfo(@"\emph", null, "Emphasis"));
			list.AddDefaultMappingIfNeeded(@"\btemph", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\btrem", ImportDomain.Main, true);
			list.AddDefaultMappingIfNeeded(@"\bty", ImportDomain.Main, true);
			Assert.AreEqual(8, list.Count);

			// Test that \bt does not map automatically as a Back-trans marker.
			ImportMappingInfo info = list[@"\bt"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\bt should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);

			// Test that \btc does not map automatically as a Back-trans marker (this is a special exception to the rul).
			info = list[@"\btc"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btc should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);

			// Test that \btf maps automatically as a Back-trans marker.
			info = list[@"\btf"];
			Assert.AreEqual(MarkerDomain.BackTrans | MarkerDomain.Footnote, info.Domain, @"\btf should map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual(ScrStyleNames.NormalFootnoteParagraph, info.StyleName);

			// Test that \btp maps automatically as a Back-trans marker.
			info = list[@"\btp"];
			Assert.AreEqual(MarkerDomain.BackTrans, info.Domain, @"\btp should map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual(ScrStyleNames.NormalParagraph, info.StyleName);

			// Test that \btemph maps automatically to the corresponding vernacular style but does not map
			// into the Back-trans marker domain because \emph is a character style.
			info = list[@"\btemph"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btemph should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.AreEqual("Emphasis", info.StyleName);

			// Test that \btrem does not map automatically as a Back-trans marker (because \rem is a Note style).
			info = list[@"\btrem"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\btrem should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);

			// Test that \bty does not map automatically as a Back-trans marker (because \y has no default mapping).
			info = list[@"\bty"];
			Assert.AreEqual(MarkerDomain.Default, info.Domain, @"\bty should not map automatically as a Back-trans marker");
			Assert.IsFalse(info.IsExcluded);
			Assert.AreEqual(MappingTargetType.TEStyle, info.MappingTarget);
			Assert.IsNull(info.StyleName);
		}
Пример #15
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="bookStart"></param>
		/// <param name="iBookStart"></param>
		/// <param name="sectionStart"></param>
		/// <param name="iSecStart"></param>
		/// <param name="paraStart"></param>
		/// <param name="iParaStart"></param>
		/// <param name="ichStart"></param>
		/// <param name="setupForHeadingStart"></param>
		/// <param name="bookEnd"></param>
		/// <param name="iBookEnd"></param>
		/// <param name="sectionEnd"></param>
		/// <param name="iSecEnd"></param>
		/// <param name="paraEnd"></param>
		/// <param name="iParaEnd"></param>
		/// <param name="ichEnd"></param>
		/// <param name="setupForHeadingEnd"></param>
		/// ------------------------------------------------------------------------------------
		public void SetupRangeSelection(IScrBook bookStart, int iBookStart, IScrSection sectionStart,
			int iSecStart, IStTxtPara paraStart, int iParaStart, int ichStart,
			bool setupForHeadingStart, IScrBook bookEnd, int iBookEnd, IScrSection sectionEnd,
			int iSecEnd, IStTxtPara paraEnd, int iParaEnd, int ichEnd, bool setupForHeadingEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("NumberOfLevels", 4);
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[4];
			topInfo[0].tag = StTextTags.kflidParagraphs;
			topInfo[0].ihvo = iParaStart;
			topInfo[0].hvo = paraStart.Hvo;
			topInfo[1].tag = setupForHeadingStart ? ScrSectionTags.kflidHeading :
				ScrSectionTags.kflidContent;
			topInfo[1].ihvo = 0;
			topInfo[1].hvo = setupForHeadingStart ? sectionStart.HeadingOA.Hvo :
				sectionStart.ContentOA.Hvo;
			topInfo[2].tag = ScrBookTags.kflidSections;
			topInfo[2].ihvo = iSecStart;
			topInfo[2].hvo = sectionStart.Hvo;
			topInfo[3].tag = ScriptureTags.kflidScriptureBooks;
			topInfo[3].ihvo = iBookStart;
			topInfo[3].hvo = bookStart.Hvo;

			// Setup the end
			SelLevInfo[] bottomInfo = new SelLevInfo[4];
			bottomInfo[0].tag = StTextTags.kflidParagraphs;
			bottomInfo[0].ihvo = iParaEnd;
			bottomInfo[0].hvo = paraEnd.Hvo;
			bottomInfo[1].tag = setupForHeadingEnd ? ScrSectionTags.kflidHeading :
				ScrSectionTags.kflidContent;
			bottomInfo[1].ihvo = 0;
			bottomInfo[1].hvo = setupForHeadingEnd ? sectionEnd.HeadingOA.Hvo :
				sectionEnd.ContentOA.Hvo;
			bottomInfo[2].tag = ScrBookTags.kflidSections;
			bottomInfo[2].ihvo = iSecEnd;
			bottomInfo[2].hvo = sectionEnd.Hvo;
			bottomInfo[3].tag = ScriptureTags.kflidScriptureBooks;
			bottomInfo[3].ihvo = iBookEnd;
			bottomInfo[3].hvo = bookEnd.Hvo;

			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichStart);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResult("IsValid", true);
			fakeSelHelper.SetupResult("AssocPrev", false);
			fakeSelHelper.Ignore("get_IsRange");
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
Пример #16
0
		public void ValidateCharacterSequence_MultipleBaseCharsJoinedByZWNJ()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccLl, 0x05E9);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x05C1);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x05B4);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccMn, 0x0596);
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccCf, 0x200C);
			cpe.SetupResultForParams("get_IsLetter", true, 0x05E9);
			cpe.SetupResultForParams("get_IsLetter", false, 0x05C1);
			cpe.SetupResultForParams("get_IsLetter", false, 0x05B4);
			cpe.SetupResultForParams("get_IsLetter", false, 0x0596);
			cpe.SetupResultForParams("get_IsLetter", false, 0x200C);
			cpe.SetupResult("get_IsNumber", false, typeof(int));
			cpe.SetupResult("get_IsPunctuation", false, typeof(int));
			cpe.SetupResult("get_IsSymbol", true, typeof(int));
			cpe.SetupResultForParams("get_IsMark", false, 0x05E9);
			cpe.SetupResultForParams("get_IsMark", true, 0x05C1);
			cpe.SetupResultForParams("get_IsMark", true, 0x05B4);
			cpe.SetupResultForParams("get_IsMark", true, 0x0596);
			cpe.SetupResultForParams("get_IsMark", false, 0x200C);
			Assert.AreEqual("\u05E9\u05C1\u05B4\u200C\u0596",
				TsStringUtils.ValidateCharacterSequence("\u05E9\u05C1\u05B4\u200C\u0596",
				(ILgCharacterPropertyEngine)cpe.MockInstance));
		}
Пример #17
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="para"></param>
		/// <param name="iPara"></param>
		/// <param name="book"></param>
		/// <param name="iBook"></param>
		/// ------------------------------------------------------------------------------------
		public void SetupSelectionInTitlePara(IStTxtPara para, int iPara, IScrBook book, int iBook,
			int ich)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("NumberOfLevels", 3);
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[3];
			topInfo[0].tag = StTextTags.kflidParagraphs;
			topInfo[0].ihvo = iPara;
			topInfo[0].hvo = para.Hvo;
			topInfo[1].tag = ScrBookTags.kflidTitle;
			topInfo[1].ihvo = 0;
			topInfo[1].hvo = book.TitleOA.Hvo;
			topInfo[2].tag = ScriptureTags.kflidScriptureBooks;
			topInfo[2].ihvo = iBook;
			topInfo[2].hvo = book.Hvo;

			// Setup the end
			SelLevInfo[] bottomInfo = new SelLevInfo[3];
			for(int i = 0; i < 3; i++)
				bottomInfo[i] = topInfo[i];

			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ich);
			fakeSelHelper.SetupResult("IchEnd", ich);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ich,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ich,
				SelectionHelper.SelLimitType.Bottom);
			m_currentSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
Пример #18
0
		public void ValidateCharacterSequence_AllowZwnjAndZwj()
		{
			var cpe = new DynamicMock(typeof(ILgCharacterPropertyEngine));
			cpe.SetupResultForParams("get_GeneralCategory", LgGeneralCharCategory.kccCf, 0x200D);
			cpe.SetupResultForParams("get_IsLetter", false, 0x200D);
			cpe.SetupResultForParams("get_IsNumber", false, 0x200D);
			cpe.SetupResultForParams("get_IsPunctuation", false, 0x200D);
			cpe.SetupResultForParams("get_IsSymbol", true, 0x200D);
			cpe.SetupResultForParams("get_IsMark", false, 0x200D);
			Assert.AreEqual("\u200D",
				TsStringUtils.ValidateCharacterSequence("\u200D", (ILgCharacterPropertyEngine)cpe.MockInstance));
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Setup the selection in footnote.
		/// </summary>
		/// <param name="footnote">The footnote.</param>
		/// <param name="book">The book.</param>
		/// <param name="iBook">The 0-based index of the book.</param>
		/// <param name="ichStart">The 0-based starting character index.</param>
		/// <param name="ichEnd">The 0-based ending character index.</param>
		/// ------------------------------------------------------------------------------------
		public void SetupSelectionInFootnote(StFootnote footnote, IScrBook book,
			int iBook, int ichStart, int ichEnd)
		{
			CheckDisposed();

			DynamicMock fakeSelHelper = new DynamicMock(typeof(SelectionHelper));
			fakeSelHelper.SetupResult("NumberOfLevels", 3);
			// Setup the anchor
			SelLevInfo[] topInfo = new SelLevInfo[3];
			StTxtPara para = (StTxtPara)footnote.ParagraphsOS[0];
			topInfo[0].tag = (int)StText.StTextTags.kflidParagraphs;
			topInfo[0].ihvo = 0;	// only one para per footnote allowed
			topInfo[0].hvo = para.Hvo;

			topInfo[1].tag = (int)ScrBook.ScrBookTags.kflidFootnotes;
			topInfo[1].ihvo = footnote.IndexInOwner;
			topInfo[1].hvo = footnote.Hvo;

			topInfo[2].tag = BookFilter.Tag;
			topInfo[2].ihvo = iBook;
			topInfo[2].hvo = book.Hvo;

			// Setup the end
			SelLevInfo[] bottomInfo = new SelLevInfo[3];
			for(int i = 0; i < 3; i++)
				bottomInfo[i] = topInfo[i];

			fakeSelHelper.SetupResult("LevelInfo", topInfo);
			fakeSelHelper.SetupResult("IchAnchor", ichStart);
			fakeSelHelper.SetupResult("IchEnd", ichEnd);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", topInfo,
				SelectionHelper.SelLimitType.Anchor);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.Bottom);
			fakeSelHelper.SetupResultForParams("GetLevelInfo", bottomInfo,
				SelectionHelper.SelLimitType.End);
			fakeSelHelper.SetupResultForParams("GetIch", ichStart,
				SelectionHelper.SelLimitType.Top);
			fakeSelHelper.SetupResultForParams("GetIch", ichEnd,
				SelectionHelper.SelLimitType.Bottom);
			m_viewSelection = (SelectionHelper)fakeSelHelper.MockInstance;
		}
Пример #20
0
		public void ConvertFromBlobSettings_Other_Version0x104()
		{
			CheckDisposed();

			// Create a blob of settings.
			ArrayList mappingList = new ArrayList();
			mappingList.Add(new MappingInfo(@"\btp", null, false, null, MarkerDomain.BackTrans, ScrStyleNames.NormalParagraph, null, false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"\btp_fr", null, false, null, MarkerDomain.BackTrans, ScrStyleNames.NormalParagraph, "fr", false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"\c", null, false, null, MarkerDomain.Default, ScrStyleNames.ChapterNumber, null, false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"|i{", @"}", true, null, MarkerDomain.Default, "Emphasis", null, false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"\ex", null, false, null, MarkerDomain.Default, null, null, true, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"\f", null, false, null, MarkerDomain.Default, ScrStyleNames.NormalFootnoteParagraph, null, false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"\fig", null, false, null, MarkerDomain.Default, null, null, false, MappingTargetType.Figure));
			mappingList.Add(new MappingInfo(@"\h", null, false, null, MarkerDomain.Default, null, null, false, MappingTargetType.TitleShort));
			mappingList.Add(new MappingInfo(@"\id", null, false, null, MarkerDomain.Default, null, null, false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"\rem", null, false, null, MarkerDomain.Note, ScrStyleNames.Remark, null, false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"\v", null, false, null, MarkerDomain.Default, ScrStyleNames.VerseNumber, null, false, MappingTargetType.TEStyle));
			mappingList.Add(new MappingInfo(@"|x{", "}", true, null, MarkerDomain.Default | MarkerDomain.Footnote, ScrStyleNames.CrossRefFootnoteParagraph, null, false, MappingTargetType.TEStyle));

			ArrayList fileList = new ArrayList(2);
			fileList.Add(@"c:\my data\first file.sf");
			fileList.Add(@"c:\my data\tom's file.sf");

			m_importSettings.ImportType = (int)TypeOfImport.Other;

			DynamicMock mockStyleSheet = new DynamicMock(typeof(IVwStylesheet));
			mockStyleSheet.SetupResultForParams("GetContext", ContextValues.Note, ScrStyleNames.NormalFootnoteParagraph);
			mockStyleSheet.SetupResultForParams("GetContext", ContextValues.General, new IsAnything()); // We don't care about anything else for these tests

			ReflectionHelper.SetField(m_importSettings, "m_stylesheet", (IVwStylesheet)mockStyleSheet.MockInstance);

			// Call ConvertFromBlobSettings, which should cause the blob to be converted.
			ReflectionHelper.CallMethod(m_importSettings, "ConvertFromBlobSettings",
				GetEcProjectSettingsArray(mappingList, fileList));

			// Make sure that the blob and deprecated footnote settings are eliminated and
			// that the settings are correct in the database.
			Assert.AreEqual(0, ImportSettings.Length);
			Assert.AreEqual(12, m_importSettings.ScriptureMappingsOC.Count);
			Assert.AreEqual(0, m_importSettings.NoteMappingsOC.Count);

			IEnumerator<IScrMarkerMapping> mappings = m_importSettings.ScriptureMappingsOC.GetEnumerator();
			//mappings.Reset(); // Throws NotSupportedException exception on generic enumerator
			VerifyNextMapping(mappings, @"\btp", null, MarkerDomain.BackTrans, ScrStyleNames.NormalParagraph, null, false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"\btp_fr", null, MarkerDomain.BackTrans, ScrStyleNames.NormalParagraph, "fr", false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"\c", null, MarkerDomain.Default /* NOT Default! */, ScrStyleNames.ChapterNumber, null, false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"|i{", @"}", MarkerDomain.Default, "Emphasis", null, false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"\ex", null, MarkerDomain.Default, null, null, true, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"\f", null, MarkerDomain.Footnote, ScrStyleNames.NormalFootnoteParagraph, null, false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"\fig", null, MarkerDomain.Default, null, null, false, MappingTargetType.Figure);
			VerifyNextMapping(mappings, @"\h", null, MarkerDomain.Default, null, null, false, MappingTargetType.TitleShort);
			VerifyNextMapping(mappings, @"\id", null, MarkerDomain.Default, null, null, false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"\rem", null, MarkerDomain.Note, ScrStyleNames.Remark, null, false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"\v", null, MarkerDomain.Default /* NOT Default! */, ScrStyleNames.VerseNumber, null, false, MappingTargetType.TEStyle);
			VerifyNextMapping(mappings, @"|x{", "}", MarkerDomain.Footnote, ScrStyleNames.CrossRefFootnoteParagraph, null, false, MappingTargetType.TEStyle);
			Assert.IsFalse(mappings.MoveNext(), "This is just a sanity check to make sure we remembered to check all the mappings in this test.");

			Assert.AreEqual(1, m_importSettings.ScriptureSourcesOC.Count);
			Assert.AreEqual(0, m_importSettings.BackTransSourcesOC.Count);
			Assert.AreEqual(0, m_importSettings.NoteSourcesOC.Count);

			ScrImportSFFiles scriptureSource = new ScrImportSFFiles(Cache, m_importSettings.ScriptureSourcesOC.HvoArray[0]);
			Assert.AreEqual((int)FileFormatType.Other, scriptureSource.FileFormat);
			Assert.AreEqual(2, scriptureSource.FilesOC.Count);
			int[] cmFileHvos = scriptureSource.FilesOC.HvoArray;
			CmFile file = new CmFile(Cache, cmFileHvos[0]);
			Assert.AreEqual((string)fileList[0], file.AbsoluteInternalPath);
			file = new CmFile(Cache, cmFileHvos[1]);
			Assert.AreEqual((string)fileList[1], file.AbsoluteInternalPath);
		}