Ejemplo n.º 1
0
		public void SetStyleMapping_Update()
		{
			DummyUsfmStyEntry entry = new DummyUsfmStyEntry();
			m_exporter.UsfmStyFileAccessor.Add("mt", entry);
			entry.SetUsfmStyProperty(@"\TEStyleName", "Book Title");
			entry.SetUsfmStyProperty(@"\Name", "(mt) Title - Major Title Level 1");
			entry.SetUsfmStyProperty(@"\Description", "The main title of the book (if single level)");
			entry.SetUsfmStyProperty(@"\OccursUnder", "id");
			entry.SetUsfmStyProperty(@"\Rank", "3");
			entry.SetUsfmStyProperty(@"\TextProperties", "paragraph publishable vernacular level_1");
			entry.SetUsfmStyProperty(@"\TextType", "Title");
			entry.SetUsfmStyProperty(@"\StyleType", "Paragraph");
			entry.SetUsfmStyProperty(@"\FontSize", "20");
			entry.SetUsfmStyProperty(@"\Bold", "");
			entry.SetUsfmStyProperty(@"\Justification", "Center");
			entry.SetUsfmStyProperty(@"\SpaceBefore", "8");
			entry.SetUsfmStyProperty(@"\SpaceAfter", "4");

			// The test base already creates all of the standard scripture styles. We just modify
			// one of them here for our test.
			ITsPropsBldr props;
			IStStyle mainTitleStyle = m_scr.FindStyle(ScrStyleNames.MainBookTitle);
			Assert.IsNotNull(mainTitleStyle, "Problem in test setup - Main Title should exist");
			props = mainTitleStyle.Rules.GetBldr();
			props.SetIntPropValues((int)FwTextPropType.ktptBold,
				(int)FwTextPropVar.ktpvEnum,
				(int)FwTextToggleVal.kttvOff);
			props.SetIntPropValues((int)FwTextPropType.ktptAlign,
				(int)FwTextPropVar.ktpvDefault, (int)FwTextAlign.ktalLeading);
			props.SetIntPropValues((int)FwTextPropType.ktptFontSize,
				(int)FwTextPropVar.ktpvMilliPoint, 22000);
			props.SetIntPropValues((int)FwTextPropType.ktptSpaceBefore,
				(int)FwTextPropVar.ktpvMilliPoint, 2000);
			mainTitleStyle.Rules = props.GetTextProps();

			m_exporter.SetStyleMapping(ScrStyleNames.MainBookTitle, @"\mt");
			entry = (DummyUsfmStyEntry)m_exporter.UsfmEntries[ScrStyleNames.MainBookTitle];
			Assert.IsNotNull(entry);
			Assert.AreEqual(ScrStyleNames.MainBookTitle, entry.Name);
			Assert.AreEqual("(mt) Title - Major Title Level 1", entry.P6Name);
			Assert.AreEqual("The main title of the book (if single level)", entry.Description);
			Assert.AreEqual("id", entry.OccursUnder);
			Assert.AreEqual(3, entry.Rank);
			Assert.AreEqual("Title", entry.TextType);
			Assert.AreEqual("Paragraph", entry.StyleType);
			Assert.AreEqual(FwTextAlign.ktalLeading, entry.Alignment);
			Assert.IsFalse(entry.FontInfoForWs(-1).m_bold.Value);
			Assert.AreEqual(22000, entry.FontInfoForWs(-1).m_fontSize.Value);
			Assert.AreEqual("Title", entry.TextType);
			Assert.AreEqual("Paragraph", entry.StyleType);
			Assert.AreEqual("paragraph publishable vernacular level_1 ", entry.TextProperties);
			Assert.AreEqual(4000, entry.SpaceAfter);
			Assert.AreEqual(2000, entry.SpaceBefore);
		}