Skip to content

Commit e428074

Browse files
committed
Define some failing tests for Rectangle(object) constructors.
1 parent dc9a9c4 commit e428074

1 file changed

Lines changed: 26 additions & 1 deletion

File tree

test/tests/Rectangle.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212

1313
module('Rectangle');
14+
1415
test('new Rectangle(new Point(10, 20), new Size(30, 40));', function() {
1516
var rect = new Rectangle(new Point(10, 20), new Size(30, 40));
1617
equals(rect.toString(), '{ x: 10, y: 20, width: 30, height: 40 }');
@@ -244,4 +245,28 @@ test('include(point)', function() {
244245
test('toString()', function() {
245246
var string = new Rectangle(10, 20, 30, 40).toString();
246247
equals(string, '{ x: 10, y: 20, width: 30, height: 40 }');
247-
});
248+
});
249+
250+
test('new Rectangle(object)', function() {
251+
equals(function() {
252+
return new Rectangle({
253+
center: [50, 100],
254+
size: [100, 200]
255+
}).toString();
256+
}, '{ x: 0, y: 0, width: 100, height: 200 }');
257+
258+
equals(function() {
259+
return new Rectangle({
260+
topLeft: [100, 50],
261+
size: [100, 200]
262+
}).toString();
263+
}, '{ x: 100, y: 50, width: 100, height: 200 }');
264+
265+
equals(function() {
266+
return new Rectangle({
267+
topRight: [200, 50],
268+
size: [100, 200]
269+
}).toString();
270+
}, '{ x: 100, y: -150, width: 100, height: 200 }');
271+
272+
});

0 commit comments

Comments
 (0)