public void LayoutOneDescription5()
        {
            // Large description, split into 2 columns on 1 page.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(300, 100);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", Console.Out, 8, 17);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            int count = positioner.LayoutOneDescriptionPage(description);
            Assert.AreEqual(1, positioner.PageCount);
            Assert.AreEqual(1, count);
            positioner.DrawPage((IGraphicsTarget)null, 0);
            Assert.AreEqual(
@"", writer.ToString());
        }
        public void PageTooSmall()
        {
            // Large description, split into 2 columns on 1 page.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(75, 100);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", Console.Out, 8, 17);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            try {
                int count = positioner.LayoutOneDescriptionPage(description);
                Assert.Fail("shouldn't get here");
            }
            catch (Exception e) {
                Assert.AreEqual(MiscText.PageTooSmall, e.Message);
            }
        }
        public void LayoutOneDescription2()
        {
            // Simple description, fits 3 times across and exactly 1 times down.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(300, 170);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", writer, 8, 17);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            int count = positioner.LayoutOneDescriptionPage(description);
            Assert.AreEqual(1, positioner.PageCount);
            Assert.AreEqual(3, count);
            positioner.DrawPage((IGraphicsTarget)null, 0);
            Assert.AreEqual(
@"@ (0,0) description 'desc1'
@ (95,0) description 'desc1'
@ (190,0) description 'desc1'
", writer.ToString());
        }
        public void LayoutOneDescription4()
        {
            // Large description, split into 5 columns on 2 pages.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(300, 100);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", writer, 8, 46);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            int count = positioner.LayoutOneDescriptionPage(description);
            Assert.AreEqual(2, positioner.PageCount);
            Assert.AreEqual(1, count);
            positioner.DrawPage((IGraphicsTarget)null, 0);
            positioner.DrawPage((IGraphicsTarget)null, 1);
            Assert.AreEqual(
@"@ (0,0) partial description 'desc1' [start:0 count:10]
@ (95,0) partial description 'desc1' [start:10 count:10]
@ (190,0) partial description 'desc1' [start:20 count:10]
@ (0,0) partial description 'desc1' [start:30 count:10]
@ (95,0) partial description 'desc1' [start:40 count:6]
", writer.ToString());
        }
        public void PageTooSmall()
        {
            // Large description, split into 2 columns on 1 page.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(75, 100);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", Console.Out, 8, 17);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            try {
                int count = positioner.LayoutOneDescriptionPage(description);
                Assert.Fail("shouldn't get here");
            }
            catch (Exception e) {
                Assert.AreEqual(MiscText.PageTooSmall, e.Message);
            }
        }
        public void LayoutOneDescription5()
        {
            // Large description, split into 2 columns on 1 page.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(300, 100);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", Console.Out, 8, 17);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            int count = positioner.LayoutOneDescriptionPage(description);
            Assert.AreEqual(1, positioner.PageCount);
            Assert.AreEqual(1, count);
            positioner.DrawPage(null, 0);
            Assert.AreEqual(
            @"", writer.ToString());
        }
        public void LayoutOneDescription4()
        {
            // Large description, split into 5 columns on 2 pages.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(300, 100);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", writer, 8, 46);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            int count = positioner.LayoutOneDescriptionPage(description);
            Assert.AreEqual(2, positioner.PageCount);
            Assert.AreEqual(1, count);
            positioner.DrawPage(null, 0);
            positioner.DrawPage(null, 1);
            Assert.AreEqual(
            @"@ (0,0) partial description 'desc1' [start:0 count:10]
            @ (95,0) partial description 'desc1' [start:10 count:10]
            @ (190,0) partial description 'desc1' [start:20 count:10]
            @ (0,0) partial description 'desc1' [start:30 count:10]
            @ (95,0) partial description 'desc1' [start:40 count:6]
            ", writer.ToString());
        }
        public void LayoutOneDescription3()
        {
            // Simple description, fits 1 times across and 4 times down.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(90, 730);
            float boxSize = 10;
            float spacing = 15;
            MockDescription description = new MockDescription("desc1", writer, 8, 17);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            int count = positioner.LayoutOneDescriptionPage(description);
            Assert.AreEqual(1, positioner.PageCount);
            Assert.AreEqual(4, count);
            positioner.DrawPage(null, 0);
            Assert.AreEqual(
            @"@ (0,0) description 'desc1'
            @ (0,185) description 'desc1'
            @ (0,370) description 'desc1'
            @ (0,555) description 'desc1'
            ", writer.ToString());
        }