예제 #1
0
        public void GetDocumentSize()
        {
            TestingRenderer renderer = new TestingRenderer();
            Size            docSize;
            SizeF           maxSize = SizeF.Empty;

            // measuring an empty list returns 0x0

            docSize = renderer.GetDocumentSize(_empty.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize, Is.EqualTo(new Size(0, 0)));

            // measure for a non empty list relies on the longest item
            // in that list

            foreach (ErrorItem item in _filled.Items)
            {
                SizeF sz = renderer.MeasureItem(_gr, item);
                if (sz.Width > maxSize.Width)
                {
                    maxSize = sz;
                }
            }

            docSize = renderer.GetDocumentSize(_filled.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize.Width, Is.EqualTo((int)maxSize.Width));
            int itemHeight = renderer.Font.Height * 4 + 6;

            Assert.That(docSize.Height, Is.EqualTo(_filled.Items.Count * itemHeight));

            return;
        }
예제 #2
0
        public void GetDocumentSize()
        {
            TestingRenderer renderer = new TestingRenderer();
            Size            docSize;
            SizeF           szItem;

            // measuring an empty list returns 0x0

            docSize = renderer.GetDocumentSize(_empty.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize, Is.EqualTo(new Size(0, 0)));

            // measure for a non empty list relies on the longest item
            // in that list

            szItem  = renderer.MeasureItem(_gr, _filled.Items[2]); // the longest item
            docSize = renderer.GetDocumentSize(_filled.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize.Width, Is.EqualTo((int)szItem.Width));
            int itemHeight = renderer.Font.Height * 4 + 6;

            Assert.That(docSize.Height, Is.EqualTo(_filled.Items.Count * itemHeight));

            return;
        }
        public void GetDocumentSize()
        {
            TestingRenderer renderer = new TestingRenderer();
            Size docSize;
            SizeF maxSize = SizeF.Empty;

            // measuring an empty list returns 0x0

            docSize = renderer.GetDocumentSize(_empty.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize, Is.EqualTo(new Size(0, 0)));

            // measure for a non empty list relies on the longest item
            // in that list

            foreach(ErrorItem item in _filled.Items)
            {
                SizeF sz = renderer.MeasureItem(_gr, item);
                if (sz.Width > maxSize.Width)
                    maxSize = sz;
            }

            docSize = renderer.GetDocumentSize(_filled.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize.Width, Is.EqualTo((int)maxSize.Width));
            int itemHeight = renderer.Font.Height * 4 + 6;
            Assert.That(docSize.Height, Is.EqualTo(_filled.Items.Count * itemHeight));

            return;
        }
        public void GetDocumentSize()
        {
            TestingRenderer renderer = new TestingRenderer();
            Size docSize;
            SizeF szItem;

            // measuring an empty list returns 0x0

            docSize = renderer.GetDocumentSize(_empty.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize, Is.EqualTo(new Size(0, 0)));

            // measure for a non empty list relies on the longest item
            // in that list

            szItem = renderer.MeasureItem(_gr, _filled.Items[2]); // the longest item
            docSize = renderer.GetDocumentSize(_filled.Items, _gr);
            Assert.NotNull(docSize);
            Assert.That(docSize.Width, Is.EqualTo((int)szItem.Width));
            int itemHeight = renderer.Font.Height * 4 + 6;
            Assert.That(docSize.Height, Is.EqualTo(_filled.Items.Count * itemHeight));

            return;
        }
예제 #5
0
        public void IsDirty()
        {
            Rectangle       viewport = new Rectangle(0, 0, 200, 200);
            TestingRenderer renderer = new TestingRenderer();

            // no change - true the second time

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.False(renderer.IsDirty(_filled.Items, _filled.Items[0], viewport));

            // changing the list set dirty flag

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.True(renderer.IsDirty(_empty.Items, _filled.Items[0], viewport));

            // changes selected item

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.True(renderer.IsDirty(_filled.Items, null, viewport));
            Assert.True(renderer.IsDirty(_filled.Items,
                                         new ErrorItem(_filled.Items[0].Path,
                                                       _filled.Items[0].FullyQualifiedMethodName,
                                                       _filled.Items[0].LineNumber),
                                         viewport));

            // changes viewport

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.True(renderer.IsDirty(_filled.Items, _filled.Items[0], new Rectangle()));

            // reversing item order set dirty flag

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            _filled.Items.Reverse();
            Assert.True(renderer.IsDirty(_filled.Items, _filled.Items[_filled.Items.Count - 1], viewport));

            // Calling GetDocumentSize set dirty flag

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            renderer.GetDocumentSize(_filled.Items, _gr);
            Assert.True(renderer.IsDirty(_filled.Items, _filled.Items[0], viewport));

            return;
        }
        public void IsDirty()
        {
            Rectangle viewport = new Rectangle(0, 0, 200, 200);
            TestingRenderer renderer = new TestingRenderer();

            // no change - true the second time

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.False(renderer.IsDirty(_filled.Items, _filled.Items[0], viewport));

            // changing the list set dirty flag

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.True(renderer.IsDirty(_empty.Items, _filled.Items[0], viewport));
           
            // changes selected item

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.True(renderer.IsDirty(_filled.Items, null, viewport));
            Assert.True(renderer.IsDirty(_filled.Items,
                new ErrorItem(_filled.Items[0].Path,
                              _filled.Items[0].FullyQualifiedMethodName,
                              _filled.Items[0].LineNumber),
                    viewport));

            // changes viewport

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            Assert.True(renderer.IsDirty(_filled.Items, _filled.Items[0], new Rectangle()));

            // reversing item order set dirty flag

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            _filled.Items.Reverse();
            Assert.True(renderer.IsDirty(_filled.Items, _filled.Items[_filled.Items.Count - 1], viewport));

            // Calling GetDocumentSize set dirty flag

            renderer.DrawToGraphics(_filled.Items, _filled.Items[0], _gr, viewport);
            renderer.GetDocumentSize(_filled.Items, _gr);
            Assert.True(renderer.IsDirty(_filled.Items, _filled.Items[0], viewport));

            return;
        }