Example #1
0
        public void testGetIndex()
        {
            JDFRunList rlp = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r1");

            rlp.setPages(new JDFIntegerRangeList("1 3 5 7"));
            Assert.AreEqual(0, rlp.getFirstIndex(), "first partition starts at 0");
            Assert.AreEqual(3, rlp.getLastIndex());
            rlp.setNPage(3);
            Assert.AreEqual(0, rlp.getFirstIndex());
            Assert.AreEqual(2, rlp.getLastIndex());
            JDFRunList rlp2 = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r2");

            rlp2.setPages(new JDFIntegerRangeList("0 2 4 6"));
            Assert.AreEqual(3, rlp2.getFirstIndex());
            Assert.AreEqual(6, rlp2.getLastIndex());
            rlp2.setNPage(2);
            Assert.AreEqual(3, rlp2.getFirstIndex());
            Assert.AreEqual(4, rlp2.getLastIndex());
            JDFRunList rlp3 = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r3");

            rlp2.setLogicalPage(11);
            rlp3.setPages(new JDFIntegerRangeList("0 2 4 6"));
            Assert.AreEqual(13, rlp3.getFirstIndex());
            Assert.AreEqual(16, rlp3.getLastIndex());
            rlp3.setNPage(2);
            rlp3.setLogicalPage(22);
            Assert.AreEqual(22, rlp3.getFirstIndex());
            Assert.AreEqual(23, rlp3.getLastIndex());
        }
Example #2
0
        public void testSetPages()
        {
            JDFIntegerRangeList integerRangeList = new JDFIntegerRangeList(new JDFIntegerRange(0, -1, 8));

            rl.setPages(integerRangeList);
            Assert.AreEqual(integerRangeList, rl.getPages());
            Assert.AreEqual(8, rl.getNPage());
        }
Example #3
0
        public void testGetIndexPartition()
        {
            JDFRunList rlp = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r1");

            rlp.setPages(new JDFIntegerRangeList("1 3 5 7"));
            Assert.AreEqual(rlp, rl.getIndexPartition(0));
            Assert.AreEqual(rlp, rl.getIndexPartition(3));
            rlp.setNPage(3);
            JDFRunList rlp2 = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r2");

            rlp2.setPages(new JDFIntegerRangeList("0 2 4 6"));
            Assert.AreEqual(rlp2, rl.getIndexPartition(3));
            Assert.AreEqual(rlp2, rl.getIndexPartition(6));
            Assert.IsNull(rl.getIndexPartition(7));
        }
Example #4
0
        public void testGetNPage()
        {
            JDFRunList rlp = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r1");

            rlp.setPages(new JDFIntegerRangeList("1 3 5 7"));
            Assert.AreEqual(4, rlp.getNPage());
            rlp.setNPage(3);
            Assert.AreEqual(3, rlp.getNPage());
            JDFRunList rlp2 = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r2");

            rlp2.setPages(new JDFIntegerRangeList("0 2 4 6"));
            Assert.AreEqual(4, rlp2.getNPage());
            rlp2.setNPage(3);
            Assert.AreEqual(3, rlp2.getNPage());
            Assert.AreEqual(6, rl.getNPage());
        }
Example #5
0
        public void testPageIterator()
        {
            JDFRunList rlp = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r1");

            rlp.setPages(new JDFIntegerRangeList("1 3 5 7"));
            rlp.setNPage(3);
            JDFRunList rlp2 = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r2");

            rlp2.setPages(new JDFIntegerRangeList("0 2 4 6"));
            IEnumerator it = rl.getPageIterator();
            int         n  = 0;

            while (it.MoveNext())
            {
                JDFRunData ri = (JDFRunData)it.Current;
                Assert.AreEqual(ri.getRunIndex(), n);
                Assert.AreEqual(ri.getRunList(), n < 3 ? rlp : rlp2);
                n++;
            }
            Assert.AreEqual(7, n);
        }
Example #6
0
        public void testPageIteratorSpeed()
        {
            int nMax = 3000;

            for (int i = 0; i < nMax; i++)
            {
                JDFRunList rlp = (JDFRunList)rl.addPartition(EnumPartIDKey.Run, "r" + i);
                rlp.setPages(new JDFIntegerRangeList("1 3 5 7"));
                rlp.setFileURL("FileInfo://Test" + i + ".pdf");
            }
            IEnumerator it = rl.getPageIterator();
            int         n  = 0;

            while (it.MoveNext())
            {
                JDFRunData ri = (JDFRunData)it.Current;
                Assert.AreEqual(n, ri.getRunIndex());
                Assert.AreEqual(n % 4, ((ri.getPageInFile() - 1) / 2) % 4);
                n++;
            }
            Assert.AreEqual(n, 4 * nMax);
        }