public void TestSectionPropertiesWithValues() { using (Stream sIn = new FileStream(TESTFILE_DIR + "SectionPropertiesWithValues.xml", FileMode.Open)) { DocXReaderTestWriter writerOut = new DocXReaderTestWriter(null); sectPr_Handler objectConsumer = new sectPr_Handler(null); Helper_ParseFileIntoConsumer(sIn, writerOut, objectConsumer); Assert.IsTrue(objectConsumer.HasNonDocElements(), "sectPr should generate a nondoc element"); Queue<object> nonDocs = objectConsumer.GetNonDocElements(); Assert.AreEqual(1, nonDocs.Count, "sectPr should generate 1 nondoc element"); SectionFormatting sf = nonDocs.Dequeue() as SectionFormatting; Assert.IsNotNull(sf); Assert.AreEqual(0, sf.StyleId, "Style is managed by the context so initially 0"); Assert.AreEqual(42, sf.FCSPageInformation.PaperSizeNumber); Assert.AreEqual(16838, sf.FCSPageInformation.PaperHeight); Assert.AreEqual(11906, sf.FCSPageInformation.PaperWidth); Assert.AreEqual(1440, sf.FCSPageInformation.LeftMargin); Assert.AreEqual(1430, sf.FCSPageInformation.TopMargin); Assert.AreEqual(1420, sf.FCSPageInformation.RightMargin); Assert.AreEqual(1410, sf.FCSPageInformation.BottomMargin); Assert.AreEqual(100, sf.FCSPageInformation.GutterWidth); Assert.IsTrue(sf.FCSPageInformation.RightGutter); Assert.IsTrue(sf.FCSPageInformation.Landscape); Assert.AreEqual(240, sf.LineGridPitch); Assert.AreEqual(120, sf.LineNumberingIndentFromMargin); Assert.AreEqual(3, sf.StartingLineNumber); Assert.AreEqual(1, sf.LineNumberingStep); Assert.IsTrue(sf.LineNumberingRestartType == SectionFormatting.LineNumberingRestartTypes.RestartEachPage); Assert.IsTrue(sf.BreakType == SectionFormatting.SectionBreakTypes.OddPage); Assert.AreEqual(1, sf.FirstPagePrinterBin); Assert.AreEqual(2, sf.PrinterBin); Assert.IsTrue(sf.LineBetweenColumns); Assert.AreEqual(2, sf.ColumnCount); Assert.AreEqual(500, sf.SpaceBetweenColumns); //TODO Not sure what these relate to //property bool UnlockedForForms; // Need handlers for subnodes //property PageNumberingInformation^ PageNumbering; // Direct from sectPr //property FCSPageInformation^ FCSPageInformation; - which has.... //property bool FacingPages; //property bool ParallelGutter; //property bool MirrorMargins; //property int FirstPageNumber; //property bool WidowOrphanControl; //property bool PrintTwoPagesOnOne; //property bool BookFoldPrinting; //CA_SUPPRESS_MESSAGE("Microsoft.Naming", "CA1706:ShortAcronymsShouldBeUppercase", MessageId="Member") //property bool BookFoldPrintingBiDirectional; //property int BookFoldSheets; //property BorderDefinition^ PageBorders; //property bool BorderSurroundsHeader; //property bool BorderSurrondsFooter; //property int BorderArtStyle; //property bool AlignParaBordersAndTablesWithPageBorders; //property PageBorderOptionValues PageBorderOptions; // TODO's //property bool EndNotesAtSectionEnd; //property bool LeftToRightSection; //property bool SnapTextToCharacterGrid; //property int CharacterSpaceBasement; //Character space basement (character pitch minus font size) N in device-independent units (a device-independent unit is 1/294912th of an inch). //property Collection <ColumnDefinition>^ CustomColumns { Collection <ColumnDefinition>^ get(); } //property TextVerticalAlignments TextVerticalAlignment; //property AsianRenderingStyles AsianRendering; //property TextFlowOptions TextFlow; //property CharacterGridOptions CharacterGrid; //property NoteStyleInformation^ FootnoteStyle; //property NoteStyleInformation^ EndnoteStyle; } }
public void TestSectionPropertiesDefault() { using (Stream sIn = new FileStream(TESTFILE_DIR + "SectionPropertiesDefault.xml", FileMode.Open)) { DocXReaderTestWriter writerOut = new DocXReaderTestWriter(null); sectPr_Handler objectConsumer = new sectPr_Handler(null); Helper_ParseFileIntoConsumer(sIn, writerOut, objectConsumer); Assert.IsTrue(objectConsumer.HasNonDocElements(), "sectPr should generate a nondoc element"); Queue<object> nonDocs = objectConsumer.GetNonDocElements(); Assert.AreEqual(1, nonDocs.Count, "sectPr should generate 1 nondoc element"); SectionFormatting sf = nonDocs.Dequeue() as SectionFormatting; Assert.IsNotNull(sf); Assert.IsFalse(sf.FCSPageInformation.RightGutter); } }