Exemplo n.º 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;
        }
        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;
        }
Exemplo n.º 3
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 MeasureItem()
        {
            TestingRenderer renderer = new TestingRenderer();
            SizeF exp;
            SizeF actual;

            ErrorItem itemClass = new ErrorItem("/dir/f.cs", "0123456789012.a()", 3);
            ErrorItem itemMethod = new ErrorItem("/dir/f.cs", "a.0123456789012()", 3);
            ErrorItem itemFile = new ErrorItem("/dir/0123456789012.cs", "a.b()", 3);

            // measure an item whoose width should be determined
            // by class field value

            exp = _gr.MeasureString("0123456789012", renderer.Font);
            actual = renderer.MeasureItem(_gr, itemClass);
            int itemHeight = renderer.Font.Height * 4 + 6;
            
            Assert.That((int)actual.Width, Is.EqualTo((int)exp.Width + 16));
            Assert.That((int)actual.Height, Is.EqualTo(itemHeight));

            // measure an item whoose width should be determined
            // by method field value

            exp = _gr.MeasureString("0123456789012()", renderer.Font);
            actual = renderer.MeasureItem(_gr, itemMethod);
            Assert.That((int)actual.Width, Is.EqualTo((int)exp.Width + 16));
            Assert.That((int)actual.Height, Is.EqualTo(itemHeight));

            // measure an item whoose width should be determined
            // by filename field value

            exp = _gr.MeasureString("0123456789012.cs", renderer.Font);
            actual = renderer.MeasureItem(_gr, itemFile);
            Assert.That((int)actual.Width, Is.EqualTo((int)exp.Width + 16));
            Assert.That((int)actual.Height, Is.EqualTo(itemHeight));

            return;
        }        
Exemplo n.º 5
0
        public void MeasureItem()
        {
            TestingRenderer renderer = new TestingRenderer();
            SizeF           exp;
            SizeF           actual;

            ErrorItem itemClass  = new ErrorItem("/dir/f.cs", "0123456789012.a()", 3);
            ErrorItem itemMethod = new ErrorItem("/dir/f.cs", "a.0123456789012()", 3);
            ErrorItem itemFile   = new ErrorItem("/dir/0123456789012.cs", "a.b()", 3);

            // measure an item whoose width should be determined
            // by class field value

            exp    = _gr.MeasureString("0123456789012", renderer.Font);
            actual = renderer.MeasureItem(_gr, itemClass);
            int itemHeight = renderer.Font.Height * 4 + 6;

            Assert.That((int)actual.Width, Is.EqualTo((int)exp.Width + 16));
            Assert.That((int)actual.Height, Is.EqualTo(itemHeight));

            // measure an item whoose width should be determined
            // by method field value

            exp    = _gr.MeasureString("0123456789012()", renderer.Font);
            actual = renderer.MeasureItem(_gr, itemMethod);
            Assert.That((int)actual.Width, Is.EqualTo((int)exp.Width + 16));
            Assert.That((int)actual.Height, Is.EqualTo(itemHeight));

            // measure an item whoose width should be determined
            // by filename field value

            exp    = _gr.MeasureString("0123456789012.cs", renderer.Font);
            actual = renderer.MeasureItem(_gr, itemFile);
            Assert.That((int)actual.Width, Is.EqualTo((int)exp.Width + 16));
            Assert.That((int)actual.Height, Is.EqualTo(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;
        }