public void LayoutMultipleDescriptions1()
        {
            // 7 descriptions.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(400, 500);
            float boxSize = 10;
            float spacing = 15;
            MockDescription desc1 = new MockDescription("desc1", writer, 8, 17);
            MockDescription desc2 = new MockDescription("desc2", writer, 8, 15);
            MockDescription desc3 = new MockDescription("desc3", writer, 12, 22);
            MockDescription desc4 = new MockDescription("desc4", writer, 12, 24);
            MockDescription desc5 = new MockDescription("desc5", writer, 8, 11);
            MockDescription desc6 = new MockDescription("desc6", writer, 8, 16);
            MockDescription desc7 = new MockDescription("desc7", writer, 8, 8);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            positioner.LayoutMultipleDescriptions(new MockDescription[] { desc1, desc2, desc3, desc4, desc5, desc6, desc7 });
            //Assert.AreEqual(1, positioner.PageCount);
            positioner.DrawPage((IGraphicsTarget)null, 0);
            Assert.AreEqual(
@"@ (0,0) description 'desc4'
@ (0,255) description 'desc3'
@ (135,0) description 'desc1'
@ (135,185) description 'desc6'
@ (135,360) description 'desc5'
@ (230,0) description 'desc2'
@ (230,165) description 'desc7'
", writer.ToString());
        }
        public void LayoutMultipleDescriptions1()
        {
            // 7 descriptions.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(400, 500);
            float boxSize = 10;
            float spacing = 15;
            MockDescription desc1 = new MockDescription("desc1", writer, 8, 17);
            MockDescription desc2 = new MockDescription("desc2", writer, 8, 15);
            MockDescription desc3 = new MockDescription("desc3", writer, 12, 22);
            MockDescription desc4 = new MockDescription("desc4", writer, 12, 24);
            MockDescription desc5 = new MockDescription("desc5", writer, 8, 11);
            MockDescription desc6 = new MockDescription("desc6", writer, 8, 16);
            MockDescription desc7 = new MockDescription("desc7", writer, 8, 8);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            positioner.LayoutMultipleDescriptions(new MockDescription[] { desc1, desc2, desc3, desc4, desc5, desc6, desc7 });
            //Assert.AreEqual(1, positioner.PageCount);
            positioner.DrawPage(null, 0);
            Assert.AreEqual(
            @"@ (0,0) description 'desc4'
            @ (0,255) description 'desc3'
            @ (135,0) description 'desc1'
            @ (135,185) description 'desc6'
            @ (135,360) description 'desc5'
            @ (230,0) description 'desc2'
            @ (230,165) description 'desc7'
            ", 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 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 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 LayoutMultipleDescriptions2()
        {
            // test descriptions breaking across columns.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(400, 250);
            float boxSize = 10;
            float spacing = 15;
            MockDescription desc1 = new MockDescription("desc1", writer, 12, 22);
            MockDescription desc2 = new MockDescription("desc2", writer, 8, 36);
            MockDescription desc3 = new MockDescription("desc3", writer, 8, 6);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            positioner.LayoutMultipleDescriptions(new MockDescription[] { desc1, desc2, desc3 });
            //Assert.AreEqual(1, positioner.PageCount);
            positioner.DrawPage((IGraphicsTarget)null, 0);
            Assert.AreEqual(
@"@ (0,0) description 'desc1'
@ (135,0) partial description 'desc2' [start:0 count:25]
@ (230,0) partial description 'desc2' [start:25 count:11]
@ (230,125) description 'desc3'
", writer.ToString());
        }
        public void LayoutMultipleDescriptions2()
        {
            // test descriptions breaking across columns.
            StringWriter writer = new StringWriter();
            SizeF paperSize = new SizeF(400, 250);
            float boxSize = 10;
            float spacing = 15;
            MockDescription desc1 = new MockDescription("desc1", writer, 12, 22);
            MockDescription desc2 = new MockDescription("desc2", writer, 8, 36);
            MockDescription desc3 = new MockDescription("desc3", writer, 8, 6);
            RectanglePositioner positioner = new RectanglePositioner(paperSize, boxSize, spacing);

            positioner.LayoutMultipleDescriptions(new MockDescription[] { desc1, desc2, desc3 });
            //Assert.AreEqual(1, positioner.PageCount);
            positioner.DrawPage(null, 0);
            Assert.AreEqual(
            @"@ (0,0) description 'desc1'
            @ (135,0) partial description 'desc2' [start:0 count:25]
            @ (230,0) partial description 'desc2' [start:25 count:11]
            @ (230,125) description 'desc3'
            ", writer.ToString());
        }
        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());
        }