mono/xwt — Issue #24: Xwt.Rectangle: refactor to pass System.Drawing.RectangleF-Tests
Author: lytico
Created: 2012-02-29 23:30:07+00:00
State: open

Xwt.Rectangle has a lot of "errors", that is different behaviour compared with System.Drawing.RectangleF.
I guess most people are using System.Drawing.RectangleF or System.Drawing.Rectangle so it would be nice to have the same behaviours.

Is it ok to change Xwt.Rectangle to pass all tests? As far as I can see now the "errors" are in methods that noone uses so far,
as: Right, Bottom, FromLRTB, Union, Intersect, Contains, Inflate

I refactored
https://github.com/mono/mono/blob/master/mcs/class/System.Drawing/Test/System.Drawing/TestRectangleF.cs
to work with Xwt.Rectangle.

the results:

Test 'Xwt.Test.TestRectangle.Contains' failed:
f
Expected: True
But was: False
Playground\View\TestRectangle.cs(66,0): at Xwt.Test.TestRectangle.Contains()

Test 'Xwt.Test.TestRectangle.EdgeIntersection' failed:
Empty
Expected: True
But was: False
Playground\View\TestRectangle.cs(230,0): at Xwt.Test.TestRectangle.EdgeIntersection()

Test 'Xwt.Test.TestRectangle.GetContents' failed:
Right
Expected: 34.0d
But was: 35.0d
Playground\View\TestRectangle.cs(89,0): at Xwt.Test.TestRectangle.GetContents()

Test 'Xwt.Test.TestRectangle.Inflate' failed:
INF#1
Expected: 2,5/56x50
But was: 10,10/40x40
Playground\View\TestRectangle.cs(137,0): at Xwt.Test.TestRectangle.Inflate()

Test 'Xwt.Test.TestRectangle.Intersect' failed:
INT#3
Expected: 40,40/10x10
But was: 10,10/40x40
Playground\View\TestRectangle.cs(151,0): at Xwt.Test.TestRectangle.Intersect()

Test 'Xwt.Test.TestRectangle.IsEmpty' failed:
negative w/h
Expected: True
But was: False
Playground\View\TestRectangle.cs(84,0): at Xwt.Test.TestRectangle.IsEmpty()

Test 'Xwt.Test.TestRectangle.Offset' failed:
OFS#1
Expected: 15,15/40x40
But was: 10,10/40x40
Playground\View\TestRectangle.cs(158,0): at Xwt.Test.TestRectangle.Offset()

Test 'Xwt.Test.TestRectangle.ToStringTest' failed:
0
Expected string length 30 but was 11. Strings differ at index 0.
Expected: "{X=10,Y=10,Width=40,Height=40}"
But was: "10,10/40x40"
-----------^
Playground\View\TestRectangle.cs(165,0): at Xwt.Test.TestRectangle.ToStringTest()

Test 'Xwt.Test.TestRectangle.Union' failed:
Expected: 5,5/46x46
But was: 5,5/45x45
Playground\View\TestRectangle.cs(180,0): at Xwt.Test.TestRectangle.Union()

10 passed, 9 failed, 0 skipped, took 5,62 seconds (NUnit 2.5.5).