1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#include <QtTest/QtTest>
30#include <qrect.h>
31#include <qmargins.h>
32#include <limits.h>
33#include <qdebug.h>
34
35
36class tst_QRect : public QObject
37{
38 Q_OBJECT
39public:
40 enum QRectCases {
41 InvalidQRect, SmallestQRect, MiddleQRect, LargestQRect, SmallestCoordQRect,
42 LargestCoordQRect, RandomQRect, NegativeSizeQRect, NegativePointQRect, NullQRect, EmptyQRect,
43 MiddleCoordQRect = MiddleQRect
44 };
45
46 enum IntCases {
47 MinimumInt, MiddleNegativeInt, ZeroInt, MiddlePositiveInt, MaximumInt, RandomInt
48 };
49
50 enum QPointCases {
51 NullQPoint, SmallestCoordQPoint, MiddleNegCoordQPoint, MiddlePosCoordQPoint, LargestCoordQPoint, NegativeQPoint,
52 NegXQPoint, NegYQPoint, RandomQPoint
53 };
54
55 static QRect getQRectCase( QRectCases c );
56 static int getIntCase( IntCases i );
57 static QPoint getQPointCase( QPointCases p );
58
59private slots:
60 void isNull_data();
61 void isNull();
62 void newIsEmpty_data();
63 void newIsEmpty();
64 void newIsValid_data();
65 void newIsValid();
66 void normalized_data();
67 void normalized();
68 void left_data();
69 void left();
70 void top_data();
71 void top();
72 void right_data();
73 void right();
74 void bottom_data();
75 void bottom();
76 void x_data();
77 void x();
78 void y_data();
79 void y();
80 void setWidthHeight_data();
81 void setWidthHeight();
82 void setLeft_data();
83 void setLeft();
84 void setTop_data();
85 void setTop();
86 void setRight_data();
87 void setRight();
88 void setBottom_data();
89 void setBottom();
90 void newSetTopLeft_data();
91 void newSetTopLeft();
92 void newSetBottomRight_data();
93 void newSetBottomRight();
94 void newSetTopRight_data();
95 void newSetTopRight();
96 void newSetBottomLeft_data();
97 void newSetBottomLeft();
98 void topLeft_data();
99 void topLeft();
100 void bottomRight_data();
101 void bottomRight();
102 void topRight_data();
103 void topRight();
104 void bottomLeft_data();
105 void bottomLeft();
106 void center_data();
107 void center();
108 void getRect_data();
109 void getRect();
110 void getCoords_data();
111 void getCoords();
112 void newMoveLeft_data();
113 void newMoveLeft();
114 void newMoveTop_data();
115 void newMoveTop();
116 void newMoveRight_data();
117 void newMoveRight();
118 void newMoveBottom_data();
119 void newMoveBottom();
120 void newMoveTopLeft_data();
121 void newMoveTopLeft();
122 void newMoveBottomRight_data();
123 void newMoveBottomRight();
124 void margins();
125 void marginsf();
126
127 void translate_data();
128 void translate();
129
130 void transposed_data();
131 void transposed();
132
133 void moveTop();
134 void moveBottom();
135 void moveLeft();
136 void moveRight();
137 void moveTopLeft();
138 void moveTopRight();
139 void moveBottomLeft();
140 void moveBottomRight();
141 void setTopLeft();
142 void setTopRight();
143 void setBottomLeft();
144 void setBottomRight();
145 void operator_amp();
146 void operator_amp_eq();
147 void isEmpty();
148 void isValid();
149
150 void testAdjust_data();
151 void testAdjust();
152
153 void intersectedRect_data();
154 void intersectedRect();
155 void intersectedRectF_data();
156 void intersectedRectF();
157 void unitedRect_data();
158 void unitedRect();
159 void unitedRectF_data();
160 void unitedRectF();
161 void intersectsRect_data();
162 void intersectsRect();
163 void intersectsRectF_data();
164 void intersectsRectF();
165 void containsRect_data();
166 void containsRect();
167 void containsRectF_data();
168 void containsRectF();
169 void containsPoint_data();
170 void containsPoint();
171 void containsPointF_data();
172 void containsPointF();
173 void smallRects() const;
174 void toRect();
175};
176
177// Used to work around some floating point precision problems.
178#define LARGE 1000000000
179static bool isLarge(int x) { return x > LARGE || x < -LARGE; }
180
181QRect tst_QRect::getQRectCase( QRectCases c )
182{
183 // Should return the best variety of possible QRects, if a
184 // case is missing, please add it.
185
186 switch ( c ) {
187 case InvalidQRect:
188 return QRect();
189 case SmallestQRect:
190 return QRect( 1, 1, 1, 1 );
191 case MiddleQRect:
192 return QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ) );
193 case LargestQRect:
194 return QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
195 case SmallestCoordQRect:
196 return QRect( QPoint( INT_MIN, INT_MIN ), QSize( 1, 1 ) );
197 case LargestCoordQRect:
198 return QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
199 case RandomQRect:
200 return QRect( 100, 200, 11, 16 );
201 case NegativeSizeQRect:
202 return QRect( 1, 1, -10, -10 );
203 case NegativePointQRect:
204 return QRect( -10, -10, 5, 5 );
205 case NullQRect:
206 return QRect( 5, 5, 0, 0 );
207 case EmptyQRect:
208 return QRect( QPoint( 2, 2 ), QPoint( 1, 1 ) );
209 default:
210 return QRect();
211 }
212}
213
214int tst_QRect::getIntCase( IntCases i )
215{
216 // Should return the best variety of possible ints, if a
217 // case is missing, please add it.
218
219 switch ( i ) {
220 case MinimumInt:
221 return INT_MIN;
222 case MiddleNegativeInt:
223 return INT_MIN / 2;
224 case ZeroInt:
225 return 0;
226 case MiddlePositiveInt:
227 return INT_MAX / 2;
228 case MaximumInt:
229 return INT_MAX;
230 case RandomInt:
231 return 4953;
232 default:
233 return 0;
234 }
235}
236
237QPoint tst_QRect::getQPointCase( QPointCases p )
238{
239 // Should return the best variety of possible QPoints, if a
240 // case is missing, please add it.
241 switch ( p ) {
242 case NullQPoint:
243 return QPoint();
244 case SmallestCoordQPoint:
245 return QPoint(INT_MIN,INT_MIN);
246 case MiddleNegCoordQPoint:
247 return QPoint(INT_MIN/2,INT_MIN/2);
248 case MiddlePosCoordQPoint:
249 return QPoint(INT_MAX/2,INT_MAX/2);
250 case LargestCoordQPoint:
251 return QPoint(INT_MAX,INT_MAX);
252 case NegXQPoint:
253 return QPoint(-12,7);
254 case NegYQPoint:
255 return QPoint(12,-7);
256 case RandomQPoint:
257 return QPoint(12,7);
258 default:
259 return QPoint();
260 }
261}
262
263void tst_QRect::isNull_data()
264{
265 QTest::addColumn<QRect>(name: "r");
266 QTest::addColumn<bool>(name: "isNull");
267
268 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << true;
269 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << false;
270 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << false;
271 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << false;
272 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << false;
273 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << true; // Due to overflow
274 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << false;
275 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << false;
276 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << false;
277 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << true;
278 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << true;
279}
280
281void tst_QRect::isNull()
282{
283 QFETCH( QRect, r );
284 QFETCH( bool, isNull );
285
286 QRectF rf(r);
287
288 QVERIFY( r.isNull() == isNull );
289 QVERIFY( rf.isNull() == isNull );
290}
291
292void tst_QRect::newIsEmpty_data()
293{
294 QTest::addColumn<QRect>(name: "r");
295 QTest::addColumn<bool>(name: "isEmpty");
296
297 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << true;
298 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << false;
299 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << false;
300 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << false;
301 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << false;
302 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << false;
303 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << false;
304 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << true;
305 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << false;
306 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << true;
307 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << true;
308}
309
310void tst_QRect::newIsEmpty()
311{
312 // A new test is written so the old one isn't removed
313 QFETCH( QRect, r );
314 QFETCH( bool, isEmpty );
315
316 QRectF rf(r);
317
318 QVERIFY( r.isEmpty() == isEmpty );
319
320 if (isLarge(x: r.x()) || isLarge(x: r.y()) || isLarge(x: r.width()) || isLarge(x: r.height()))
321 return;
322 QVERIFY( rf.isEmpty() == isEmpty );
323}
324
325void tst_QRect::newIsValid_data()
326{
327 QTest::addColumn<QRect>(name: "r");
328 QTest::addColumn<bool>(name: "isValid");
329
330 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << false;
331 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << true;
332 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << true;
333 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << true;
334 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << true;
335 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << true;
336 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << true;
337 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << false;
338 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << true;
339 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << false;
340 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << false;
341}
342
343void tst_QRect::newIsValid()
344{
345 // A new test is written so the old one isn't removed
346 QFETCH( QRect, r );
347 QFETCH( bool, isValid );
348
349 QRectF rf(r);
350
351 QVERIFY( r.isValid() == isValid );
352
353 if (isLarge(x: r.x()) || isLarge(x: r.y()) || isLarge(x: r.width()) || isLarge(x: r.height()))
354 return;
355
356 QVERIFY( rf.isValid() == isValid );
357}
358
359void tst_QRect::normalized_data()
360{
361 QTest::addColumn<QRect>(name: "r");
362 QTest::addColumn<QRect>(name: "nr");
363
364 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << getQRectCase( c: InvalidQRect );
365 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << QRect( 1, 1, 1, 1 );
366 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect )
367 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ) );
368 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect )
369 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
370 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect )
371 << QRect( QPoint( INT_MIN, INT_MIN ), QSize( 1, 1 ) );
372 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect )
373 << getQRectCase( c: LargestCoordQRect ); // overflow
374 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << QRect( 100, 200, 11, 16 );
375 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << QRect(QPoint(-10,-10),QPoint(1,1));
376 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << QRect( -10, -10, 5, 5 );
377 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << getQRectCase( c: NullQRect );
378 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << getQRectCase( c: EmptyQRect );
379 QTest::newRow( dataTag: "ZeroWidth" ) << QRect(100, 200, 100, 0) << QRect(100, 200, 100, 0);
380 // Since "NegativeSizeQRect passes, I expect both of these to pass too.
381 // This passes, since height() returns -1 before normalization
382 QTest::newRow( dataTag: "NegativeHeight") << QRect(QPoint(100,201), QPoint(199,199)) << QRect(QPoint(100,199), QPoint(199,201));
383 // This, on the other hand height() returns 0 before normalization.
384 QTest::newRow( dataTag: "ZeroHeight1" ) << QRect(QPoint(100,200), QPoint(199,199)) << QRect(QPoint(100,199), QPoint(199,200));
385 QTest::newRow( dataTag: "ZeroHeight2" ) << QRect(QPoint(263,113), QPoint(136,112)) << QRect(QPoint(136,113), QPoint(263,112));
386}
387
388void tst_QRect::normalized()
389{
390 QFETCH(QRect, r);
391 QFETCH(QRect, nr);
392
393 QEXPECT_FAIL("ZeroHeight1", "due to broken QRect definition (not possible to change, see QTBUG-22934)", Continue);
394 QCOMPARE(r.normalized(), nr);
395}
396
397void tst_QRect::left_data()
398{
399 QTest::addColumn<QRect>(name: "r");
400 QTest::addColumn<int>(name: "left");
401
402 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << 0;
403 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1;
404 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << int(INT_MIN) / 2;
405 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << 0;
406 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN);
407 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << int(INT_MIN);
408 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 100;
409 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << 1;
410 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -10;
411 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << 5;
412 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 2;
413}
414
415void tst_QRect::left()
416{
417 QFETCH( QRect, r );
418 QFETCH( int, left );
419
420 QRectF rf(r);
421
422 QCOMPARE( r.left(), left );
423 QCOMPARE(QRectF(rf).left(), qreal(left));
424}
425
426void tst_QRect::top_data()
427{
428 QTest::addColumn<QRect>(name: "r");
429 QTest::addColumn<int>(name: "top");
430
431 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << 0;
432 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1;
433 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << int(INT_MIN) / 2;
434 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << 0;
435 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN);
436 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << int(INT_MIN);
437 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 200;
438 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << 1;
439 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -10;
440 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << 5;
441 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 2;
442}
443
444void tst_QRect::top()
445{
446 QFETCH( QRect, r );
447 QFETCH( int, top );
448
449 QCOMPARE( r.top(), top );
450 QCOMPARE(QRectF(r).top(), qreal(top));
451}
452
453void tst_QRect::right_data()
454{
455 // We don't test the NullQRect case as the return value is undefined.
456
457 QTest::addColumn<QRect>(name: "r");
458 QTest::addColumn<int>(name: "right");
459
460 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << -1;
461 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1;
462 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << int(INT_MAX / 2);
463 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << int(INT_MAX) - 1;
464 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN);
465 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << int(INT_MAX);
466 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 110;
467 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << -10;
468 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -6;
469 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 1;
470}
471
472void tst_QRect::right()
473{
474 QFETCH( QRect, r );
475 QFETCH( int, right );
476
477 QCOMPARE( r.right(), right );
478
479 if (isLarge(x: r.width()))
480 return;
481 QCOMPARE(QRectF(r).right(), qreal(right+1));
482}
483
484void tst_QRect::bottom_data()
485{
486 // We don't test the NullQRect case as the return value is undefined.
487
488 QTest::addColumn<QRect>(name: "r");
489 QTest::addColumn<int>(name: "bottom");
490
491 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << -1;
492 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1;
493 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << int(INT_MAX / 2);
494 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << int(INT_MAX - 1);
495 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN);
496 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << int(INT_MAX);
497 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 215;
498 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << -10;
499 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -6;
500 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 1;
501}
502
503
504void tst_QRect::bottom()
505{
506 QFETCH( QRect, r );
507 QFETCH( int, bottom );
508
509 QCOMPARE( r.bottom(), bottom );
510
511 if (isLarge(x: r.height()))
512 return;
513 QCOMPARE(QRectF(r).bottom(), qreal(bottom + 1));
514}
515
516void tst_QRect::x_data()
517{
518 QTest::addColumn<QRect>(name: "r");
519 QTest::addColumn<int>(name: "x");
520
521 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << 0;
522 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1;
523 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << int(INT_MIN / 2);
524 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << 0;
525 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN);
526 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << int(INT_MIN);
527 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 100;
528 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << 1;
529 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -10;
530 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << 5;
531 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 2;
532
533}
534
535void tst_QRect::x()
536{
537 QFETCH( QRect, r );
538 QFETCH( int, x );
539
540 QCOMPARE( r.x(), x );
541 QCOMPARE(QRectF(r).x(), qreal(x));
542}
543
544void tst_QRect::y_data()
545{
546 QTest::addColumn<QRect>(name: "r");
547 QTest::addColumn<int>(name: "y");
548
549 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << 0;
550 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1;
551 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << int(INT_MIN / 2);
552 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << 0;
553 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN);
554 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << int(INT_MIN);
555 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 200;
556 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << 1;
557 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -10;
558 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << 5;
559 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 2;
560}
561
562void tst_QRect::y()
563{
564 QFETCH( QRect, r );
565 QFETCH( int, y );
566
567 QCOMPARE( r.y(), y );
568 QCOMPARE(QRectF(r).y(), qreal(y));
569}
570
571void tst_QRect::setWidthHeight_data()
572{
573 QTest::addColumn<int>(name: "w");
574 QTest::addColumn<int>(name: "h");
575
576 QTest::newRow(dataTag: "10x20") << 10 << 20;
577 QTest::newRow(dataTag: "-1x-1") << -1 << -1;
578 QTest::newRow(dataTag: "0x0") << 0 << 0;
579 QTest::newRow(dataTag: "-10x-100") << -10 << -100;
580}
581
582void tst_QRect::setWidthHeight()
583{
584 QFETCH(int, w);
585 QFETCH(int, h);
586
587 QRect r;
588 r.setWidth(w);
589 r.setHeight(h);
590
591 QCOMPARE(r.width(), w);
592 QCOMPARE(r.height(), h);
593
594 QRectF rf;
595 rf.setWidth(w);
596 rf.setHeight(h);
597 QCOMPARE(rf.width(), qreal(w));
598 QCOMPARE(rf.height(), qreal(h));
599}
600
601
602void tst_QRect::setLeft_data()
603{
604 QTest::addColumn<QRect>(name: "r");
605 QTest::addColumn<int>(name: "left");
606 QTest::addColumn<QRect>(name: "nr");
607
608 {
609 QTest::newRow( dataTag: "InvalidQRect_MinimumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MinimumInt )
610 << QRect( QPoint(INT_MIN,0), QPoint(-1,-1) );
611 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
612 << QRect( QPoint(INT_MIN/2,0), QPoint(-1,-1) );
613 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
614 << QRect( QPoint(0,0), QPoint(-1,-1) );
615 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
616 << QRect( QPoint(INT_MAX/2,0), QPoint(-1,-1) );
617 QTest::newRow( dataTag: "InvalidQRect_MaximumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MaximumInt )
618 << QRect( QPoint(INT_MAX,0), QPoint(-1,-1) );
619 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
620 << QRect( QPoint(4953,0), QPoint(-1,-1) );
621 }
622
623 {
624 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
625 << QRect( QPoint(INT_MIN,1), QPoint(1,1) );
626 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
627 << QRect( QPoint(INT_MIN/2,1), QPoint(1,1) );
628 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
629 << QRect( QPoint(0,1), QPoint(1,1) );
630 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
631 << QRect( QPoint(INT_MAX/2,1), QPoint(1,1) );
632 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
633 << QRect( QPoint(INT_MAX,1), QPoint(1,1) );
634 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
635 << QRect( QPoint(4953,1), QPoint(1,1) );
636 }
637
638 {
639 QTest::newRow( dataTag: "MiddleQRect_MinimumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MinimumInt )
640 << QRect( QPoint(INT_MIN, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ) );
641 QTest::newRow( dataTag: "MiddleQRect_MiddleNegativeInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddleNegativeInt )
642 << QRect( QPoint(INT_MIN/2, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ) );
643 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
644 << QRect( QPoint(0, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ));
645 QTest::newRow( dataTag: "MiddleQRect_MiddlePositiveInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddlePositiveInt )
646 << QRect( QPoint(INT_MAX/2, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ));
647 QTest::newRow( dataTag: "MiddleQRect_MaximumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MaximumInt )
648 << QRect( QPoint(INT_MAX, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ));
649 QTest::newRow( dataTag: "MiddleQRect_RandomInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: RandomInt )
650 << QRect( QPoint(4953, INT_MIN / 2 ), QPoint( INT_MAX / 2, INT_MAX / 2 ));
651 }
652
653 {
654 QTest::newRow( dataTag: "LargestQRect_MinimumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MinimumInt )
655 << QRect( QPoint(INT_MIN, 0), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
656 QTest::newRow( dataTag: "LargestQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddleNegativeInt )
657 << QRect( QPoint(INT_MIN/2, 0), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
658 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
659 << QRect( QPoint(0, 0), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
660 QTest::newRow( dataTag: "LargestQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddlePositiveInt )
661 << QRect( QPoint(INT_MAX/2, 0), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
662 QTest::newRow( dataTag: "LargestQRect_MaximumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MaximumInt )
663 << QRect( QPoint(INT_MAX, 0), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
664 QTest::newRow( dataTag: "LargestQRect_RandomInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: RandomInt )
665 << QRect( QPoint(4953, 0), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
666 }
667
668 {
669 QTest::newRow( dataTag: "SmallestCoordQRect_MinimumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MinimumInt )
670 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
671 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
672 << QRect( QPoint( INT_MIN/2, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
673 QTest::newRow( dataTag: "SmallestCoordQRect_ZeroInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: ZeroInt )
674 << QRect( QPoint( 0, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
675 QTest::newRow( dataTag: "SmallestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
676 << QRect( QPoint( INT_MAX/2, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
677 QTest::newRow( dataTag: "SmallestCoordQRect_MaximumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MaximumInt )
678 << QRect( QPoint( INT_MAX, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
679 QTest::newRow( dataTag: "SmallestCoordQRect_RandomInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: RandomInt )
680 << QRect( QPoint( 4953, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
681 }
682
683 {
684 QTest::newRow( dataTag: "LargestCoordQRect_MinimumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MinimumInt )
685 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
686 QTest::newRow( dataTag: "LargestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
687 << QRect( QPoint( INT_MIN/2, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
688 QTest::newRow( dataTag: "LargestCoordQRect_ZeroInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: ZeroInt )
689 << QRect( QPoint( 0, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
690 QTest::newRow( dataTag: "LargestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
691 << QRect( QPoint( INT_MAX/2, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
692 QTest::newRow( dataTag: "LargestCoordQRect_MaximumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MaximumInt )
693 << QRect( QPoint( INT_MAX, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
694 QTest::newRow( dataTag: "LargestCoordQRect_RandomInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: RandomInt )
695 << QRect( QPoint( 4953, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
696 }
697
698 {
699 QTest::newRow( dataTag: "RandomQRect_MinimumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MinimumInt )
700 << QRect( QPoint( INT_MIN, 200 ), QPoint( 110, 215 ) );
701 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
702 << QRect( QPoint( INT_MIN/2, 200 ), QPoint( 110, 215 ) );
703 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
704 << QRect( QPoint( 0, 200 ), QPoint( 110, 215 ) );
705 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
706 << QRect( QPoint( INT_MAX/2, 200 ), QPoint( 110, 215 ) );
707 QTest::newRow( dataTag: "RandomQRect_MaximumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MaximumInt )
708 << QRect( QPoint( INT_MAX, 200 ), QPoint( 110, 215 ) );
709 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
710 << QRect( QPoint( 4953, 200 ), QPoint( 110, 215 ) );
711 }
712
713 {
714 QTest::newRow( dataTag: "NegativeSizeQRect_MinimumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MinimumInt )
715 << QRect( QPoint( INT_MIN, 1 ), QPoint( -10, -10 ) );
716 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
717 << QRect( QPoint( INT_MIN/2, 1 ), QPoint( -10, -10 ) );
718 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
719 << QRect( QPoint( 0, 1 ), QPoint( -10, -10 ) );
720 QTest::newRow( dataTag: "NegativeSizeQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddlePositiveInt )
721 << QRect( QPoint( INT_MAX/2, 1 ), QPoint( -10, -10 ) );
722 QTest::newRow( dataTag: "NegativeSizeQRect_MaximumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MaximumInt )
723 << QRect( QPoint( INT_MAX, 1 ), QPoint( -10, -10 ) );
724 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
725 << QRect( QPoint( 4953, 1 ), QPoint( -10, -10 ) );
726 }
727
728 {
729 QTest::newRow( dataTag: "NegativePointQRect_MinimumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MinimumInt )
730 << QRect( QPoint( INT_MIN, -10 ), QPoint( -6, -6 ) );
731 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
732 << QRect( QPoint( INT_MIN/2, -10 ), QPoint( -6, -6 ) );
733 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
734 << QRect( QPoint( 0, -10 ), QPoint( -6, -6 ) );
735 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
736 << QRect( QPoint( INT_MAX/2, -10 ), QPoint( -6, -6 ) );
737 QTest::newRow( dataTag: "NegativePointQRect_MaximumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MaximumInt )
738 << QRect( QPoint( INT_MAX, -10 ), QPoint( -6, -6 ) );
739 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
740 << QRect( QPoint( 4953, -10 ), QPoint( -6, -6 ) );
741 }
742
743 {
744 QTest::newRow( dataTag: "NullQRect_MinimumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MinimumInt )
745 << QRect( QPoint( INT_MIN, 5 ), QPoint( 4, 4 ) );
746 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
747 << QRect( QPoint( INT_MIN/2, 5 ), QPoint( 4, 4 ) );
748 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
749 << QRect( QPoint( 0, 5 ), QPoint( 4, 4 ) );
750 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
751 << QRect( QPoint( INT_MAX/2, 5), QPoint( 4, 4 ) );
752 QTest::newRow( dataTag: "NullQRect_MaximumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MaximumInt )
753 << QRect( QPoint( INT_MAX, 5 ), QPoint( 4, 4 ) );
754 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
755 << QRect( QPoint( 4953, 5 ), QPoint( 4, 4 ) );
756 }
757
758 {
759 QTest::newRow( dataTag: "EmptyQRect_MinimumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MinimumInt )
760 << QRect( QPoint( INT_MIN, 2 ), QPoint( 1, 1 ) );
761 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
762 << QRect( QPoint( INT_MIN/2, 2 ), QPoint( 1, 1 ) );
763 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
764 << QRect( QPoint( 0, 2 ), QPoint( 1, 1 ) );
765 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
766 << QRect( QPoint( INT_MAX/2, 2 ), QPoint( 1, 1 ) );
767 QTest::newRow( dataTag: "EmptyQRect_MaximumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MaximumInt )
768 << QRect( QPoint( INT_MAX, 2 ), QPoint( 1, 1 ) );
769 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
770 << QRect( QPoint( 4953, 2 ), QPoint( 1, 1 ) );
771 }
772}
773
774void tst_QRect::setLeft()
775{
776 QFETCH( QRect, r );
777 QFETCH( int, left );
778 QFETCH( QRect, nr );
779
780 QRectF rf(r);
781 QRectF nrf(nr);
782
783 r.setLeft( left );
784
785 QCOMPARE( r, nr );
786
787 rf.setLeft(left);
788}
789
790void tst_QRect::setTop_data()
791{
792 QTest::addColumn<QRect>(name: "r");
793 QTest::addColumn<int>(name: "top");
794 QTest::addColumn<QRect>(name: "nr");
795
796 {
797 QTest::newRow( dataTag: "InvalidQRect_MinimumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MinimumInt )
798 << QRect( QPoint(0,INT_MIN), QPoint(-1,-1) );
799 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
800 << QRect( QPoint(0,INT_MIN/2), QPoint(-1,-1) );
801 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
802 << QRect( QPoint(0,0), QPoint(-1,-1) );
803 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
804 << QRect( QPoint(0,INT_MAX/2), QPoint(-1,-1) );
805 QTest::newRow( dataTag: "InvalidQRect_MaximumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MaximumInt )
806 << QRect( QPoint(0,INT_MAX), QPoint(-1,-1) );
807 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
808 << QRect( QPoint(0,4953), QPoint(-1,-1) );
809 }
810
811 {
812 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
813 << QRect( QPoint(1,INT_MIN), QPoint(1,1) );
814 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
815 << QRect( QPoint(1,INT_MIN/2), QPoint(1,1) );
816 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
817 << QRect( QPoint(1,0), QPoint(1,1) );
818 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
819 << QRect( QPoint(1,INT_MAX/2), QPoint(1,1) );
820 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
821 << QRect( QPoint(1,INT_MAX), QPoint(1,1) );
822 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
823 << QRect( QPoint(1,4953), QPoint(1,1) );
824 }
825
826 {
827 QTest::newRow( dataTag: "MiddleQRect_MinimumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MinimumInt )
828 << QRect( QPoint(INT_MIN/2,INT_MIN), QPoint( INT_MAX / 2, INT_MAX / 2 ) );
829 QTest::newRow( dataTag: "MiddleQRect_MiddleNegativeInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddleNegativeInt )
830 << QRect( QPoint(INT_MIN/2,INT_MIN/2), QPoint( INT_MAX / 2, INT_MAX / 2 ) );
831 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
832 << QRect( QPoint(INT_MIN/2,0), QPoint( INT_MAX / 2, INT_MAX / 2 ));
833 QTest::newRow( dataTag: "MiddleQRect_MiddlePositiveInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddlePositiveInt )
834 << QRect( QPoint(INT_MIN/2,INT_MAX/2), QPoint( INT_MAX / 2, INT_MAX / 2 ));
835 QTest::newRow( dataTag: "MiddleQRect_MaximumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MaximumInt )
836 << QRect( QPoint(INT_MIN/2,INT_MAX), QPoint( INT_MAX / 2, INT_MAX / 2 ));
837 QTest::newRow( dataTag: "MiddleQRect_RandomInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: RandomInt )
838 << QRect( QPoint(INT_MIN/2,4953), QPoint( INT_MAX / 2, INT_MAX / 2 ));
839 }
840
841 {
842 QTest::newRow( dataTag: "LargestQRect_MinimumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MinimumInt )
843 << QRect( QPoint(0,INT_MIN), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
844 QTest::newRow( dataTag: "LargestQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddleNegativeInt )
845 << QRect( QPoint(0,INT_MIN/2), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
846 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
847 << QRect( QPoint(0, 0), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
848 QTest::newRow( dataTag: "LargestQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddlePositiveInt )
849 << QRect( QPoint(0,INT_MAX/2), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
850 QTest::newRow( dataTag: "LargestQRect_MaximumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MaximumInt )
851 << QRect( QPoint(0,INT_MAX), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
852 QTest::newRow( dataTag: "LargestQRect_RandomInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: RandomInt )
853 << QRect( QPoint(0,4953), QPoint( INT_MAX - 1, INT_MAX - 1 ) );
854 }
855
856 {
857 QTest::newRow( dataTag: "SmallestCoordQRect_MinimumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MinimumInt )
858 << QRect( QPoint(INT_MIN,INT_MIN), QPoint( INT_MIN, INT_MIN ) );
859 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
860 << QRect( QPoint(INT_MIN,INT_MIN/2), QPoint( INT_MIN, INT_MIN ) );
861 QTest::newRow( dataTag: "SmallestCoordQRect_ZeroInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: ZeroInt )
862 << QRect( QPoint(INT_MIN,0), QPoint( INT_MIN, INT_MIN ) );
863 QTest::newRow( dataTag: "SmallestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
864 << QRect( QPoint(INT_MIN,INT_MAX/2), QPoint( INT_MIN, INT_MIN ) );
865 QTest::newRow( dataTag: "SmallestCoordQRect_MaximumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MaximumInt )
866 << QRect( QPoint(INT_MIN,INT_MAX), QPoint( INT_MIN, INT_MIN ) );
867 QTest::newRow( dataTag: "SmallestCoordQRect_RandomInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: RandomInt )
868 << QRect( QPoint(INT_MIN,4953), QPoint( INT_MIN, INT_MIN ) );
869 }
870
871 {
872 QTest::newRow( dataTag: "LargestCoordQRect_MinimumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MinimumInt )
873 << QRect( QPoint(INT_MIN,INT_MIN), QPoint( INT_MAX, INT_MAX ) );
874 QTest::newRow( dataTag: "LargestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
875 << QRect( QPoint(INT_MIN,INT_MIN/2), QPoint( INT_MAX, INT_MAX ) );
876 QTest::newRow( dataTag: "LargestCoordQRect_ZeroInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: ZeroInt )
877 << QRect( QPoint(INT_MIN,0), QPoint( INT_MAX, INT_MAX ) );
878 QTest::newRow( dataTag: "LargestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
879 << QRect( QPoint(INT_MIN,INT_MAX/2), QPoint( INT_MAX, INT_MAX ) );
880 QTest::newRow( dataTag: "LargestCoordQRect_MaximumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MaximumInt )
881 << QRect( QPoint(INT_MIN,INT_MAX), QPoint( INT_MAX, INT_MAX ) );
882 QTest::newRow( dataTag: "LargestCoordQRect_RandomInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: RandomInt )
883 << QRect( QPoint(INT_MIN,4953), QPoint( INT_MAX, INT_MAX ) );
884 }
885
886 {
887 QTest::newRow( dataTag: "RandomQRect_MinimumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MinimumInt )
888 << QRect( QPoint(100,INT_MIN), QPoint( 110, 215 ) );
889 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
890 << QRect( QPoint(100,INT_MIN/2), QPoint( 110, 215 ) );
891 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
892 << QRect( QPoint(100,0), QPoint( 110, 215 ) );
893 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
894 << QRect( QPoint(100,INT_MAX/2), QPoint( 110, 215 ) );
895 QTest::newRow( dataTag: "RandomQRect_MaximumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MaximumInt )
896 << QRect( QPoint(100,INT_MAX), QPoint( 110, 215 ) );
897 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
898 << QRect( QPoint(100,4953), QPoint( 110, 215 ) );
899 }
900
901 {
902 QTest::newRow( dataTag: "NegativeSizeQRect_MinimumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MinimumInt )
903 << QRect( QPoint(1,INT_MIN), QPoint( -10, -10 ) );
904 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
905 << QRect( QPoint(1,INT_MIN/2), QPoint( -10, -10 ) );
906 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
907 << QRect( QPoint(1,0), QPoint( -10, -10 ) );
908 QTest::newRow( dataTag: "NegativeSizeQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddlePositiveInt )
909 << QRect( QPoint(1,INT_MAX/2), QPoint( -10, -10 ) );
910 QTest::newRow( dataTag: "NegativeSizeQRect_MaximumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MaximumInt )
911 << QRect( QPoint(1,INT_MAX), QPoint( -10, -10 ) );
912 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
913 << QRect( QPoint(1,4953), QPoint( -10, -10 ) );
914 }
915
916 {
917 QTest::newRow( dataTag: "NegativePointQRect_MinimumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MinimumInt )
918 << QRect( QPoint(-10,INT_MIN), QPoint( -6, -6 ) );
919 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
920 << QRect( QPoint(-10,INT_MIN/2), QPoint( -6, -6 ) );
921 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
922 << QRect( QPoint(-10,0), QPoint( -6, -6 ) );
923 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
924 << QRect( QPoint(-10,INT_MAX/2), QPoint( -6, -6 ) );
925 QTest::newRow( dataTag: "NegativePointQRect_MaximumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MaximumInt )
926 << QRect( QPoint(-10,INT_MAX), QPoint( -6, -6 ) );
927 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
928 << QRect( QPoint(-10,4953), QPoint( -6, -6 ) );
929 }
930
931 {
932 QTest::newRow( dataTag: "NullQRect_MinimumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MinimumInt )
933 << QRect( QPoint(5,INT_MIN), QPoint( 4, 4 ) );
934 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
935 << QRect( QPoint(5,INT_MIN/2), QPoint( 4, 4 ) );
936 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
937 << QRect( QPoint(5,0), QPoint( 4, 4 ) );
938 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
939 << QRect( QPoint(5,INT_MAX/2), QPoint( 4, 4 ) );
940 QTest::newRow( dataTag: "NullQRect_MaximumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MaximumInt )
941 << QRect( QPoint(5,INT_MAX), QPoint( 4, 4 ) );
942 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
943 << QRect( QPoint(5,4953), QPoint( 4, 4 ) );
944 }
945
946 {
947 QTest::newRow( dataTag: "EmptyQRect_MinimumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MinimumInt )
948 << QRect( QPoint(2,INT_MIN), QPoint( 1, 1 ) );
949 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
950 << QRect( QPoint(2,INT_MIN/2), QPoint( 1, 1 ) );
951 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
952 << QRect( QPoint(2,0), QPoint( 1, 1 ) );
953 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
954 << QRect( QPoint(2,INT_MAX/2), QPoint( 1, 1 ) );
955 QTest::newRow( dataTag: "EmptyQRect_MaximumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MaximumInt )
956 << QRect( QPoint(2,INT_MAX), QPoint( 1, 1 ) );
957 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
958 << QRect( QPoint(2,4953), QPoint( 1, 1 ) );
959 }
960}
961
962void tst_QRect::setTop()
963{
964 QFETCH( QRect, r );
965 QFETCH( int, top );
966 QFETCH( QRect, nr );
967
968 r.setTop( top );
969
970 QCOMPARE( r, nr );
971}
972
973void tst_QRect::setRight_data()
974{
975 QTest::addColumn<QRect>(name: "r");
976 QTest::addColumn<int>(name: "right");
977 QTest::addColumn<QRect>(name: "nr");
978
979 {
980 QTest::newRow( dataTag: "InvalidQRect_MinimumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MinimumInt )
981 << QRect( QPoint(0,0), QPoint(INT_MIN,-1) );
982 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
983 << QRect( QPoint(0,0), QPoint(INT_MIN/2,-1) );
984 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
985 << QRect( QPoint(0,0), QPoint(0,-1) );
986 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
987 << QRect( QPoint(0,0), QPoint(INT_MAX/2,-1) );
988 QTest::newRow( dataTag: "InvalidQRect_MaximumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MaximumInt )
989 << QRect( QPoint(0,0), QPoint(INT_MAX,-1) );
990 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
991 << QRect( QPoint(0,0), QPoint(4953,-1) );
992 }
993
994 {
995 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
996 << QRect( QPoint(1,1), QPoint(INT_MIN,1) );
997 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
998 << QRect( QPoint(1,1), QPoint(INT_MIN/2,1) );
999 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
1000 << QRect( QPoint(1,1), QPoint(0,1) );
1001 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
1002 << QRect( QPoint(1,1), QPoint(INT_MAX/2,1) );
1003 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
1004 << QRect( QPoint(1,1), QPoint(INT_MAX,1) );
1005 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
1006 << QRect( QPoint(1,1), QPoint(4953,1) );
1007 }
1008
1009 {
1010 QTest::newRow( dataTag: "MiddleQRect_MinimumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MinimumInt )
1011 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MIN, INT_MAX / 2 ) );
1012 QTest::newRow( dataTag: "MiddleQRect_MiddleNegativeInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddleNegativeInt )
1013 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MIN/2, INT_MAX / 2 ) );
1014 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
1015 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(0, INT_MAX / 2 ));
1016 QTest::newRow( dataTag: "MiddleQRect_MiddlePositiveInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddlePositiveInt )
1017 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX/2, INT_MAX / 2 ));
1018 QTest::newRow( dataTag: "MiddleQRect_MaximumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MaximumInt )
1019 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX, INT_MAX / 2 ));
1020 QTest::newRow( dataTag: "MiddleQRect_RandomInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: RandomInt )
1021 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(4953, INT_MAX / 2 ));
1022 }
1023
1024 {
1025 QTest::newRow( dataTag: "LargestQRect_MinimumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MinimumInt )
1026 << QRect( QPoint( 0, 0 ), QPoint( INT_MIN, INT_MAX - 1 ) );
1027 QTest::newRow( dataTag: "LargestQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddleNegativeInt )
1028 << QRect( QPoint( 0, 0 ), QPoint( INT_MIN/2, INT_MAX - 1 ) );
1029 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
1030 << QRect( QPoint( 0, 0 ), QPoint( 0, INT_MAX - 1 ) );
1031 QTest::newRow( dataTag: "LargestQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddlePositiveInt )
1032 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX/2, INT_MAX - 1 ) );
1033 QTest::newRow( dataTag: "LargestQRect_MaximumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MaximumInt )
1034 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX, INT_MAX - 1 ) );
1035 QTest::newRow( dataTag: "LargestQRect_RandomInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: RandomInt )
1036 << QRect( QPoint( 0, 0 ), QPoint( 4953, INT_MAX - 1 ) );
1037 }
1038
1039 {
1040 QTest::newRow( dataTag: "SmallestCoordQRect_MinimumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MinimumInt )
1041 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
1042 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
1043 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN/2, INT_MIN ) );
1044 QTest::newRow( dataTag: "SmallestCoordQRect_ZeroInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: ZeroInt )
1045 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( 0, INT_MIN ) );
1046 QTest::newRow( dataTag: "SmallestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
1047 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX/2, INT_MIN ) );
1048 QTest::newRow( dataTag: "SmallestCoordQRect_MaximumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MaximumInt )
1049 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MIN ) );
1050 QTest::newRow( dataTag: "SmallestCoordQRect_RandomInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: RandomInt )
1051 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( 4953, INT_MIN ) );
1052 }
1053
1054 {
1055 QTest::newRow( dataTag: "LargestCoordQRect_MinimumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MinimumInt )
1056 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, INT_MAX ) );
1057 QTest::newRow( dataTag: "LargestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
1058 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN/2, INT_MAX ) );
1059 QTest::newRow( dataTag: "LargestCoordQRect_ZeroInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: ZeroInt )
1060 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( 0, INT_MAX ) );
1061 QTest::newRow( dataTag: "LargestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
1062 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX/2, INT_MAX ) );
1063 QTest::newRow( dataTag: "LargestCoordQRect_MaximumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MaximumInt )
1064 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
1065 QTest::newRow( dataTag: "LargestCoordQRect_RandomInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: RandomInt )
1066 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( 4953, INT_MAX ) );
1067 }
1068
1069 {
1070 QTest::newRow( dataTag: "RandomQRect_MinimumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MinimumInt )
1071 << QRect( QPoint( 100, 200 ), QPoint( INT_MIN, 215 ) );
1072 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
1073 << QRect( QPoint( 100, 200 ), QPoint( INT_MIN/2, 215 ) );
1074 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
1075 << QRect( QPoint( 100, 200 ), QPoint( 0, 215 ) );
1076 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
1077 << QRect( QPoint( 100, 200 ), QPoint( INT_MAX/2, 215 ) );
1078 QTest::newRow( dataTag: "RandomQRect_MaximumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MaximumInt )
1079 << QRect( QPoint( 100, 200 ), QPoint( INT_MAX, 215 ) );
1080 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
1081 << QRect( QPoint( 100, 200 ), QPoint( 4953, 215 ) );
1082 }
1083
1084 {
1085 QTest::newRow( dataTag: "NegativeSizeQRect_MinimumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MinimumInt )
1086 << QRect( QPoint( 1, 1 ), QPoint( INT_MIN, -10 ) );
1087 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
1088 << QRect( QPoint( 1, 1 ), QPoint( INT_MIN/2, -10 ) );
1089 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
1090 << QRect( QPoint( 1, 1 ), QPoint( 0, -10 ) );
1091 QTest::newRow( dataTag: "NegativeSizeQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddlePositiveInt )
1092 << QRect( QPoint( 1, 1 ), QPoint( INT_MAX/2, -10 ) );
1093 QTest::newRow( dataTag: "NegativeSizeQRect_MaximumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MaximumInt )
1094 << QRect( QPoint( 1, 1 ), QPoint( INT_MAX, -10 ) );
1095 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
1096 << QRect( QPoint( 1, 1 ), QPoint( 4953, -10 ) );
1097 }
1098
1099 {
1100 QTest::newRow( dataTag: "NegativePointQRect_MinimumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MinimumInt )
1101 << QRect( QPoint( -10, -10 ), QPoint( INT_MIN, -6 ) );
1102 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
1103 << QRect( QPoint( -10, -10 ), QPoint( INT_MIN/2, -6 ) );
1104 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
1105 << QRect( QPoint( -10, -10 ), QPoint( 0, -6 ) );
1106 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
1107 << QRect( QPoint( -10, -10 ), QPoint( INT_MAX/2, -6 ) );
1108 QTest::newRow( dataTag: "NegativePointQRect_MaximumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MaximumInt )
1109 << QRect( QPoint( -10, -10 ), QPoint( INT_MAX, -6 ) );
1110 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
1111 << QRect( QPoint( -10, -10 ), QPoint( 4953, -6 ) );
1112 }
1113
1114 {
1115 QTest::newRow( dataTag: "NullQRect_MinimumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MinimumInt )
1116 << QRect( QPoint( 5, 5 ), QPoint( INT_MIN, 4 ) );
1117 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
1118 << QRect( QPoint( 5, 5 ), QPoint( INT_MIN/2, 4 ) );
1119 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
1120 << QRect( QPoint( 5, 5 ), QPoint( 0, 4 ) );
1121 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
1122 << QRect( QPoint( 5, 5 ), QPoint( INT_MAX/2, 4 ) );
1123 QTest::newRow( dataTag: "NullQRect_MaximumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MaximumInt )
1124 << QRect( QPoint( 5, 5 ), QPoint( INT_MAX, 4 ) );
1125 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
1126 << QRect( QPoint( 5, 5 ), QPoint( 4953, 4 ) );
1127 }
1128
1129 {
1130 QTest::newRow( dataTag: "EmptyQRect_MinimumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MinimumInt )
1131 << QRect( QPoint( 2, 2 ), QPoint( INT_MIN, 1 ) );
1132 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
1133 << QRect( QPoint( 2, 2 ), QPoint( INT_MIN/2, 1 ) );
1134 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
1135 << QRect( QPoint( 2, 2 ), QPoint( 0, 1 ) );
1136 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
1137 << QRect( QPoint( 2, 2 ), QPoint( INT_MAX/2, 1 ) );
1138 QTest::newRow( dataTag: "EmptyQRect_MaximumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MaximumInt )
1139 << QRect( QPoint( 2, 2 ), QPoint( INT_MAX, 1 ) );
1140 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
1141 << QRect( QPoint( 2, 2 ), QPoint( 4953, 1 ) );
1142 }
1143}
1144
1145void tst_QRect::setRight()
1146{
1147 QFETCH( QRect, r );
1148 QFETCH( int, right );
1149 QFETCH( QRect, nr );
1150
1151 r.setRight( right );
1152
1153 QCOMPARE( r, nr );
1154}
1155
1156void tst_QRect::setBottom_data()
1157{
1158 QTest::addColumn<QRect>(name: "r");
1159 QTest::addColumn<int>(name: "bottom");
1160 QTest::addColumn<QRect>(name: "nr");
1161
1162 {
1163 QTest::newRow( dataTag: "InvalidQRect_MinimumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MinimumInt )
1164 << QRect( QPoint(0,0), QPoint(-1,INT_MIN) );
1165 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
1166 << QRect( QPoint(0,0), QPoint(-1,INT_MIN/2) );
1167 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
1168 << QRect( QPoint(0,0), QPoint(-1,0) );
1169 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
1170 << QRect( QPoint(0,0), QPoint(-1,INT_MAX/2) );
1171 QTest::newRow( dataTag: "InvalidQRect_MaximumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MaximumInt )
1172 << QRect( QPoint(0,0), QPoint(-1,INT_MAX) );
1173 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
1174 << QRect( QPoint(0,0), QPoint(-1,4953) );
1175 }
1176
1177 {
1178 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
1179 << QRect( QPoint(1,1), QPoint(1,INT_MIN) );
1180 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
1181 << QRect( QPoint(1,1), QPoint(1,INT_MIN/2) );
1182 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
1183 << QRect( QPoint(1,1), QPoint(1,0) );
1184 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
1185 << QRect( QPoint(1,1), QPoint(1,INT_MAX/2) );
1186 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
1187 << QRect( QPoint(1,1), QPoint(1,INT_MAX) );
1188 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
1189 << QRect( QPoint(1,1), QPoint(1,4953) );
1190 }
1191
1192 {
1193 QTest::newRow( dataTag: "MiddleQRect_MinimumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MinimumInt )
1194 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX / 2, INT_MIN ) );
1195 QTest::newRow( dataTag: "MiddleQRect_MiddleNegativeInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddleNegativeInt )
1196 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX / 2, INT_MIN / 2 ) );
1197 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
1198 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX / 2, 0) );
1199 QTest::newRow( dataTag: "MiddleQRect_MiddlePositiveInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddlePositiveInt )
1200 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX / 2, INT_MAX / 2 ) );
1201 QTest::newRow( dataTag: "MiddleQRect_MaximumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MaximumInt )
1202 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX / 2, INT_MAX) );
1203 QTest::newRow( dataTag: "MiddleQRect_RandomInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: RandomInt )
1204 << QRect( QPoint( INT_MIN / 2, INT_MIN / 2 ), QPoint(INT_MAX / 2, 4953) );
1205 }
1206
1207 {
1208 QTest::newRow( dataTag: "LargestQRect_MinimumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MinimumInt )
1209 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, INT_MIN) );
1210 QTest::newRow( dataTag: "LargestQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddleNegativeInt )
1211 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, INT_MIN/2) );
1212 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
1213 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, 0 ) );
1214 QTest::newRow( dataTag: "LargestQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddlePositiveInt )
1215 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, INT_MAX/2 ) );
1216 QTest::newRow( dataTag: "LargestQRect_MaximumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MaximumInt )
1217 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, INT_MAX ) );
1218 QTest::newRow( dataTag: "LargestQRect_RandomInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: RandomInt )
1219 << QRect( QPoint( 0, 0 ), QPoint( INT_MAX - 1, 4953) );
1220 }
1221
1222 {
1223 QTest::newRow( dataTag: "SmallestCoordQRect_MinimumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MinimumInt )
1224 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, INT_MIN ) );
1225 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
1226 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, INT_MIN/2 ) );
1227 QTest::newRow( dataTag: "SmallestCoordQRect_ZeroInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: ZeroInt )
1228 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, 0 ) );
1229 QTest::newRow( dataTag: "SmallestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
1230 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, INT_MAX/2 ) );
1231 QTest::newRow( dataTag: "SmallestCoordQRect_MaximumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MaximumInt )
1232 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, INT_MAX ) );
1233 QTest::newRow( dataTag: "SmallestCoordQRect_RandomInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: RandomInt )
1234 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MIN, 4953 ) );
1235 }
1236
1237 {
1238 QTest::newRow( dataTag: "LargestCoordQRect_MinimumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MinimumInt )
1239 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MIN ) );
1240 QTest::newRow( dataTag: "LargestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
1241 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MIN/2 ) );
1242 QTest::newRow( dataTag: "LargestCoordQRect_ZeroInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: ZeroInt )
1243 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, 0 ) );
1244 QTest::newRow( dataTag: "LargestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
1245 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MAX/2 ) );
1246 QTest::newRow( dataTag: "LargestCoordQRect_MaximumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MaximumInt )
1247 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, INT_MAX ) );
1248 QTest::newRow( dataTag: "LargestCoordQRect_RandomInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: RandomInt )
1249 << QRect( QPoint( INT_MIN, INT_MIN ), QPoint( INT_MAX, 4953 ) );
1250 }
1251
1252 {
1253 QTest::newRow( dataTag: "RandomQRect_MinimumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MinimumInt )
1254 << QRect( QPoint( 100, 200 ), QPoint( 110, INT_MIN ) );
1255 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
1256 << QRect( QPoint( 100, 200 ), QPoint( 110, INT_MIN/2 ) );
1257 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
1258 << QRect( QPoint( 100, 200 ), QPoint( 110, 0) );
1259 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
1260 << QRect( QPoint( 100, 200 ), QPoint( 110, INT_MAX/2) );
1261 QTest::newRow( dataTag: "RandomQRect_MaximumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MaximumInt )
1262 << QRect( QPoint( 100, 200 ), QPoint( 110, INT_MAX ) );
1263 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
1264 << QRect( QPoint( 100, 200 ), QPoint( 110,4953 ) );
1265 }
1266
1267 {
1268 QTest::newRow( dataTag: "NegativeSizeQRect_MinimumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MinimumInt )
1269 << QRect( QPoint( 1, 1 ), QPoint( -10, INT_MIN ) );
1270 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
1271 << QRect( QPoint( 1, 1 ), QPoint( -10, INT_MIN/2 ) );
1272 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
1273 << QRect( QPoint( 1, 1 ), QPoint( -10, 0 ) );
1274 QTest::newRow( dataTag: "NegativeSizeQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddlePositiveInt )
1275 << QRect( QPoint( 1, 1 ), QPoint( -10, INT_MAX/2 ) );
1276 QTest::newRow( dataTag: "NegativeSizeQRect_MaximumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MaximumInt )
1277 << QRect( QPoint( 1, 1 ), QPoint( -10, INT_MAX ) );
1278 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
1279 << QRect( QPoint( 1, 1 ), QPoint( -10, 4953 ) );
1280 }
1281
1282 {
1283 QTest::newRow( dataTag: "NegativePointQRect_MinimumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MinimumInt )
1284 << QRect( QPoint( -10, -10 ), QPoint( -6, INT_MIN ) );
1285 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
1286 << QRect( QPoint( -10, -10 ), QPoint( -6, INT_MIN/2 ) );
1287 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
1288 << QRect( QPoint( -10, -10 ), QPoint( -6, 0 ) );
1289 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
1290 << QRect( QPoint( -10, -10 ), QPoint( -6, INT_MAX/2 ) );
1291 QTest::newRow( dataTag: "NegativePointQRect_MaximumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MaximumInt )
1292 << QRect( QPoint( -10, -10 ), QPoint( -6, INT_MAX ) );
1293 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
1294 << QRect( QPoint( -10, -10 ), QPoint( -6, 4953 ) );
1295 }
1296
1297 {
1298 QTest::newRow( dataTag: "NullQRect_MinimumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MinimumInt )
1299 << QRect( QPoint( 5, 5 ), QPoint( 4, INT_MIN ) );
1300 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
1301 << QRect( QPoint( 5, 5 ), QPoint( 4, INT_MIN/2 ) );
1302 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
1303 << QRect( QPoint( 5, 5 ), QPoint( 4, 0 ) );
1304 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
1305 << QRect( QPoint( 5, 5 ), QPoint( 4, INT_MAX/2 ) );
1306 QTest::newRow( dataTag: "NullQRect_MaximumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MaximumInt )
1307 << QRect( QPoint( 5, 5 ), QPoint( 4, INT_MAX ) );
1308 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
1309 << QRect( QPoint( 5, 5 ), QPoint( 4, 4953 ) );
1310 }
1311
1312 {
1313 QTest::newRow( dataTag: "EmptyQRect_MinimumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MinimumInt )
1314 << QRect( QPoint( 2, 2 ), QPoint( 1, INT_MIN ) );
1315 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
1316 << QRect( QPoint( 2, 2 ), QPoint( 1, INT_MIN/2 ) );
1317 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
1318 << QRect( QPoint( 2, 2 ), QPoint( 1, 0 ) );
1319 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
1320 << QRect( QPoint( 2, 2 ), QPoint( 1, INT_MAX/2 ) );
1321 QTest::newRow( dataTag: "EmptyQRect_MaximumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MaximumInt )
1322 << QRect( QPoint( 2, 2 ), QPoint( 1, INT_MAX ) );
1323 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
1324 << QRect( QPoint( 2, 2 ), QPoint( 1, 4953 ) );
1325 }
1326}
1327
1328void tst_QRect::setBottom()
1329{
1330 QFETCH( QRect, r );
1331 QFETCH( int, bottom );
1332 QFETCH( QRect, nr );
1333
1334 r.setBottom( bottom );
1335
1336 QCOMPARE( r, nr );
1337}
1338
1339void tst_QRect::newSetTopLeft_data()
1340{
1341 QTest::addColumn<QRect>(name: "r");
1342 QTest::addColumn<QPoint>(name: "topLeft");
1343 QTest::addColumn<QRect>(name: "nr");
1344
1345 {
1346 QTest::newRow(dataTag: "InvalidQRect_NullQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NullQPoint)
1347 << QRect(QPoint(0,0), QPoint(-1,-1));
1348 QTest::newRow(dataTag: "InvalidQRect_SmallestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: SmallestCoordQPoint)
1349 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(-1,-1));
1350 QTest::newRow(dataTag: "InvalidQRect_MiddleNegCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1351 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(-1,-1));
1352 QTest::newRow(dataTag: "InvalidQRect_MiddlePosCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1353 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(-1,-1));
1354 QTest::newRow(dataTag: "InvalidQRect_LargestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: LargestCoordQPoint)
1355 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(-1,-1));
1356 QTest::newRow(dataTag: "InvalidQRect_NegXQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegXQPoint)
1357 << QRect(QPoint(-12,7), QPoint(-1,-1));
1358 QTest::newRow(dataTag: "InvalidQRect_NegYQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegYQPoint)
1359 << QRect(QPoint(12,-7), QPoint(-1,-1));
1360 QTest::newRow(dataTag: "InvalidQRect_RandomQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: RandomQPoint)
1361 << QRect(QPoint(12,7), QPoint(-1,-1));
1362 }
1363
1364 {
1365 QTest::newRow(dataTag: "SmallestQRect_NullQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NullQPoint)
1366 << QRect(QPoint(0,0), QPoint(1,1));
1367 QTest::newRow(dataTag: "SmallestQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: SmallestCoordQPoint)
1368 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(1,1));
1369 QTest::newRow(dataTag: "SmallestQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1370 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(1,1));
1371 QTest::newRow(dataTag: "SmallestQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1372 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(1,1));
1373 QTest::newRow(dataTag: "SmallestQRect_LargestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: LargestCoordQPoint)
1374 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(1,1));
1375 QTest::newRow(dataTag: "SmallestQRect_NegXQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegXQPoint)
1376 << QRect(QPoint(-12,7), QPoint(1,1));
1377 QTest::newRow(dataTag: "SmallestQRect_NegYQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegYQPoint)
1378 << QRect(QPoint(12,-7), QPoint(1,1));
1379 QTest::newRow(dataTag: "SmallestQRect_RandomQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: RandomQPoint)
1380 << QRect(QPoint(12,7), QPoint(1,1));
1381 }
1382
1383 {
1384 QTest::newRow(dataTag: "MiddleQRect_NullQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NullQPoint)
1385 << QRect(QPoint(0,0), QPoint(INT_MAX/2,INT_MAX/2));
1386 QTest::newRow(dataTag: "MiddleQRect_SmallestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: SmallestCoordQPoint)
1387 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX/2,INT_MAX/2));
1388 QTest::newRow(dataTag: "MiddleQRect_MiddleNegCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1389 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MAX/2,INT_MAX/2));
1390 QTest::newRow(dataTag: "MiddleQRect_MiddlePosCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1391 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(INT_MAX/2,INT_MAX/2));
1392 QTest::newRow(dataTag: "MiddleQRect_LargestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: LargestCoordQPoint)
1393 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(INT_MAX/2,INT_MAX/2));
1394 QTest::newRow(dataTag: "MiddleQRect_NegXQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegXQPoint)
1395 << QRect(QPoint(-12,7), QPoint(INT_MAX/2,INT_MAX/2));
1396 QTest::newRow(dataTag: "MiddleQRect_NegYQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegYQPoint)
1397 << QRect(QPoint(12,-7), QPoint(INT_MAX/2,INT_MAX/2));
1398 QTest::newRow(dataTag: "MiddleQRect_RandomQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: RandomQPoint)
1399 << QRect(QPoint(12,7), QPoint(INT_MAX/2,INT_MAX/2));
1400 }
1401
1402 {
1403 QTest::newRow(dataTag: "LargestQRect_NullQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NullQPoint)
1404 << QRect(QPoint(0,0), QPoint(INT_MAX-1,INT_MAX-1));
1405 QTest::newRow(dataTag: "LargestQRect_SmallestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: SmallestCoordQPoint)
1406 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX-1,INT_MAX-1));
1407 QTest::newRow(dataTag: "LargestQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1408 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MAX-1,INT_MAX-1));
1409 QTest::newRow(dataTag: "LargestQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1410 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(INT_MAX-1,INT_MAX-1));
1411 QTest::newRow(dataTag: "LargestQRect_LargestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: LargestCoordQPoint)
1412 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(INT_MAX-1,INT_MAX-1));
1413 QTest::newRow(dataTag: "LargestQRect_NegXQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegXQPoint)
1414 << QRect(QPoint(-12,7), QPoint(INT_MAX-1,INT_MAX-1));
1415 QTest::newRow(dataTag: "LargestQRect_NegYQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegYQPoint)
1416 << QRect(QPoint(12,-7), QPoint(INT_MAX-1,INT_MAX-1));
1417 QTest::newRow(dataTag: "LargestQRect_RandomQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: RandomQPoint)
1418 << QRect(QPoint(12,7), QPoint(INT_MAX-1,INT_MAX-1));
1419 }
1420
1421 {
1422 QTest::newRow(dataTag: "SmallestCoordQRect_NullQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NullQPoint)
1423 << QRect(QPoint(0,0), QPoint(INT_MIN,INT_MIN));
1424 QTest::newRow(dataTag: "SmallestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
1425 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN,INT_MIN));
1426 QTest::newRow(dataTag: "SmallestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1427 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MIN,INT_MIN));
1428 QTest::newRow(dataTag: "SmallestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1429 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(INT_MIN,INT_MIN));
1430 QTest::newRow(dataTag: "SmallestCoordQRect_LargestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
1431 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(INT_MIN,INT_MIN));
1432 QTest::newRow(dataTag: "SmallestCoordQRect_NegXQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegXQPoint)
1433 << QRect(QPoint(-12,7), QPoint(INT_MIN,INT_MIN));
1434 QTest::newRow(dataTag: "SmallestCoordQRect_NegYQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegYQPoint)
1435 << QRect(QPoint(12,-7), QPoint(INT_MIN,INT_MIN));
1436 QTest::newRow(dataTag: "SmallestCoordQRect_RandomQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: RandomQPoint)
1437 << QRect(QPoint(12,7), QPoint(INT_MIN,INT_MIN));
1438 }
1439
1440 {
1441 QTest::newRow(dataTag: "LargestCoordQRect_NullQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NullQPoint)
1442 << QRect(QPoint(0,0), QPoint(INT_MAX,INT_MAX));
1443 QTest::newRow(dataTag: "LargestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
1444 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX,INT_MAX));
1445 QTest::newRow(dataTag: "LargestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1446 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MAX,INT_MAX));
1447 QTest::newRow(dataTag: "LargestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1448 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(INT_MAX,INT_MAX));
1449 QTest::newRow(dataTag: "LargestCoordQRect_LargestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
1450 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(INT_MAX,INT_MAX));
1451 QTest::newRow(dataTag: "LargestCoordQRect_NegXQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegXQPoint)
1452 << QRect(QPoint(-12,7), QPoint(INT_MAX,INT_MAX));
1453 QTest::newRow(dataTag: "LargestCoordQRect_NegYQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegYQPoint)
1454 << QRect(QPoint(12,-7), QPoint(INT_MAX,INT_MAX));
1455 QTest::newRow(dataTag: "LargestCoordQRect_RandomQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: RandomQPoint)
1456 << QRect(QPoint(12,7), QPoint(INT_MAX,INT_MAX));
1457 }
1458
1459 {
1460 QTest::newRow(dataTag: "RandomQRect_NullQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NullQPoint)
1461 << QRect(QPoint(0,0), QPoint(110,215));
1462 QTest::newRow(dataTag: "RandomQRect_SmallestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: SmallestCoordQPoint)
1463 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(110,215));
1464 QTest::newRow(dataTag: "RandomQRect_MiddleNegCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1465 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(110,215));
1466 QTest::newRow(dataTag: "RandomQRect_MiddlePosCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1467 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(110,215));
1468 QTest::newRow(dataTag: "RandomQRect_LargestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: LargestCoordQPoint)
1469 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(110,215));
1470 QTest::newRow(dataTag: "RandomQRect_NegXQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegXQPoint)
1471 << QRect(QPoint(-12,7), QPoint(110,215));
1472 QTest::newRow(dataTag: "RandomQRect_NegYQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegYQPoint)
1473 << QRect(QPoint(12,-7), QPoint(110,215));
1474 QTest::newRow(dataTag: "RandomQRect_RandomQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: RandomQPoint)
1475 << QRect(QPoint(12,7), QPoint(110,215));
1476 }
1477
1478 {
1479 QTest::newRow(dataTag: "NegativeSizeQRect_NullQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NullQPoint)
1480 << QRect(QPoint(0,0), QPoint(-10,-10));
1481 QTest::newRow(dataTag: "NegativeSizeQRect_SmallestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: SmallestCoordQPoint)
1482 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(-10,-10));
1483 QTest::newRow(dataTag: "NegativeSizeQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1484 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(-10,-10));
1485 QTest::newRow(dataTag: "NegativeSizeQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1486 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(-10,-10));
1487 QTest::newRow(dataTag: "NegativeSizeQRect_LargestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: LargestCoordQPoint)
1488 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(-10,-10));
1489 QTest::newRow(dataTag: "NegativeSizeQRect_NegXQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegXQPoint)
1490 << QRect(QPoint(-12,7), QPoint(-10,-10));
1491 QTest::newRow(dataTag: "NegativeSizeQRect_NegYQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegYQPoint)
1492 << QRect(QPoint(12,-7), QPoint(-10,-10));
1493 QTest::newRow(dataTag: "NegativeSizeQRect_RandomQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: RandomQPoint)
1494 << QRect(QPoint(12,7), QPoint(-10,-10));
1495 }
1496
1497 {
1498 QTest::newRow(dataTag: "NegativePointQRect_NullQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NullQPoint)
1499 << QRect(QPoint(0,0), QPoint(-6,-6));
1500 QTest::newRow(dataTag: "NegativePointQRect_SmallestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: SmallestCoordQPoint)
1501 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(-6,-6));
1502 QTest::newRow(dataTag: "NegativePointQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1503 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(-6,-6));
1504 QTest::newRow(dataTag: "NegativePointQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1505 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(-6,-6));
1506 QTest::newRow(dataTag: "NegativePointQRect_LargestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: LargestCoordQPoint)
1507 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(-6,-6));
1508 QTest::newRow(dataTag: "NegativePointQRect_NegXQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegXQPoint)
1509 << QRect(QPoint(-12,7), QPoint(-6,-6));
1510 QTest::newRow(dataTag: "NegativePointQRect_NegYQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegYQPoint)
1511 << QRect(QPoint(12,-7), QPoint(-6,-6));
1512 QTest::newRow(dataTag: "NegativePointQRect_RandomQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: RandomQPoint)
1513 << QRect(QPoint(12,7), QPoint(-6,-6));
1514 }
1515
1516 {
1517 QTest::newRow(dataTag: "NullQRect_NullQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NullQPoint)
1518 << QRect(QPoint(0,0), QPoint(4,4));
1519 QTest::newRow(dataTag: "NullQRect_SmallestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: SmallestCoordQPoint)
1520 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(4,4));
1521 QTest::newRow(dataTag: "NullQRect_MiddleNegCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1522 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(4,4));
1523 QTest::newRow(dataTag: "NullQRect_MiddlePosCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1524 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(4,4));
1525 QTest::newRow(dataTag: "NullQRect_LargestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: LargestCoordQPoint)
1526 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(4,4));
1527 QTest::newRow(dataTag: "NullQRect_NegXQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegXQPoint)
1528 << QRect(QPoint(-12,7), QPoint(4,4));
1529 QTest::newRow(dataTag: "NullQRect_NegYQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegYQPoint)
1530 << QRect(QPoint(12,-7), QPoint(4,4));
1531 QTest::newRow(dataTag: "NullQRect_RandomQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: RandomQPoint)
1532 << QRect(QPoint(12,7), QPoint(4,4));
1533 }
1534
1535 {
1536 QTest::newRow(dataTag: "EmptyQRect_NullQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NullQPoint)
1537 << QRect(QPoint(0,0), QPoint(1,1));
1538 QTest::newRow(dataTag: "EmptyQRect_SmallestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: SmallestCoordQPoint)
1539 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(1,1));
1540 QTest::newRow(dataTag: "EmptyQRect_MiddleNegCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1541 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(1,1));
1542 QTest::newRow(dataTag: "EmptyQRect_MiddlePosCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1543 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(1,1));
1544 QTest::newRow(dataTag: "EmptyQRect_LargestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: LargestCoordQPoint)
1545 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(1,1));
1546 QTest::newRow(dataTag: "EmptyQRect_NegXQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegXQPoint)
1547 << QRect(QPoint(-12,7), QPoint(1,1));
1548 QTest::newRow(dataTag: "EmptyQRect_NegYQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegYQPoint)
1549 << QRect(QPoint(12,-7), QPoint(1,1));
1550 QTest::newRow(dataTag: "EmptyQRect_RandomQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: RandomQPoint)
1551 << QRect(QPoint(12,7), QPoint(1,1));
1552 }
1553}
1554
1555void tst_QRect::newSetTopLeft()
1556{
1557 QFETCH( QRect, r );
1558 QFETCH( QPoint, topLeft );
1559 QFETCH( QRect, nr );
1560
1561 r.setTopLeft( topLeft );
1562 QCOMPARE( r, nr );
1563}
1564
1565void tst_QRect::newSetBottomRight_data()
1566{
1567 QTest::addColumn<QRect>(name: "r");
1568 QTest::addColumn<QPoint>(name: "bottomRight");
1569 QTest::addColumn<QRect>(name: "nr");
1570
1571 {
1572 QTest::newRow(dataTag: "InvalidQRect_NullQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NullQPoint)
1573 << QRect(QPoint(0,0), QPoint(0,0));
1574 QTest::newRow(dataTag: "InvalidQRect_SmallestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: SmallestCoordQPoint)
1575 << QRect(QPoint(0,0), QPoint(INT_MIN,INT_MIN));
1576 QTest::newRow(dataTag: "InvalidQRect_MiddleNegCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1577 << QRect(QPoint(0,0), QPoint(INT_MIN/2,INT_MIN/2));
1578 QTest::newRow(dataTag: "InvalidQRect_MiddlePosCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1579 << QRect(QPoint(0,0), QPoint(INT_MAX/2,INT_MAX/2));
1580 QTest::newRow(dataTag: "InvalidQRect_LargestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: LargestCoordQPoint)
1581 << QRect(QPoint(0,0), QPoint(INT_MAX,INT_MAX));
1582 QTest::newRow(dataTag: "InvalidQRect_NegXQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegXQPoint)
1583 << QRect(QPoint(0,0), QPoint(-12,7));
1584 QTest::newRow(dataTag: "InvalidQRect_NegYQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegYQPoint)
1585 << QRect(QPoint(0,0), QPoint(12,-7));
1586 QTest::newRow(dataTag: "InvalidQRect_RandomQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: RandomQPoint)
1587 << QRect(QPoint(0,0), QPoint(12,7));
1588 }
1589
1590 {
1591 QTest::newRow(dataTag: "SmallestQRect_NullQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NullQPoint)
1592 << QRect(QPoint(1,1), QPoint(0,0));
1593 QTest::newRow(dataTag: "SmallestQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: SmallestCoordQPoint)
1594 << QRect(QPoint(1,1), QPoint(INT_MIN,INT_MIN));
1595 QTest::newRow(dataTag: "SmallestQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1596 << QRect(QPoint(1,1), QPoint(INT_MIN/2,INT_MIN/2));
1597 QTest::newRow(dataTag: "SmallestQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1598 << QRect(QPoint(1,1), QPoint(INT_MAX/2,INT_MAX/2));
1599 QTest::newRow(dataTag: "SmallestQRect_LargestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: LargestCoordQPoint)
1600 << QRect(QPoint(1,1), QPoint(INT_MAX,INT_MAX));
1601 QTest::newRow(dataTag: "SmallestQRect_NegXQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegXQPoint)
1602 << QRect(QPoint(1,1), QPoint(-12,7));
1603 QTest::newRow(dataTag: "SmallestQRect_NegYQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegYQPoint)
1604 << QRect(QPoint(1,1), QPoint(12,-7));
1605 QTest::newRow(dataTag: "SmallestQRect_RandomQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: RandomQPoint)
1606 << QRect(QPoint(1,1), QPoint(12,7));
1607 }
1608
1609 {
1610 QTest::newRow(dataTag: "MiddleQRect_NullQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NullQPoint)
1611 << QRect(QPoint(QPoint(INT_MIN/2,INT_MIN/2)), QPoint(0,0));
1612 QTest::newRow(dataTag: "MiddleQRect_SmallestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: SmallestCoordQPoint)
1613 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MIN,INT_MIN));
1614 QTest::newRow(dataTag: "MiddleQRect_MiddleNegCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1615 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MIN/2,INT_MIN/2));
1616 QTest::newRow(dataTag: "MiddleQRect_MiddlePosCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1617 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MAX/2,INT_MAX/2));
1618 QTest::newRow(dataTag: "MiddleQRect_LargestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: LargestCoordQPoint)
1619 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MAX,INT_MAX));
1620 QTest::newRow(dataTag: "MiddleQRect_NegXQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegXQPoint)
1621 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(-12,7));
1622 QTest::newRow(dataTag: "MiddleQRect_NegYQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegYQPoint)
1623 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(12,-7));
1624 QTest::newRow(dataTag: "MiddleQRect_RandomQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: RandomQPoint)
1625 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(12,7));
1626 }
1627
1628 {
1629 QTest::newRow(dataTag: "LargestQRect_NullQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NullQPoint)
1630 << QRect(QPoint(0,0), QPoint(0,0));
1631 QTest::newRow(dataTag: "LargestQRect_SmallestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: SmallestCoordQPoint)
1632 << QRect(QPoint(0,0), QPoint(INT_MIN,INT_MIN));
1633 QTest::newRow(dataTag: "LargestQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1634 << QRect(QPoint(0,0), QPoint(INT_MIN/2,INT_MIN/2));
1635 QTest::newRow(dataTag: "LargestQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1636 << QRect(QPoint(0,0), QPoint(INT_MAX/2,INT_MAX/2));
1637 QTest::newRow(dataTag: "LargestQRect_LargestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: LargestCoordQPoint)
1638 << QRect(QPoint(0,0), QPoint(INT_MAX,INT_MAX));
1639 QTest::newRow(dataTag: "LargestQRect_NegXQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegXQPoint)
1640 << QRect(QPoint(0,0), QPoint(-12,7));
1641 QTest::newRow(dataTag: "LargestQRect_NegYQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegYQPoint)
1642 << QRect(QPoint(0,0), QPoint(12,-7));
1643 QTest::newRow(dataTag: "LargestQRect_RandomQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: RandomQPoint)
1644 << QRect(QPoint(0,0), QPoint(12,7));
1645 }
1646
1647 {
1648 QTest::newRow(dataTag: "SmallestCoordQRect_NullQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NullQPoint)
1649 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(0,0));
1650 QTest::newRow(dataTag: "SmallestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
1651 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN,INT_MIN));
1652 QTest::newRow(dataTag: "SmallestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1653 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN/2,INT_MIN/2));
1654 QTest::newRow(dataTag: "SmallestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1655 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX/2,INT_MAX/2));
1656 QTest::newRow(dataTag: "SmallestCoordQRect_LargestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
1657 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX,INT_MAX));
1658 QTest::newRow(dataTag: "SmallestCoordQRect_NegXQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegXQPoint)
1659 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(-12,7));
1660 QTest::newRow(dataTag: "SmallestCoordQRect_NegYQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegYQPoint)
1661 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(12,-7));
1662 QTest::newRow(dataTag: "SmallestCoordQRect_RandomQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: RandomQPoint)
1663 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(12,7));
1664 }
1665
1666 {
1667 QTest::newRow(dataTag: "LargestCoordQRect_NullQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NullQPoint)
1668 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(0,0));
1669 QTest::newRow(dataTag: "LargestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
1670 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN,INT_MIN));
1671 QTest::newRow(dataTag: "LargestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1672 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN/2,INT_MIN/2));
1673 QTest::newRow(dataTag: "LargestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1674 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX/2,INT_MAX/2));
1675 QTest::newRow(dataTag: "LargestCoordQRect_LargestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
1676 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX,INT_MAX));
1677 QTest::newRow(dataTag: "LargestCoordQRect_NegXQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegXQPoint)
1678 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(-12,7));
1679 QTest::newRow(dataTag: "LargestCoordQRect_NegYQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegYQPoint)
1680 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(12,-7));
1681 QTest::newRow(dataTag: "LargestCoordQRect_RandomQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: RandomQPoint)
1682 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(12,7));
1683 }
1684
1685 {
1686 QTest::newRow(dataTag: "RandomQRect_NullQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NullQPoint)
1687 << QRect(QPoint(100,200), QPoint(0,0));
1688 QTest::newRow(dataTag: "RandomQRect_SmallestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: SmallestCoordQPoint)
1689 << QRect(QPoint(100,200), QPoint(INT_MIN,INT_MIN));
1690 QTest::newRow(dataTag: "RandomQRect_MiddleNegCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1691 << QRect(QPoint(100,200), QPoint(INT_MIN/2,INT_MIN/2));
1692 QTest::newRow(dataTag: "RandomQRect_MiddlePosCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1693 << QRect(QPoint(100,200), QPoint(INT_MAX/2,INT_MAX/2));
1694 QTest::newRow(dataTag: "RandomQRect_LargestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: LargestCoordQPoint)
1695 << QRect(QPoint(100,200), QPoint(INT_MAX,INT_MAX));
1696 QTest::newRow(dataTag: "RandomQRect_NegXQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegXQPoint)
1697 << QRect(QPoint(100,200), QPoint(-12,7));
1698 QTest::newRow(dataTag: "RandomQRect_NegYQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegYQPoint)
1699 << QRect(QPoint(100,200), QPoint(12,-7));
1700 QTest::newRow(dataTag: "RandomQRect_RandomQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: RandomQPoint)
1701 << QRect(QPoint(100,200), QPoint(12,7));
1702 }
1703
1704 {
1705 QTest::newRow(dataTag: "NegativeSizeQRect_NullQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NullQPoint)
1706 << QRect(QPoint(1,1), QPoint(0,0));
1707 QTest::newRow(dataTag: "NegativeSizeQRect_SmallestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: SmallestCoordQPoint)
1708 << QRect(QPoint(1,1), QPoint(INT_MIN,INT_MIN));
1709 QTest::newRow(dataTag: "NegativeSizeQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1710 << QRect(QPoint(1,1), QPoint(INT_MIN/2,INT_MIN/2));
1711 QTest::newRow(dataTag: "NegativeSizeQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1712 << QRect(QPoint(1,1), QPoint(INT_MAX/2,INT_MAX/2));
1713 QTest::newRow(dataTag: "NegativeSizeQRect_LargestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: LargestCoordQPoint)
1714 << QRect(QPoint(1,1), QPoint(INT_MAX,INT_MAX));
1715 QTest::newRow(dataTag: "NegativeSizeQRect_NegXQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegXQPoint)
1716 << QRect(QPoint(1,1), QPoint(-12,7));
1717 QTest::newRow(dataTag: "NegativeSizeQRect_NegYQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegYQPoint)
1718 << QRect(QPoint(1,1), QPoint(12,-7));
1719 QTest::newRow(dataTag: "NegativeSizeQRect_RandomQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: RandomQPoint)
1720 << QRect(QPoint(1,1), QPoint(12,7));
1721 }
1722
1723 {
1724 QTest::newRow(dataTag: "NegativePointQRect_NullQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NullQPoint)
1725 << QRect(QPoint(-10,-10), QPoint(0,0));
1726 QTest::newRow(dataTag: "NegativePointQRect_SmallestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: SmallestCoordQPoint)
1727 << QRect(QPoint(-10,-10), QPoint(INT_MIN,INT_MIN));
1728 QTest::newRow(dataTag: "NegativePointQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1729 << QRect(QPoint(-10,-10), QPoint(INT_MIN/2,INT_MIN/2));
1730 QTest::newRow(dataTag: "NegativePointQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1731 << QRect(QPoint(-10,-10), QPoint(INT_MAX/2,INT_MAX/2));
1732 QTest::newRow(dataTag: "NegativePointQRect_LargestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: LargestCoordQPoint)
1733 << QRect(QPoint(-10,-10), QPoint(INT_MAX,INT_MAX));
1734 QTest::newRow(dataTag: "NegativePointQRect_NegXQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegXQPoint)
1735 << QRect(QPoint(-10,-10), QPoint(-12,7));
1736 QTest::newRow(dataTag: "NegativePointQRect_NegYQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegYQPoint)
1737 << QRect(QPoint(-10,-10), QPoint(12,-7));
1738 QTest::newRow(dataTag: "NegativePointQRect_RandomQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: RandomQPoint)
1739 << QRect(QPoint(-10,-10), QPoint(12,7));
1740 }
1741
1742 {
1743 QTest::newRow(dataTag: "NullQRect_NullQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NullQPoint)
1744 << QRect(QPoint(5,5), QPoint(0,0));
1745 QTest::newRow(dataTag: "NullQRect_SmallestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: SmallestCoordQPoint)
1746 << QRect(QPoint(5,5), QPoint(INT_MIN,INT_MIN));
1747 QTest::newRow(dataTag: "NullQRect_MiddleNegCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1748 << QRect(QPoint(5,5), QPoint(INT_MIN/2,INT_MIN/2));
1749 QTest::newRow(dataTag: "NullQRect_MiddlePosCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1750 << QRect(QPoint(5,5), QPoint(INT_MAX/2,INT_MAX/2));
1751 QTest::newRow(dataTag: "NullQRect_LargestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: LargestCoordQPoint)
1752 << QRect(QPoint(5,5), QPoint(INT_MAX,INT_MAX));
1753 QTest::newRow(dataTag: "NullQRect_NegXQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegXQPoint)
1754 << QRect(QPoint(5,5), QPoint(-12,7));
1755 QTest::newRow(dataTag: "NullQRect_NegYQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegYQPoint)
1756 << QRect(QPoint(5,5), QPoint(12,-7));
1757 QTest::newRow(dataTag: "NullQRect_RandomQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: RandomQPoint)
1758 << QRect(QPoint(5,5), QPoint(12,7));
1759 }
1760
1761 {
1762 QTest::newRow(dataTag: "EmptyQRect_NullQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NullQPoint)
1763 << QRect(QPoint(2,2), QPoint(0,0));
1764 QTest::newRow(dataTag: "EmptyQRect_SmallestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: SmallestCoordQPoint)
1765 << QRect(QPoint(2,2), QPoint(INT_MIN,INT_MIN));
1766 QTest::newRow(dataTag: "EmptyQRect_MiddleNegCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1767 << QRect(QPoint(2,2), QPoint(INT_MIN/2,INT_MIN/2));
1768 QTest::newRow(dataTag: "EmptyQRect_MiddlePosCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1769 << QRect(QPoint(2,2), QPoint(INT_MAX/2,INT_MAX/2));
1770 QTest::newRow(dataTag: "EmptyQRect_LargestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: LargestCoordQPoint)
1771 << QRect(QPoint(2,2), QPoint(INT_MAX,INT_MAX));
1772 QTest::newRow(dataTag: "EmptyQRect_NegXQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegXQPoint)
1773 << QRect(QPoint(2,2), QPoint(-12,7));
1774 QTest::newRow(dataTag: "EmptyQRect_NegYQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegYQPoint)
1775 << QRect(QPoint(2,2), QPoint(12,-7));
1776 QTest::newRow(dataTag: "EmptyQRect_RandomQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: RandomQPoint)
1777 << QRect(QPoint(2,2), QPoint(12,7));
1778 }
1779}
1780
1781void tst_QRect::newSetBottomRight()
1782{
1783 QFETCH( QRect, r );
1784 QFETCH( QPoint, bottomRight );
1785 QFETCH( QRect, nr );
1786
1787 r.setBottomRight( bottomRight );
1788
1789 QCOMPARE( r, nr );
1790}
1791
1792void tst_QRect::newSetTopRight_data()
1793{
1794 QTest::addColumn<QRect>(name: "r");
1795 QTest::addColumn<QPoint>(name: "topRight");
1796 QTest::addColumn<QRect>(name: "nr");
1797
1798 {
1799 QTest::newRow(dataTag: "InvalidQRect_NullQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NullQPoint)
1800 << QRect(QPoint(0,0), QPoint(0,-1));
1801 QTest::newRow(dataTag: "InvalidQRect_SmallestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: SmallestCoordQPoint)
1802 << QRect(QPoint(0,INT_MIN), QPoint(INT_MIN,-1));
1803 QTest::newRow(dataTag: "InvalidQRect_MiddleNegCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1804 << QRect(QPoint(0,INT_MIN/2), QPoint(INT_MIN/2,-1));
1805 QTest::newRow(dataTag: "InvalidQRect_MiddlePosCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1806 << QRect(QPoint(0,INT_MAX/2), QPoint(INT_MAX/2,-1));
1807 QTest::newRow(dataTag: "InvalidQRect_LargestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: LargestCoordQPoint)
1808 << QRect(QPoint(0,INT_MAX), QPoint(INT_MAX,-1));
1809 QTest::newRow(dataTag: "InvalidQRect_NegXQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegXQPoint)
1810 << QRect(QPoint(0,7), QPoint(-12,-1));
1811 QTest::newRow(dataTag: "InvalidQRect_NegYQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegYQPoint)
1812 << QRect(QPoint(0,-7), QPoint(12,-1));
1813 QTest::newRow(dataTag: "InvalidQRect_RandomQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: RandomQPoint)
1814 << QRect(QPoint(0,7), QPoint(12,-1));
1815 }
1816
1817 {
1818 QTest::newRow(dataTag: "SmallestQRect_NullQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NullQPoint)
1819 << QRect(QPoint(1,0), QPoint(0,1));
1820 QTest::newRow(dataTag: "SmallestQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: SmallestCoordQPoint)
1821 << QRect(QPoint(1,INT_MIN), QPoint(INT_MIN,1));
1822 QTest::newRow(dataTag: "SmallestQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1823 << QRect(QPoint(1,INT_MIN/2), QPoint(INT_MIN/2,1));
1824 QTest::newRow(dataTag: "SmallestQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1825 << QRect(QPoint(1,INT_MAX/2), QPoint(INT_MAX/2,1));
1826 QTest::newRow(dataTag: "SmallestQRect_LargestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: LargestCoordQPoint)
1827 << QRect(QPoint(1,INT_MAX), QPoint(INT_MAX,1));
1828 QTest::newRow(dataTag: "SmallestQRect_NegXQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegXQPoint)
1829 << QRect(QPoint(1,7), QPoint(-12,1));
1830 QTest::newRow(dataTag: "SmallestQRect_NegYQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegYQPoint)
1831 << QRect(QPoint(1,-7), QPoint(12,1));
1832 QTest::newRow(dataTag: "SmallestQRect_RandomQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: RandomQPoint)
1833 << QRect(QPoint(1,7), QPoint(12,1));
1834 }
1835
1836 {
1837 QTest::newRow(dataTag: "MiddleQRect_NullQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NullQPoint)
1838 << QRect(QPoint(INT_MIN/2,0),QPoint(0,INT_MAX/2));
1839 QTest::newRow(dataTag: "MiddleQRect_SmallestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: SmallestCoordQPoint)
1840 << QRect(QPoint(INT_MIN/2,INT_MIN),QPoint(INT_MIN,INT_MAX/2));
1841 QTest::newRow(dataTag: "MiddleQRect_MiddleNegCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1842 << QRect(QPoint(INT_MIN/2,INT_MIN/2),QPoint(INT_MIN/2,INT_MAX/2));
1843 QTest::newRow(dataTag: "MiddleQRect_MiddlePosCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1844 << QRect(QPoint(INT_MIN/2,INT_MAX/2),QPoint(INT_MAX/2,INT_MAX/2));
1845 QTest::newRow(dataTag: "MiddleQRect_LargestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: LargestCoordQPoint)
1846 << QRect(QPoint(INT_MIN/2,INT_MAX),QPoint(INT_MAX,INT_MAX/2));
1847 QTest::newRow(dataTag: "MiddleQRect_NegXQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegXQPoint)
1848 << QRect(QPoint(INT_MIN/2,7),QPoint(-12,INT_MAX/2));
1849 QTest::newRow(dataTag: "MiddleQRect_NegYQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegYQPoint)
1850 << QRect(QPoint(INT_MIN/2,-7),QPoint(12,INT_MAX/2));
1851 QTest::newRow(dataTag: "MiddleQRect_RandomQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: RandomQPoint)
1852 << QRect(QPoint(INT_MIN/2,7),QPoint(12,INT_MAX/2));
1853 }
1854
1855 {
1856 QTest::newRow(dataTag: "LargestQRect_NullQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NullQPoint)
1857 << QRect(QPoint(0,0),QPoint(0,INT_MAX-1));
1858 QTest::newRow(dataTag: "LargestQRect_SmallestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: SmallestCoordQPoint)
1859 << QRect(QPoint(0,INT_MIN),QPoint(INT_MIN,INT_MAX-1));
1860 QTest::newRow(dataTag: "LargestQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1861 << QRect(QPoint(0,INT_MIN/2),QPoint(INT_MIN/2,INT_MAX-1));
1862 QTest::newRow(dataTag: "LargestQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1863 << QRect(QPoint(0,INT_MAX/2),QPoint(INT_MAX/2,INT_MAX-1));
1864 QTest::newRow(dataTag: "LargestQRect_LargestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: LargestCoordQPoint)
1865 << QRect(QPoint(0,INT_MAX),QPoint(INT_MAX,INT_MAX-1));
1866 QTest::newRow(dataTag: "LargestQRect_NegXQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegXQPoint)
1867 << QRect(QPoint(0,7),QPoint(-12,INT_MAX-1));
1868 QTest::newRow(dataTag: "LargestQRect_NegYQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegYQPoint)
1869 << QRect(QPoint(0,-7),QPoint(12,INT_MAX-1));
1870 QTest::newRow(dataTag: "LargestQRect_RandomQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: RandomQPoint)
1871 << QRect(QPoint(0,7),QPoint(12,INT_MAX-1));
1872 }
1873
1874 {
1875 QTest::newRow(dataTag: "SmallestCoordQRect_NullQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NullQPoint)
1876 << QRect(QPoint(INT_MIN,0),QPoint(0,INT_MIN));
1877 QTest::newRow(dataTag: "SmallestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
1878 << QRect(QPoint(INT_MIN,INT_MIN),QPoint(INT_MIN,INT_MIN));
1879 QTest::newRow(dataTag: "SmallestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1880 << QRect(QPoint(INT_MIN,INT_MIN/2),QPoint(INT_MIN/2,INT_MIN));
1881 QTest::newRow(dataTag: "SmallestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1882 << QRect(QPoint(INT_MIN,INT_MAX/2),QPoint(INT_MAX/2,INT_MIN));
1883 QTest::newRow(dataTag: "SmallestCoordQRect_LargestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
1884 << QRect(QPoint(INT_MIN,INT_MAX),QPoint(INT_MAX,INT_MIN));
1885 QTest::newRow(dataTag: "SmallestCoordQRect_NegXQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegXQPoint)
1886 << QRect(QPoint(INT_MIN,7),QPoint(-12,INT_MIN));
1887 QTest::newRow(dataTag: "SmallestCoordQRect_NegYQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegYQPoint)
1888 << QRect(QPoint(INT_MIN,-7),QPoint(12,INT_MIN));
1889 QTest::newRow(dataTag: "SmallestCoordQRect_RandomQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: RandomQPoint)
1890 << QRect(QPoint(INT_MIN,7),QPoint(12,INT_MIN));
1891 }
1892
1893 {
1894 QTest::newRow(dataTag: "LargestCoordQRect_NullQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NullQPoint)
1895 << QRect(QPoint(INT_MIN,0),QPoint(0,INT_MAX));
1896 QTest::newRow(dataTag: "LargestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
1897 << QRect(QPoint(INT_MIN,INT_MIN),QPoint(INT_MIN,INT_MAX));
1898 QTest::newRow(dataTag: "LargestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1899 << QRect(QPoint(INT_MIN,INT_MIN/2),QPoint(INT_MIN/2,INT_MAX));
1900 QTest::newRow(dataTag: "LargestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1901 << QRect(QPoint(INT_MIN,INT_MAX/2),QPoint(INT_MAX/2,INT_MAX));
1902 QTest::newRow(dataTag: "LargestCoordQRect_LargestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
1903 << QRect(QPoint(INT_MIN,INT_MAX),QPoint(INT_MAX,INT_MAX));
1904 QTest::newRow(dataTag: "LargestCoordQRect_NegXQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegXQPoint)
1905 << QRect(QPoint(INT_MIN,7),QPoint(-12,INT_MAX));
1906 QTest::newRow(dataTag: "LargestCoordQRect_NegYQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegYQPoint)
1907 << QRect(QPoint(INT_MIN,-7),QPoint(12,INT_MAX));
1908 QTest::newRow(dataTag: "LargestCoordQRect_RandomQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: RandomQPoint)
1909 << QRect(QPoint(INT_MIN,7),QPoint(12,INT_MAX));
1910 }
1911
1912 {
1913 QTest::newRow(dataTag: "RandomQRect_NullQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NullQPoint)
1914 << QRect(QPoint(100,0),QPoint(0,215));
1915 QTest::newRow(dataTag: "RandomQRect_SmallestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: SmallestCoordQPoint)
1916 << QRect(QPoint(100,INT_MIN),QPoint(INT_MIN,215));
1917 QTest::newRow(dataTag: "RandomQRect_MiddleNegCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1918 << QRect(QPoint(100,INT_MIN/2),QPoint(INT_MIN/2,215));
1919 QTest::newRow(dataTag: "RandomQRect_MiddlePosCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1920 << QRect(QPoint(100,INT_MAX/2),QPoint(INT_MAX/2,215));
1921 QTest::newRow(dataTag: "RandomQRect_LargestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: LargestCoordQPoint)
1922 << QRect(QPoint(100,INT_MAX),QPoint(INT_MAX,215));
1923 QTest::newRow(dataTag: "RandomQRect_NegXQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegXQPoint)
1924 << QRect(QPoint(100,7),QPoint(-12,215));
1925 QTest::newRow(dataTag: "RandomQRect_NegYQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegYQPoint)
1926 << QRect(QPoint(100,-7),QPoint(12,215));
1927 QTest::newRow(dataTag: "RandomQRect_RandomQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: RandomQPoint)
1928 << QRect(QPoint(100,7),QPoint(12,215));
1929 }
1930
1931 {
1932 QTest::newRow(dataTag: "NegativeSizeQRect_NullQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NullQPoint)
1933 << QRect(QPoint(1, 0),QPoint(0,-10));
1934 QTest::newRow(dataTag: "NegativeSizeQRect_SmallestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: SmallestCoordQPoint)
1935 << QRect(QPoint(1, INT_MIN),QPoint(INT_MIN,-10));
1936 QTest::newRow(dataTag: "NegativeSizeQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1937 << QRect(QPoint(1, INT_MIN/2),QPoint(INT_MIN/2,-10));
1938 QTest::newRow(dataTag: "NegativeSizeQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1939 << QRect(QPoint(1, INT_MAX/2),QPoint(INT_MAX/2,-10));
1940 QTest::newRow(dataTag: "NegativeSizeQRect_LargestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: LargestCoordQPoint)
1941 << QRect(QPoint(1, INT_MAX),QPoint(INT_MAX,-10));
1942 QTest::newRow(dataTag: "NegativeSizeQRect_NegXQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegXQPoint)
1943 << QRect(QPoint(1, 7),QPoint(-12,-10));
1944 QTest::newRow(dataTag: "NegativeSizeQRect_NegYQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegYQPoint)
1945 << QRect(QPoint(1, -7),QPoint(12,-10));
1946 QTest::newRow(dataTag: "NegativeSizeQRect_RandomQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: RandomQPoint)
1947 << QRect(QPoint(1, 7),QPoint(12,-10));
1948 }
1949
1950 {
1951 QTest::newRow(dataTag: "NegativePointQRect_NullQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NullQPoint)
1952 << QRect(QPoint(-10,0),QPoint(0,-6));
1953 QTest::newRow(dataTag: "NegativePointQRect_SmallestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: SmallestCoordQPoint)
1954 << QRect(QPoint(-10,INT_MIN),QPoint(INT_MIN,-6));
1955 QTest::newRow(dataTag: "NegativePointQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1956 << QRect(QPoint(-10,INT_MIN/2),QPoint(INT_MIN/2,-6));
1957 QTest::newRow(dataTag: "NegativePointQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1958 << QRect(QPoint(-10,INT_MAX/2),QPoint(INT_MAX/2,-6));
1959 QTest::newRow(dataTag: "NegativePointQRect_LargestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: LargestCoordQPoint)
1960 << QRect(QPoint(-10,INT_MAX),QPoint(INT_MAX,-6));
1961 QTest::newRow(dataTag: "NegativePointQRect_NegXQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegXQPoint)
1962 << QRect(QPoint(-10,7),QPoint(-12,-6));
1963 QTest::newRow(dataTag: "NegativePointQRect_NegYQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegYQPoint)
1964 << QRect(QPoint(-10,-7),QPoint(12,-6));
1965 QTest::newRow(dataTag: "NegativePointQRect_RandomQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: RandomQPoint)
1966 << QRect(QPoint(-10,7),QPoint(12,-6));
1967 }
1968
1969 {
1970 QTest::newRow(dataTag: "NullQRect_NullQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NullQPoint)
1971 << QRect(QPoint(5,0),QPoint(0,4));
1972 QTest::newRow(dataTag: "NullQRect_SmallestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: SmallestCoordQPoint)
1973 << QRect(QPoint(5,INT_MIN),QPoint(INT_MIN,4));
1974 QTest::newRow(dataTag: "NullQRect_MiddleNegCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1975 << QRect(QPoint(5,INT_MIN/2),QPoint(INT_MIN/2,4));
1976 QTest::newRow(dataTag: "NullQRect_MiddlePosCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1977 << QRect(QPoint(5,INT_MAX/2),QPoint(INT_MAX/2,4));
1978 QTest::newRow(dataTag: "NullQRect_LargestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: LargestCoordQPoint)
1979 << QRect(QPoint(5,INT_MAX),QPoint(INT_MAX,4));
1980 QTest::newRow(dataTag: "NullQRect_NegXQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegXQPoint)
1981 << QRect(QPoint(5,7),QPoint(-12,4));
1982 QTest::newRow(dataTag: "NullQRect_NegYQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegYQPoint)
1983 << QRect(QPoint(5,-7),QPoint(12,4));
1984 QTest::newRow(dataTag: "NullQRect_RandomQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: RandomQPoint)
1985 << QRect(QPoint(5,7),QPoint(12,4));
1986 }
1987
1988 {
1989 QTest::newRow(dataTag: "EmptyQRect_NullQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NullQPoint)
1990 << QRect(QPoint(2,0),QPoint(0,1));
1991 QTest::newRow(dataTag: "EmptyQRect_SmallestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: SmallestCoordQPoint)
1992 << QRect(QPoint(2,INT_MIN),QPoint(INT_MIN,1));
1993 QTest::newRow(dataTag: "EmptyQRect_MiddleNegCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddleNegCoordQPoint)
1994 << QRect(QPoint(2,INT_MIN/2),QPoint(INT_MIN/2,1));
1995 QTest::newRow(dataTag: "EmptyQRect_MiddlePosCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddlePosCoordQPoint)
1996 << QRect(QPoint(2,INT_MAX/2),QPoint(INT_MAX/2,1));
1997 QTest::newRow(dataTag: "EmptyQRect_LargestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: LargestCoordQPoint)
1998 << QRect(QPoint(2,INT_MAX),QPoint(INT_MAX,1));
1999 QTest::newRow(dataTag: "EmptyQRect_NegXQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegXQPoint)
2000 << QRect(QPoint(2,7),QPoint(-12,1));
2001 QTest::newRow(dataTag: "EmptyQRect_NegYQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegYQPoint)
2002 << QRect(QPoint(2,-7),QPoint(12,1));
2003 QTest::newRow(dataTag: "EmptyQRect_RandomQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: RandomQPoint)
2004 << QRect(QPoint(2,7),QPoint(12,1));
2005 }
2006}
2007
2008void tst_QRect::newSetTopRight()
2009{
2010 QFETCH( QRect, r );
2011 QFETCH( QPoint, topRight );
2012 QFETCH( QRect, nr );
2013
2014 r.setTopRight( topRight );
2015
2016 QCOMPARE( r, nr );
2017}
2018
2019void tst_QRect::newSetBottomLeft_data()
2020{
2021 QTest::addColumn<QRect>(name: "r");
2022 QTest::addColumn<QPoint>(name: "bottomLeft");
2023 QTest::addColumn<QRect>(name: "nr");
2024
2025 {
2026 QTest::newRow(dataTag: "InvalidQRect_NullQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NullQPoint)
2027 << QRect(QPoint(0,0),QPoint(-1,0));
2028 QTest::newRow(dataTag: "InvalidQRect_SmallestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: SmallestCoordQPoint)
2029 << QRect(QPoint(INT_MIN,0),QPoint(-1,INT_MIN));
2030 QTest::newRow(dataTag: "InvalidQRect_MiddleNegCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2031 << QRect(QPoint(INT_MIN/2,0),QPoint(-1,INT_MIN/2));
2032 QTest::newRow(dataTag: "InvalidQRect_MiddlePosCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2033 << QRect(QPoint(INT_MAX/2,0),QPoint(-1,INT_MAX/2));
2034 QTest::newRow(dataTag: "InvalidQRect_LargestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: LargestCoordQPoint)
2035 << QRect(QPoint(INT_MAX,0),QPoint(-1,INT_MAX));
2036 QTest::newRow(dataTag: "InvalidQRect_NegXQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegXQPoint)
2037 << QRect(QPoint(-12,0),QPoint(-1,7));
2038 QTest::newRow(dataTag: "InvalidQRect_NegYQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegYQPoint)
2039 << QRect(QPoint(12,0),QPoint(-1,-7));
2040 QTest::newRow(dataTag: "InvalidQRect_RandomQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: RandomQPoint)
2041 << QRect(QPoint(12,0),QPoint(-1,7));
2042 }
2043
2044 {
2045 QTest::newRow(dataTag: "SmallestQRect_NullQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NullQPoint)
2046 << QRect(QPoint(0,1),QPoint(1,0));
2047 QTest::newRow(dataTag: "SmallestQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: SmallestCoordQPoint)
2048 << QRect(QPoint(INT_MIN,1),QPoint(1,INT_MIN));
2049 QTest::newRow(dataTag: "SmallestQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2050 << QRect(QPoint(INT_MIN/2,1),QPoint(1,INT_MIN/2));
2051 QTest::newRow(dataTag: "SmallestQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2052 << QRect(QPoint(INT_MAX/2,1), QPoint(1,INT_MAX/2));
2053 QTest::newRow(dataTag: "SmallestQRect_LargestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: LargestCoordQPoint)
2054 << QRect(QPoint(INT_MAX,1), QPoint(1,INT_MAX));
2055 QTest::newRow(dataTag: "SmallestQRect_NegXQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegXQPoint)
2056 << QRect(QPoint(-12,1),QPoint(1,7));
2057 QTest::newRow(dataTag: "SmallestQRect_NegYQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegYQPoint)
2058 << QRect(QPoint(12,1),QPoint(1,-7));
2059 QTest::newRow(dataTag: "SmallestQRect_RandomQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: RandomQPoint)
2060 << QRect(QPoint(12,1),QPoint(1,7));
2061 }
2062
2063 {
2064 QTest::newRow(dataTag: "MiddleQRect_NullQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NullQPoint)
2065 << QRect(QPoint(0,INT_MIN/2),QPoint(INT_MAX/2,0));
2066 QTest::newRow(dataTag: "MiddleQRect_SmallestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: SmallestCoordQPoint)
2067 << QRect(QPoint(INT_MIN,INT_MIN/2),QPoint(INT_MAX/2,INT_MIN));
2068 QTest::newRow(dataTag: "MiddleQRect_MiddleNegCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2069 << QRect(QPoint(INT_MIN/2,INT_MIN/2),QPoint(INT_MAX/2,INT_MIN/2));
2070 QTest::newRow(dataTag: "MiddleQRect_MiddlePosCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2071 << QRect(QPoint(INT_MAX/2,INT_MIN/2),QPoint(INT_MAX/2,INT_MAX/2));
2072 QTest::newRow(dataTag: "MiddleQRect_LargestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: LargestCoordQPoint)
2073 << QRect(QPoint(INT_MAX,INT_MIN/2),QPoint(INT_MAX/2,INT_MAX));
2074 QTest::newRow(dataTag: "MiddleQRect_NegXQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegXQPoint)
2075 << QRect(QPoint(-12,INT_MIN/2),QPoint(INT_MAX/2,7));
2076 QTest::newRow(dataTag: "MiddleQRect_NegYQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NegYQPoint)
2077 << QRect(QPoint(12,INT_MIN/2),QPoint(INT_MAX/2,-7));
2078 QTest::newRow(dataTag: "MiddleQRect_RandomQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: RandomQPoint)
2079 << QRect(QPoint(12,INT_MIN/2),QPoint(INT_MAX/2,7));
2080 }
2081
2082 {
2083 QTest::newRow(dataTag: "LargestQRect_NullQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NullQPoint)
2084 << QRect(QPoint(0,0),QPoint(INT_MAX-1,0));
2085 QTest::newRow(dataTag: "LargestQRect_SmallestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: SmallestCoordQPoint)
2086 << QRect(QPoint(INT_MIN,0),QPoint(INT_MAX-1,INT_MIN));
2087 QTest::newRow(dataTag: "LargestQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2088 << QRect(QPoint(INT_MIN/2,0),QPoint(INT_MAX-1,INT_MIN/2));
2089 QTest::newRow(dataTag: "LargestQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2090 << QRect(QPoint(INT_MAX/2,0),QPoint(INT_MAX-1,INT_MAX/2));
2091 QTest::newRow(dataTag: "LargestQRect_LargestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: LargestCoordQPoint)
2092 << QRect(QPoint(INT_MAX,0),QPoint(INT_MAX-1,INT_MAX));
2093 QTest::newRow(dataTag: "LargestQRect_NegXQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegXQPoint)
2094 << QRect(QPoint(-12,0),QPoint(INT_MAX-1,7));
2095 QTest::newRow(dataTag: "LargestQRect_NegYQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NegYQPoint)
2096 << QRect(QPoint(12,0),QPoint(INT_MAX-1,-7));
2097 QTest::newRow(dataTag: "LargestQRect_RandomQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: RandomQPoint)
2098 << QRect(QPoint(12,0),QPoint(INT_MAX-1,7));
2099 }
2100
2101 {
2102 QTest::newRow(dataTag: "SmallestCoordQRect_NullQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NullQPoint)
2103 << QRect(QPoint(0,INT_MIN),QPoint(INT_MIN,0));
2104 QTest::newRow(dataTag: "SmallestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
2105 << QRect(QPoint(INT_MIN,INT_MIN),QPoint(INT_MIN,INT_MIN));
2106 QTest::newRow(dataTag: "SmallestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2107 << QRect(QPoint(INT_MIN/2,INT_MIN),QPoint(INT_MIN,INT_MIN/2));
2108 QTest::newRow(dataTag: "SmallestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2109 << QRect(QPoint(INT_MAX/2,INT_MIN),QPoint(INT_MIN,INT_MAX/2));
2110 QTest::newRow(dataTag: "SmallestCoordQRect_LargestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
2111 << QRect(QPoint(INT_MAX,INT_MIN),QPoint(INT_MIN,INT_MAX));
2112 QTest::newRow(dataTag: "SmallestCoordQRect_NegXQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegXQPoint)
2113 << QRect(QPoint(-12,INT_MIN),QPoint(INT_MIN,7));
2114 QTest::newRow(dataTag: "SmallestCoordQRect_NegYQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: NegYQPoint)
2115 << QRect(QPoint(12,INT_MIN),QPoint(INT_MIN,-7));
2116 QTest::newRow(dataTag: "SmallestCoordQRect_RandomQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: RandomQPoint)
2117 << QRect(QPoint(12,INT_MIN),QPoint(INT_MIN,7));
2118 }
2119
2120 {
2121 QTest::newRow(dataTag: "LargestCoordQRect_NullQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NullQPoint)
2122 << QRect(QPoint(0,INT_MIN),QPoint(INT_MAX,0));
2123 QTest::newRow(dataTag: "LargestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
2124 << QRect(QPoint(INT_MIN,INT_MIN),QPoint(INT_MAX,INT_MIN));
2125 QTest::newRow(dataTag: "LargestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2126 << QRect(QPoint(INT_MIN/2,INT_MIN),QPoint(INT_MAX,INT_MIN/2));
2127 QTest::newRow(dataTag: "LargestCoordQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2128 << QRect(QPoint(INT_MAX/2,INT_MIN),QPoint(INT_MAX,INT_MAX/2));
2129 QTest::newRow(dataTag: "LargestCoordQRect_LargestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
2130 << QRect(QPoint(INT_MAX,INT_MIN),QPoint(INT_MAX,INT_MAX));
2131 QTest::newRow(dataTag: "LargestCoordQRect_NegXQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegXQPoint)
2132 << QRect(QPoint(-12,INT_MIN),QPoint(INT_MAX,7));
2133 QTest::newRow(dataTag: "LargestCoordQRect_NegYQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: NegYQPoint)
2134 << QRect(QPoint(12,INT_MIN),QPoint(INT_MAX,-7));
2135 QTest::newRow(dataTag: "LargestCoordQRect_RandomQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: RandomQPoint)
2136 << QRect(QPoint(12,INT_MIN),QPoint(INT_MAX,7));
2137 }
2138
2139 {
2140 QTest::newRow(dataTag: "RandomQRect_NullQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NullQPoint)
2141 << QRect(QPoint(0,200),QPoint(110,0));
2142 QTest::newRow(dataTag: "RandomQRect_SmallestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: SmallestCoordQPoint)
2143 << QRect(QPoint(INT_MIN,200),QPoint(110,INT_MIN));
2144 QTest::newRow(dataTag: "RandomQRect_MiddleNegCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2145 << QRect(QPoint(INT_MIN/2,200),QPoint(110,INT_MIN/2));
2146 QTest::newRow(dataTag: "RandomQRect_MiddlePosCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2147 << QRect(QPoint(INT_MAX/2,200),QPoint(110,INT_MAX/2));
2148 QTest::newRow(dataTag: "RandomQRect_LargestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: LargestCoordQPoint)
2149 << QRect(QPoint(INT_MAX,200),QPoint(110,INT_MAX));
2150 QTest::newRow(dataTag: "RandomQRect_NegXQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegXQPoint)
2151 << QRect(QPoint(-12,200),QPoint(110,7));
2152 QTest::newRow(dataTag: "RandomQRect_NegYQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegYQPoint)
2153 << QRect(QPoint(12,200),QPoint(110,-7));
2154 QTest::newRow(dataTag: "RandomQRect_RandomQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: RandomQPoint)
2155 << QRect(QPoint(12,200),QPoint(110,7));
2156 }
2157
2158 {
2159 QTest::newRow(dataTag: "NegativeSizeQRect_NullQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NullQPoint)
2160 << QRect(QPoint(0, 1),QPoint(-10,0));
2161 QTest::newRow(dataTag: "NegativeSizeQRect_SmallestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: SmallestCoordQPoint)
2162 << QRect(QPoint(INT_MIN, 1),QPoint(-10,INT_MIN));
2163 QTest::newRow(dataTag: "NegativeSizeQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2164 << QRect(QPoint(INT_MIN/2, 1),QPoint(-10,INT_MIN/2));
2165 QTest::newRow(dataTag: "NegativeSizeQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2166 << QRect(QPoint(INT_MAX/2, 1),QPoint(-10,INT_MAX/2));
2167 QTest::newRow(dataTag: "NegativeSizeQRect_LargestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: LargestCoordQPoint)
2168 << QRect(QPoint(INT_MAX, 1),QPoint(-10,INT_MAX));
2169 QTest::newRow(dataTag: "NegativeSizeQRect_NegXQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegXQPoint)
2170 << QRect(QPoint(-12, 1),QPoint(-10,7));
2171 QTest::newRow(dataTag: "NegativeSizeQRect_NegYQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegYQPoint)
2172 << QRect(QPoint(12, 1),QPoint(-10,-7));
2173 QTest::newRow(dataTag: "NegativeSizeQRect_RandomQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: RandomQPoint)
2174 << QRect(QPoint(12, 1),QPoint(-10,7));
2175 }
2176
2177 {
2178 QTest::newRow(dataTag: "NegativePointQRect_NullQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NullQPoint)
2179 << QRect(QPoint(0,-10),QPoint(-6,0));
2180 QTest::newRow(dataTag: "NegativePointQRect_SmallestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: SmallestCoordQPoint)
2181 << QRect(QPoint(INT_MIN,-10),QPoint(-6,INT_MIN));
2182 QTest::newRow(dataTag: "NegativePointQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2183 << QRect(QPoint(INT_MIN/2,-10),QPoint(-6,INT_MIN/2));
2184 QTest::newRow(dataTag: "NegativePointQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2185 << QRect(QPoint(INT_MAX/2,-10),QPoint(-6,INT_MAX/2));
2186 QTest::newRow(dataTag: "NegativePointQRect_LargestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: LargestCoordQPoint)
2187 << QRect(QPoint(INT_MAX,-10),QPoint(-6,INT_MAX));
2188 QTest::newRow(dataTag: "NegativePointQRect_NegXQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegXQPoint)
2189 << QRect(QPoint(-12,-10),QPoint(-6,7));
2190 QTest::newRow(dataTag: "NegativePointQRect_NegYQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegYQPoint)
2191 << QRect(QPoint(12,-10),QPoint(-6,-7));
2192 QTest::newRow(dataTag: "NegativePointQRect_RandomQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: RandomQPoint)
2193 << QRect(QPoint(12,-10),QPoint(-6,7));
2194 }
2195
2196 {
2197 QTest::newRow(dataTag: "NullQRect_NullQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NullQPoint)
2198 << QRect(QPoint(0,5),QPoint(4,0));
2199 QTest::newRow(dataTag: "NullQRect_SmallestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: SmallestCoordQPoint)
2200 << QRect(QPoint(INT_MIN,5),QPoint(4,INT_MIN));
2201 QTest::newRow(dataTag: "NullQRect_MiddleNegCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2202 << QRect(QPoint(INT_MIN/2,5),QPoint(4,INT_MIN/2));
2203 QTest::newRow(dataTag: "NullQRect_MiddlePosCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2204 << QRect(QPoint(INT_MAX/2,5),QPoint(4,INT_MAX/2));
2205 QTest::newRow(dataTag: "NullQRect_LargestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: LargestCoordQPoint)
2206 << QRect(QPoint(INT_MAX,5),QPoint(4,INT_MAX));
2207 QTest::newRow(dataTag: "NullQRect_NegXQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegXQPoint)
2208 << QRect(QPoint(-12,5),QPoint(4,7));
2209 QTest::newRow(dataTag: "NullQRect_NegYQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegYQPoint)
2210 << QRect(QPoint(12,5),QPoint(4,-7));
2211 QTest::newRow(dataTag: "NullQRect_RandomQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: RandomQPoint)
2212 << QRect(QPoint(12,5),QPoint(4,7));
2213 }
2214
2215 {
2216 QTest::newRow(dataTag: "EmptyQRect_NullQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NullQPoint)
2217 << QRect(QPoint(0,2),QPoint(1,0));
2218 QTest::newRow(dataTag: "EmptyQRect_SmallestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: SmallestCoordQPoint)
2219 << QRect(QPoint(INT_MIN,2),QPoint(1,INT_MIN));
2220 QTest::newRow(dataTag: "EmptyQRect_MiddleNegCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddleNegCoordQPoint)
2221 << QRect(QPoint(INT_MIN/2,2),QPoint(1,INT_MIN/2));
2222 QTest::newRow(dataTag: "EmptyQRect_MiddlePosCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddlePosCoordQPoint)
2223 << QRect(QPoint(INT_MAX/2,2),QPoint(1,INT_MAX/2));
2224 QTest::newRow(dataTag: "EmptyQRect_LargestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: LargestCoordQPoint)
2225 << QRect(QPoint(INT_MAX,2),QPoint(1,INT_MAX));
2226 QTest::newRow(dataTag: "EmptyQRect_NegXQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegXQPoint)
2227 << QRect(QPoint(-12,2),QPoint(1,7));
2228 QTest::newRow(dataTag: "EmptyQRect_NegYQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegYQPoint)
2229 << QRect(QPoint(12,2),QPoint(1,-7));
2230 QTest::newRow(dataTag: "EmptyQRect_RandomQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: RandomQPoint)
2231 << QRect(QPoint(12,2),QPoint(1,7));
2232 }
2233}
2234
2235void tst_QRect::newSetBottomLeft()
2236{
2237 QFETCH( QRect, r );
2238 QFETCH( QPoint, bottomLeft );
2239 QFETCH( QRect, nr );
2240
2241 r.setBottomLeft( bottomLeft );
2242
2243 QCOMPARE( r, nr );
2244}
2245
2246void tst_QRect::topLeft_data()
2247{
2248 QTest::addColumn<QRect>(name: "r");
2249 QTest::addColumn<QPoint>(name: "topLeft");
2250
2251 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << QPoint(0,0);
2252 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << QPoint(1,1);
2253 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << QPoint(INT_MIN/2,INT_MIN/2);
2254 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << QPoint(0,0);
2255 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << QPoint(INT_MIN,INT_MIN);
2256 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << QPoint(INT_MIN,INT_MIN);
2257 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << QPoint(100,200);
2258 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << QPoint(1,1);
2259 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << QPoint(-10,-10);
2260 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << QPoint(5,5);
2261 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << QPoint(2,2);
2262}
2263void tst_QRect::topLeft()
2264{
2265 QFETCH( QRect, r );
2266 QFETCH( QPoint, topLeft );
2267
2268 QCOMPARE( r.topLeft(), topLeft );
2269}
2270void tst_QRect::bottomRight_data()
2271{
2272 QTest::addColumn<QRect>(name: "r");
2273 QTest::addColumn<QPoint>(name: "bottomRight");
2274
2275 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << QPoint(-1,-1);
2276 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << QPoint(1,1);
2277 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << QPoint(INT_MAX/2,INT_MAX/2);
2278 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << QPoint(INT_MAX-1,INT_MAX-1);
2279 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << QPoint(INT_MIN,INT_MIN);
2280 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << QPoint(INT_MAX,INT_MAX);
2281 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << QPoint(110,215);
2282 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << QPoint(-10,-10);
2283 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << QPoint(-6,-6);
2284 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << QPoint(4,4);
2285 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << QPoint(1,1);
2286}
2287void tst_QRect::bottomRight()
2288{
2289 QFETCH( QRect, r );
2290 QFETCH( QPoint, bottomRight );
2291
2292 QCOMPARE( r.bottomRight(), bottomRight );
2293}
2294void tst_QRect::topRight_data()
2295{
2296 QTest::addColumn<QRect>(name: "r");
2297 QTest::addColumn<QPoint>(name: "topRight");
2298
2299 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << QPoint(-1,0);
2300 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << QPoint(1,1);
2301 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << QPoint(INT_MAX/2,INT_MIN/2);
2302 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << QPoint(INT_MAX-1,0);
2303 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << QPoint(INT_MIN,INT_MIN);
2304 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << QPoint(INT_MAX,INT_MIN);
2305 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << QPoint(110,200);
2306 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << QPoint(-10,1);
2307 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << QPoint(-6,-10);
2308 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << QPoint(4,5);
2309 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << QPoint(1,2);
2310}
2311void tst_QRect::topRight()
2312{
2313 QFETCH( QRect, r );
2314 QFETCH( QPoint, topRight );
2315
2316 QCOMPARE( r.topRight(), topRight );
2317}
2318void tst_QRect::bottomLeft_data()
2319{
2320 QTest::addColumn<QRect>(name: "r");
2321 QTest::addColumn<QPoint>(name: "bottomLeft");
2322
2323 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << QPoint(0,-1);
2324 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << QPoint(1,1);
2325 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << QPoint(INT_MIN/2,INT_MAX/2);
2326 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << QPoint(0,INT_MAX-1);
2327 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << QPoint(INT_MIN,INT_MIN);
2328 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << QPoint(INT_MIN,INT_MAX);
2329 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << QPoint(100,215);
2330 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << QPoint(1,-10);
2331 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << QPoint(-10,-6);
2332 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << QPoint(5,4);
2333 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << QPoint(2,1);
2334}
2335void tst_QRect::bottomLeft()
2336{
2337 QFETCH( QRect, r );
2338 QFETCH( QPoint, bottomLeft );
2339
2340 QCOMPARE( r.bottomLeft(), bottomLeft );
2341}
2342void tst_QRect::center_data()
2343{
2344 QTest::addColumn<QRect>(name: "r");
2345 QTest::addColumn<QPoint>(name: "center");
2346
2347 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << QPoint(0,0);
2348 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << QPoint(1,1);
2349 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << QPoint(0,0);
2350 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << QPoint(INT_MAX/2,INT_MAX/2);
2351 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << QPoint(INT_MIN, INT_MIN);
2352 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << QPoint(0,0);
2353 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << QPoint(105,207);
2354 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << QPoint(-4,-4);
2355 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << QPoint(-8,-8);
2356 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << QPoint(4,4);
2357 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << QPoint(1,1);
2358}
2359void tst_QRect::center()
2360{
2361 QFETCH( QRect, r );
2362 QFETCH( QPoint, center );
2363
2364 QCOMPARE( r.center(), center );
2365}
2366
2367void tst_QRect::getRect_data()
2368{
2369 QTest::addColumn<QRect>(name: "r");
2370 QTest::addColumn<int>(name: "x");
2371 QTest::addColumn<int>(name: "y");
2372 QTest::addColumn<int>(name: "w");
2373 QTest::addColumn<int>(name: "h");
2374
2375 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << 0 << 0 << 0 << 0;
2376 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1 << 1 << 1 << 1;
2377 // QTest::newRow( "MiddleQRect" ) -- Not tested as this would cause an overflow
2378 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << 0 << 0 << int(INT_MAX) << int(INT_MAX);
2379 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN) << int(INT_MIN) << 1 << 1;
2380 // QTest::newRow( "LargestCoordQRect" ) -- Not tested as this would cause an overflow
2381 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 100 << 200 << 11 << 16;
2382 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << 1 << 1 << -10 << -10;
2383 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -10 << -10 << 5 << 5;
2384 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << 5 << 5 << 0 << 0;
2385 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 2 << 2 << 0 << 0;
2386}
2387
2388void tst_QRect::getRect()
2389{
2390 QFETCH( QRect, r );
2391 QFETCH( int, x );
2392 QFETCH( int, y );
2393 QFETCH( int, w );
2394 QFETCH( int, h );
2395
2396 int x2, y2, w2, h2;
2397 r.getRect( ax: &x2, ay: &y2, aw: &w2, ah: &h2 );
2398
2399 QVERIFY( x == x2 );
2400 QVERIFY( y == y2 );
2401 QVERIFY( w == w2 );
2402 QVERIFY( h == h2 );
2403}
2404
2405void tst_QRect::getCoords_data()
2406{
2407 QTest::addColumn<QRect>(name: "r");
2408 QTest::addColumn<int>(name: "xp1");
2409 QTest::addColumn<int>(name: "yp1");
2410 QTest::addColumn<int>(name: "xp2");
2411 QTest::addColumn<int>(name: "yp2");
2412
2413 QTest::newRow( dataTag: "InvalidQRect" ) << getQRectCase( c: InvalidQRect ) << 0 << 0 << -1 << -1;
2414 QTest::newRow( dataTag: "SmallestQRect" ) << getQRectCase( c: SmallestQRect ) << 1 << 1 << 1 << 1;
2415 QTest::newRow( dataTag: "MiddleQRect" ) << getQRectCase( c: MiddleQRect ) << int(INT_MIN)/2 << int(INT_MIN)/2 << int(INT_MAX)/2 << int(INT_MAX)/2;
2416 QTest::newRow( dataTag: "LargestQRect" ) << getQRectCase( c: LargestQRect ) << 0 << 0 << int(INT_MAX)-1 << int(INT_MAX)-1;
2417 QTest::newRow( dataTag: "SmallestCoordQRect" ) << getQRectCase( c: SmallestCoordQRect ) << int(INT_MIN) << int(INT_MIN) << int(INT_MIN) << int(INT_MIN);
2418 QTest::newRow( dataTag: "LargestCoordQRect" ) << getQRectCase( c: LargestCoordQRect ) << int(INT_MIN) << int(INT_MIN) << int(INT_MAX) << int(INT_MAX);
2419 QTest::newRow( dataTag: "RandomQRect" ) << getQRectCase( c: RandomQRect ) << 100 << 200 << 110 << 215;
2420 QTest::newRow( dataTag: "NegativeSizeQRect" ) << getQRectCase( c: NegativeSizeQRect ) << 1 << 1 << -10 << -10;
2421 QTest::newRow( dataTag: "NegativePointQRect" ) << getQRectCase( c: NegativePointQRect ) << -10 << -10 << -6 << -6;
2422 QTest::newRow( dataTag: "NullQRect" ) << getQRectCase( c: NullQRect ) << 5 << 5 << 4 << 4;
2423 QTest::newRow( dataTag: "EmptyQRect" ) << getQRectCase( c: EmptyQRect ) << 2 << 2 << 1 << 1;
2424}
2425
2426void tst_QRect::getCoords()
2427{
2428 QFETCH( QRect, r );
2429 QFETCH( int, xp1 );
2430 QFETCH( int, yp1 );
2431 QFETCH( int, xp2 );
2432 QFETCH( int, yp2 );
2433
2434 int xp12, yp12, xp22, yp22;
2435 r.getCoords( xp1: &xp12, yp1: &yp12, xp2: &xp22, yp2: &yp22 );
2436
2437 QVERIFY( xp1 == xp12 );
2438 QVERIFY( yp1 == yp12 );
2439 QVERIFY( xp2 == xp22 );
2440 QVERIFY( yp2 == yp22 );
2441}
2442
2443void tst_QRect::newMoveLeft_data()
2444{
2445 QTest::addColumn<QRect>(name: "r");
2446 QTest::addColumn<int>(name: "left");
2447 QTest::addColumn<QRect>(name: "nr");
2448
2449 {
2450 // QTest::newRow( "InvalidQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2451 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
2452 << QRect( QPoint(INT_MIN/2,0), QPoint(INT_MIN/2-1,-1) );
2453 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
2454 << QRect( QPoint(0,0), QPoint(-1,-1) );
2455 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
2456 << QRect( QPoint(INT_MAX/2,0), QPoint(INT_MAX/2-1,-1) );
2457 QTest::newRow( dataTag: "InvalidQRect_MaximumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MaximumInt )
2458 << QRect( QPoint(INT_MAX,0), QPoint(INT_MAX-1,-1) );
2459 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
2460 << QRect( QPoint(4953,0), QPoint(4952,-1) );
2461 }
2462
2463 {
2464 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
2465 << QRect( QPoint(INT_MIN,1), QPoint(INT_MIN,1) );
2466 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
2467 << QRect( QPoint(INT_MIN/2,1), QPoint(INT_MIN/2,1) );
2468 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
2469 << QRect( QPoint(0,1), QPoint(0,1) );
2470 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
2471 << QRect( QPoint(INT_MAX/2,1), QPoint(INT_MAX/2,1) );
2472 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
2473 << QRect( QPoint(INT_MAX,1), QPoint(INT_MAX,1) );
2474 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
2475 << QRect( QPoint(4953,1), QPoint(4953,1) );
2476 }
2477
2478 {
2479 QTest::newRow( dataTag: "MiddleQRect_MinimumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MinimumInt )
2480 << QRect( QPoint(INT_MIN, INT_MIN / 2 ), QPoint( (INT_MAX/2)+(INT_MIN-INT_MIN/2), INT_MAX / 2 ) );
2481 QTest::newRow( dataTag: "MiddleQRect_MiddleNegativeInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddleNegativeInt )
2482 << QRect( QPoint(INT_MIN/2, INT_MIN / 2 ), QPoint((INT_MAX/2)+(INT_MIN/2-INT_MIN/2), INT_MAX / 2 ) );
2483 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
2484 << QRect( QPoint(0, INT_MIN / 2 ), QPoint((INT_MAX/2)+(0-INT_MIN/2),INT_MAX/2));
2485 // QTest::newRow( "MiddleQRect_MiddlePositiveInt" ) -- Not tested as it would cause an overflow
2486 // QTest::newRow( "MiddleQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2487 // QTest::newRow( "MiddleQRect_RandomInt" ) -- Not tested as it would cause an overflow
2488 }
2489
2490 {
2491 QTest::newRow( dataTag: "LargestQRect_MinimumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MinimumInt )
2492 << QRect( QPoint(INT_MIN, 0), QPoint((INT_MAX-1)+INT_MIN, INT_MAX - 1 ) );
2493 QTest::newRow( dataTag: "LargestQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddleNegativeInt )
2494 << QRect( QPoint(INT_MIN/2, 0), QPoint((INT_MAX-1)+(INT_MIN/2), INT_MAX - 1 ) );
2495 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
2496 << QRect( QPoint(0, 0), QPoint(INT_MAX-1,INT_MAX - 1 ) );
2497 // QTest::newRow( "LargestQRect_MiddlePositiveInt" ) -- Not tested as it would cause an overflow
2498 // QTest::newRow( "LargestQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2499 // QTest::newRow( "LargestQRect_RandomInt" ) -- Not tested as it would cause an overflow
2500 }
2501
2502 {
2503 // QTest::newRow( "SmallestCoordQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2504 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
2505 << QRect( QPoint( INT_MIN/2, INT_MIN ), QPoint(INT_MIN/2, INT_MIN ) );
2506 QTest::newRow( dataTag: "SmallestCoordQRect_ZeroInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: ZeroInt )
2507 << QRect( QPoint( 0, INT_MIN ), QPoint(0, INT_MIN ) );
2508 QTest::newRow( dataTag: "SmallestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
2509 << QRect( QPoint( INT_MAX/2, INT_MIN ), QPoint(INT_MAX/2, INT_MIN ) );
2510 QTest::newRow( dataTag: "SmallestCoordQRect_MaximumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MaximumInt )
2511 << QRect( QPoint( INT_MAX, INT_MIN ), QPoint(INT_MAX, INT_MIN ) );
2512 QTest::newRow( dataTag: "SmallestCoordQRect_RandomInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: RandomInt )
2513 << QRect( QPoint( 4953, INT_MIN ), QPoint(4953, INT_MIN ) );
2514 }
2515
2516 {
2517 // QTest::newRow( "LargestCoordQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2518 QTest::newRow( dataTag: "LargestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
2519 << QRect( QPoint( INT_MIN/2, INT_MIN ), QPoint(INT_MIN/2-1, INT_MAX ) );
2520 QTest::newRow( dataTag: "LargestCoordQRect_ZeroInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: ZeroInt )
2521 << QRect( QPoint( 0, INT_MIN ), QPoint(-1, INT_MAX ) );
2522 QTest::newRow( dataTag: "LargestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
2523 << QRect( QPoint( INT_MAX/2, INT_MIN ), QPoint(INT_MAX/2-1, INT_MAX ) );
2524 QTest::newRow( dataTag: "LargestCoordQRect_MaximumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MaximumInt )
2525 << QRect( QPoint( INT_MAX, INT_MIN ), QPoint(INT_MAX-1, INT_MAX ) );
2526 QTest::newRow( dataTag: "LargestCoordQRect_RandomInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: RandomInt )
2527 << QRect( QPoint( 4953, INT_MIN ), QPoint(4952, INT_MAX ) );
2528 }
2529
2530 {
2531 QTest::newRow( dataTag: "RandomQRect_MinimumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MinimumInt )
2532 << QRect( QPoint( INT_MIN, 200 ), QPoint(10+INT_MIN, 215 ) );
2533 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
2534 << QRect( QPoint( INT_MIN/2, 200 ), QPoint(10+INT_MIN/2, 215 ) );
2535 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
2536 << QRect( QPoint( 0, 200 ), QPoint(10, 215 ) );
2537 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
2538 << QRect( QPoint( INT_MAX/2, 200 ), QPoint(10+INT_MAX/2, 215 ) );
2539 // QTest::newRow( "RandomQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2540 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
2541 << QRect( QPoint( 4953, 200 ), QPoint(4963, 215 ) );
2542 }
2543
2544 {
2545 // QTest::newRow( "NegativeSizeQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2546 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
2547 << QRect( QPoint( INT_MIN/2, 1 ), QPoint(INT_MIN/2-11, -10 ) );
2548 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
2549 << QRect( QPoint( 0, 1 ), QPoint(-11, -10 ) );
2550 QTest::newRow( dataTag: "NegativeSizeQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddlePositiveInt )
2551 << QRect( QPoint( INT_MAX/2, 1 ), QPoint(INT_MAX/2-11, -10 ) );
2552 QTest::newRow( dataTag: "NegativeSizeQRect_MaximumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MaximumInt )
2553 << QRect( QPoint( INT_MAX, 1 ), QPoint(INT_MAX-11, -10 ) );
2554 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
2555 << QRect( QPoint( 4953, 1 ), QPoint(4942, -10 ) );
2556 }
2557
2558 {
2559 QTest::newRow( dataTag: "NegativePointQRect_MinimumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MinimumInt )
2560 << QRect( QPoint( INT_MIN, -10 ), QPoint(4+INT_MIN, -6 ) );
2561 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
2562 << QRect( QPoint( INT_MIN/2, -10 ), QPoint(4+INT_MIN/2, -6 ) );
2563 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
2564 << QRect( QPoint( 0, -10 ), QPoint(4, -6 ) );
2565 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
2566 << QRect( QPoint( INT_MAX/2, -10 ), QPoint(4+INT_MAX/2, -6 ) );
2567 // QTest::newRow( "NegativePointQRect_MaximumInt" ) -- Not tested as this would cause an overflow
2568 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
2569 << QRect( QPoint( 4953, -10 ), QPoint(4957, -6 ) );
2570 }
2571
2572 {
2573 // QTest::newRow( "NullQRect_MinimumInt" ) -- Not tested as this would cause an overflow
2574 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
2575 << QRect( QPoint( INT_MIN/2, 5 ), QPoint(INT_MIN/2-1, 4 ) );
2576 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
2577 << QRect( QPoint( 0, 5 ), QPoint(-1, 4 ) );
2578 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
2579 << QRect( QPoint( INT_MAX/2, 5), QPoint(INT_MAX/2-1, 4 ) );
2580 QTest::newRow( dataTag: "NullQRect_MaximumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MaximumInt )
2581 << QRect( QPoint( INT_MAX, 5 ), QPoint(INT_MAX-1, 4 ) );
2582 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
2583 << QRect( QPoint( 4953, 5 ), QPoint(4952, 4 ) );
2584 }
2585
2586 {
2587 // QTest::newRow( "EmptyQRect_MinimumInt" ) -- Not tested as this would cause an overflow
2588 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
2589 << QRect( QPoint( INT_MIN/2, 2 ), QPoint(INT_MIN/2-1, 1 ) );
2590 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
2591 << QRect( QPoint( 0, 2 ), QPoint(-1, 1 ) );
2592 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
2593 << QRect( QPoint( INT_MAX/2, 2 ), QPoint(INT_MAX/2-1, 1 ) );
2594 QTest::newRow( dataTag: "EmptyQRect_MaximumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MaximumInt )
2595 << QRect( QPoint( INT_MAX, 2 ), QPoint(INT_MAX-1, 1 ) );
2596 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
2597 << QRect( QPoint( 4953, 2 ), QPoint(4952, 1 ) );
2598 }
2599}
2600
2601void tst_QRect::newMoveLeft()
2602{
2603 QFETCH( QRect, r );
2604 QFETCH( int, left );
2605 QFETCH( QRect, nr );
2606
2607 r.moveLeft( pos: left );
2608
2609 QCOMPARE( r, nr );
2610}
2611
2612void tst_QRect::newMoveTop_data()
2613{
2614 QTest::addColumn<QRect>(name: "r");
2615 QTest::addColumn<int>(name: "top");
2616 QTest::addColumn<QRect>(name: "nr");
2617
2618 {
2619 // QTest::newRow( "InvalidQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2620 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
2621 << QRect( QPoint(0,INT_MIN/2), QPoint(-1,INT_MIN/2-1) );
2622 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
2623 << QRect( QPoint(0,0), QPoint(-1,-1) );
2624 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
2625 << QRect( QPoint(0,INT_MAX/2), QPoint(-1,INT_MAX/2-1) );
2626 QTest::newRow( dataTag: "InvalidQRect_MaximumInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MaximumInt )
2627 << QRect( QPoint(0,INT_MAX), QPoint(-1,INT_MAX-1) );
2628 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
2629 << QRect( QPoint(0,4953), QPoint(-1,4952) );
2630 }
2631
2632 {
2633 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
2634 << QRect( QPoint(1,INT_MIN), QPoint(1,INT_MIN) );
2635 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
2636 << QRect( QPoint(1,INT_MIN/2), QPoint(1,INT_MIN/2) );
2637 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
2638 << QRect( QPoint(1,0), QPoint(1,0) );
2639 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
2640 << QRect( QPoint(1,INT_MAX/2), QPoint(1,INT_MAX/2) );
2641 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
2642 << QRect( QPoint(1,INT_MAX), QPoint(1,INT_MAX) );
2643 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
2644 << QRect( QPoint(1,4953), QPoint(1,4953) );
2645 }
2646
2647 {
2648 QTest::newRow( dataTag: "MiddleQRect_MinimumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MinimumInt )
2649 << QRect( QPoint(INT_MIN / 2,INT_MIN ), QPoint(INT_MAX / 2,(INT_MAX/2)+(INT_MIN-INT_MIN/2)) );
2650 QTest::newRow( dataTag: "MiddleQRect_MiddleNegativeInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddleNegativeInt )
2651 << QRect( QPoint(INT_MIN / 2,INT_MIN / 2), QPoint(INT_MAX / 2,(INT_MAX/2)+(INT_MIN/2-INT_MIN/2)) );
2652 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
2653 << QRect( QPoint(INT_MIN / 2,0 ), QPoint(INT_MAX/2,(INT_MAX/2)+(0-INT_MIN/2)));
2654 // QTest::newRow( "MiddleQRect_MiddlePositiveInt" ) -- Not tested as it would cause an overflow
2655 // QTest::newRow( "MiddleQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2656 // QTest::newRow( "MiddleQRect_RandomInt" ) -- Not tested as it would cause an overflow
2657 }
2658
2659 {
2660 QTest::newRow( dataTag: "LargestQRect_MinimumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MinimumInt )
2661 << QRect( QPoint(0,INT_MIN), QPoint(INT_MAX - 1,(INT_MAX-1)+INT_MIN) );
2662 QTest::newRow( dataTag: "LargestQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddleNegativeInt )
2663 << QRect( QPoint(0,INT_MIN/2), QPoint(INT_MAX - 1,(INT_MAX-1)+(INT_MIN/2)) );
2664 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
2665 << QRect( QPoint(0, 0), QPoint(INT_MAX-1,INT_MAX - 1) );
2666 // QTest::newRow( "LargestQRect_MiddlePositiveInt" ) -- Not tested as it would cause an overflow
2667 // QTest::newRow( "LargestQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2668 // QTest::newRow( "LargestQRect_RandomInt" ) -- Not tested as it would cause an overflow
2669 }
2670
2671 {
2672 // QTest::newRow( "SmallestCoordQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2673 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
2674 << QRect( QPoint(INT_MIN,INT_MIN/2), QPoint(INT_MIN,INT_MIN/2) );
2675 QTest::newRow( dataTag: "SmallestCoordQRect_ZeroInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: ZeroInt )
2676 << QRect( QPoint(INT_MIN,0), QPoint(INT_MIN,0) );
2677 QTest::newRow( dataTag: "SmallestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
2678 << QRect( QPoint(INT_MIN,INT_MAX/2), QPoint(INT_MIN,INT_MAX/2) );
2679 QTest::newRow( dataTag: "SmallestCoordQRect_MaximumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MaximumInt )
2680 << QRect( QPoint(INT_MIN,INT_MAX), QPoint(INT_MIN,INT_MAX) );
2681 QTest::newRow( dataTag: "SmallestCoordQRect_RandomInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: RandomInt )
2682 << QRect( QPoint(INT_MIN,4953), QPoint(INT_MIN,4953) );
2683 }
2684
2685 {
2686 // QTest::newRow( "LargestCoordQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2687 QTest::newRow( dataTag: "LargestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
2688 << QRect( QPoint(INT_MIN,INT_MIN/2), QPoint(INT_MAX,INT_MIN/2-1) );
2689 QTest::newRow( dataTag: "LargestCoordQRect_ZeroInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: ZeroInt )
2690 << QRect( QPoint(INT_MIN,0), QPoint(INT_MAX,-1) );
2691 QTest::newRow( dataTag: "LargestCoordQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MiddlePositiveInt )
2692 << QRect( QPoint(INT_MIN,INT_MAX/2), QPoint(INT_MAX,INT_MAX/2-1) );
2693 QTest::newRow( dataTag: "LargestCoordQRect_MaximumInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: MaximumInt )
2694 << QRect( QPoint(INT_MIN,INT_MAX), QPoint(INT_MAX,INT_MAX-1) );
2695 QTest::newRow( dataTag: "LargestCoordQRect_RandomInt" ) << getQRectCase( c: LargestCoordQRect ) << getIntCase( i: RandomInt )
2696 << QRect( QPoint(INT_MIN,4953), QPoint(INT_MAX,4952) );
2697 }
2698
2699 {
2700 QTest::newRow( dataTag: "RandomQRect_MinimumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MinimumInt )
2701 << QRect( QPoint(100,INT_MIN), QPoint(110,15+INT_MIN) );
2702 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
2703 << QRect( QPoint(100,INT_MIN/2), QPoint(110,15+INT_MIN/2) );
2704 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
2705 << QRect( QPoint(100, 0), QPoint(110,15) );
2706 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
2707 << QRect( QPoint(100,INT_MAX/2), QPoint(110,15+INT_MAX/2) );
2708 // QTest::newRow( "RandomQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2709 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
2710 << QRect( QPoint(100,4953), QPoint(110,4968) );
2711 }
2712
2713 {
2714 // QTest::newRow( "NegativeSizeQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2715 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
2716 << QRect( QPoint(1,INT_MIN/2), QPoint(-10,INT_MIN/2-11) );
2717 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
2718 << QRect( QPoint(1,0), QPoint(-10,-11) );
2719 QTest::newRow( dataTag: "NegativeSizeQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddlePositiveInt )
2720 << QRect( QPoint(1,INT_MAX/2), QPoint(-10,INT_MAX/2-11) );
2721 QTest::newRow( dataTag: "NegativeSizeQRect_MaximumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MaximumInt )
2722 << QRect( QPoint(1,INT_MAX), QPoint(-10,INT_MAX-11) );
2723 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
2724 << QRect( QPoint(1,4953), QPoint(-10,4942) );
2725 }
2726
2727 {
2728 QTest::newRow( dataTag: "NegativePointQRect_MinimumInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MinimumInt )
2729 << QRect( QPoint(-10,INT_MIN), QPoint(-6,4+INT_MIN) );
2730 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
2731 << QRect( QPoint(-10,INT_MIN/2), QPoint(-6,4+INT_MIN/2) );
2732 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
2733 << QRect( QPoint(-10,0), QPoint(-6,4) );
2734 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
2735 << QRect( QPoint(-10,INT_MAX/2), QPoint(-6,4+INT_MAX/2) );
2736 // QTest::newRow( "NegativePointQRect_MaximumInt" ) -- Not tested as this would cause an overflow
2737 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
2738 << QRect( QPoint(-10,4953), QPoint(-6,4957) );
2739 }
2740
2741 {
2742 // QTest::newRow( "NullQRect_MinimumInt" ) -- Not tested as this would cause an overflow
2743 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
2744 << QRect( QPoint(5,INT_MIN/2), QPoint(4,INT_MIN/2-1) );
2745 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
2746 << QRect( QPoint(5,0), QPoint(4,-1) );
2747 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
2748 << QRect( QPoint(5,INT_MAX/2), QPoint(4,INT_MAX/2-1) );
2749 QTest::newRow( dataTag: "NullQRect_MaximumInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MaximumInt )
2750 << QRect( QPoint(5,INT_MAX), QPoint(4,INT_MAX-1) );
2751 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
2752 << QRect( QPoint(5,4953), QPoint(4,4952) );
2753 }
2754
2755 {
2756 // QTest::newRow( "EmptyQRect_MinimumInt" ) -- Not tested as this would cause an overflow
2757 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
2758 << QRect( QPoint(2,INT_MIN/2), QPoint(1,INT_MIN/2-1) );
2759 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
2760 << QRect( QPoint(2,0), QPoint(1,-1) );
2761 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
2762 << QRect( QPoint(2,INT_MAX/2), QPoint(1,INT_MAX/2-1) );
2763 QTest::newRow( dataTag: "EmptyQRect_MaximumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MaximumInt )
2764 << QRect( QPoint(2,INT_MAX), QPoint(1,INT_MAX-1) );
2765 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
2766 << QRect( QPoint(2,4953), QPoint(1,4952) );
2767 }
2768}
2769
2770void tst_QRect::newMoveTop()
2771{
2772 QFETCH( QRect, r );
2773 QFETCH( int, top );
2774 QFETCH( QRect, nr );
2775
2776 r.moveTop( pos: top );
2777
2778 QCOMPARE( r, nr );
2779}
2780
2781void tst_QRect::newMoveRight_data()
2782{
2783 QTest::addColumn<QRect>(name: "r");
2784 QTest::addColumn<int>(name: "right");
2785 QTest::addColumn<QRect>(name: "nr");
2786
2787 {
2788 // QTest::newRow( "InvalidQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2789 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
2790 << QRect( QPoint(INT_MIN/2+1,0), QPoint(INT_MIN/2,-1) );
2791 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
2792 << QRect( QPoint(1,0), QPoint(0,-1) );
2793 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
2794 << QRect( QPoint(INT_MAX/2+1,0), QPoint(INT_MAX/2,-1) );
2795 // QTest::newRow( "InvalidQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2796 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
2797 << QRect( QPoint(4954,0), QPoint(4953,-1) );
2798 }
2799
2800 {
2801 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
2802 << QRect( QPoint(INT_MIN,1), QPoint(INT_MIN,1) );
2803 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
2804 << QRect( QPoint(INT_MIN/2,1), QPoint(INT_MIN/2,1) );
2805 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
2806 << QRect( QPoint(0,1), QPoint(0,1) );
2807 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
2808 << QRect( QPoint(INT_MAX/2,1), QPoint(INT_MAX/2,1) );
2809 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
2810 << QRect( QPoint(INT_MAX,1), QPoint(INT_MAX,1) );
2811 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
2812 << QRect( QPoint(4953,1), QPoint(4953,1) );
2813 }
2814
2815 {
2816 // QTest::newRow( "MiddleQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2817 // QTest::newRow( "MiddleQRect_MiddleNegativeInt" ) -- Not tested as it would cause an overflow
2818 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
2819 << QRect( QPoint(INT_MIN/2+(0-INT_MAX/2),INT_MIN/2), QPoint(0,INT_MAX/2));
2820 QTest::newRow( dataTag: "MiddleQRect_MiddlePositiveInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddlePositiveInt )
2821 << QRect(QPoint(INT_MIN/2+(INT_MAX/2-INT_MAX/2),INT_MIN/2),QPoint(INT_MAX/2,INT_MAX/2));
2822 QTest::newRow( dataTag: "MiddleQRect_MaximumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MaximumInt )
2823 << QRect(QPoint(INT_MIN/2+(INT_MAX-INT_MAX/2),INT_MIN/2),QPoint(INT_MAX,INT_MAX/2));
2824 QTest::newRow( dataTag: "MiddleQRect_RandomInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: RandomInt )
2825 << QRect(QPoint(INT_MIN/2+(4953-INT_MAX/2),INT_MIN/2),QPoint(4953,INT_MAX/2));
2826 }
2827
2828 {
2829 // QTest::newRow( "LargestQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2830 // QTest::newRow( "LargestQRect_MiddleNegativeInt" ) -- Not tested as it would cause an overflow
2831 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
2832 << QRect( QPoint(0-(INT_MAX-1), 0), QPoint(0, INT_MAX - 1 ) );
2833 QTest::newRow( dataTag: "LargestQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddlePositiveInt )
2834 << QRect( QPoint(INT_MAX/2-(INT_MAX-1), 0), QPoint(INT_MAX/2, INT_MAX - 1 ) );
2835 QTest::newRow( dataTag: "LargestQRect_MaximumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MaximumInt )
2836 << QRect( QPoint(INT_MAX-(INT_MAX-1), 0), QPoint(INT_MAX, INT_MAX - 1 ) );
2837 QTest::newRow( dataTag: "LargestQRect_RandomInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: RandomInt )
2838 << QRect( QPoint(4953-(INT_MAX-1), 0), QPoint(4953, INT_MAX - 1 ) );
2839 }
2840
2841 {
2842 QTest::newRow( dataTag: "SmallestCoordQRect_MinimumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MinimumInt )
2843 << QRect(QPoint(INT_MIN+(INT_MIN-INT_MIN),INT_MIN), QPoint(INT_MIN,INT_MIN) );
2844 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
2845 << QRect(QPoint(INT_MIN+(INT_MIN/2-INT_MIN),INT_MIN), QPoint(INT_MIN/2, INT_MIN ) );
2846 // QTest::newRow( "SmallestCoordQRect_ZeroInt" ) -- Not tested as it would cause an overflow
2847 // QTest::newRow( "SmallestCoordQRect_MiddlePositiveInt" ) -- Not tested as it would cause an overflow
2848 // QTest::newRow( "SmallestCoordQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2849 // QTest::newRow( "SmallestCoordQRect_RandomInt" ) -- Not tested as it would cause an overflow
2850 }
2851
2852 {
2853 // LargestQRect cases -- Not tested as it would cause an overflow
2854 }
2855
2856 {
2857 // QTest::newRow( "RandomQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2858 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
2859 << QRect( QPoint(100+(INT_MIN/2-110), 200 ), QPoint(INT_MIN/2, 215 ) );
2860 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
2861 << QRect( QPoint(-10, 200 ), QPoint(0, 215 ) );
2862 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
2863 << QRect( QPoint(100+(INT_MAX/2-110), 200 ), QPoint(INT_MAX/2, 215 ) );
2864 QTest::newRow( dataTag: "RandomQRect_MaximumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MaximumInt )
2865 << QRect( QPoint(100+(INT_MAX-110), 200 ), QPoint(INT_MAX, 215 ) );
2866 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
2867 << QRect( QPoint(4943, 200 ), QPoint(4953, 215 ) );
2868 }
2869
2870 {
2871 QTest::newRow( dataTag: "NegativeSizeQRect_MinimumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MinimumInt )
2872 << QRect( QPoint(1+(INT_MIN-(-10)), 1 ), QPoint(INT_MIN, -10 ) );
2873 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
2874 << QRect( QPoint(1+(INT_MIN/2-(-10)), 1 ), QPoint(INT_MIN/2, -10 ) );
2875 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
2876 << QRect( QPoint(11, 1 ), QPoint(0, -10 ) );
2877 // QTest::newRow( "NegativeSizeQRect_MiddlePositiveInt" ) -- Not tested as this would cause an overflow
2878 // QTest::newRow( "NegativeSizeQRect_MaximumInt" ) -- Not tested as this would cause an overflow
2879 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
2880 << QRect( QPoint(4964, 1 ), QPoint(4953, -10 ) );
2881 }
2882
2883 {
2884 // QTest::newRow( "NegativePointQRect_MinimumInt" ) -- Not tested as this would cause an overflow
2885 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
2886 << QRect( QPoint((-10)+(INT_MIN/2-(-6)), -10 ), QPoint(INT_MIN/2, -6 ) );
2887 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
2888 << QRect( QPoint(-4, -10 ), QPoint(0, -6 ) );
2889 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
2890 << QRect( QPoint((-10)+(INT_MAX/2-(-6)), -10 ), QPoint(INT_MAX/2, -6 ) );
2891 // QTest::newRow( "NegativePointQRect_MaximumInt" ) -- Not tested as this would cause an overflow
2892 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
2893 << QRect( QPoint(4949, -10 ), QPoint(4953, -6 ) );
2894 }
2895
2896 {
2897 // QTest::newRow( "NullQRect_MinimumInt" ) -- Not tested as this would cause an overflow
2898 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
2899 << QRect( QPoint(5+(INT_MIN/2-4), 5 ), QPoint(INT_MIN/2, 4 ) );
2900 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
2901 << QRect( QPoint(1, 5 ), QPoint(0, 4 ) );
2902 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
2903 << QRect( QPoint(5+(INT_MAX/2-4), 5 ), QPoint(INT_MAX/2, 4 ) );
2904 // QTest::newRow( "NullQRect_MaximumInt" ) -- Not tested as this would cause an overflow
2905 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
2906 << QRect( QPoint(4954, 5 ), QPoint(4953, 4 ) );
2907 }
2908
2909 {
2910 QTest::newRow( dataTag: "EmptyQRect_MinimumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MinimumInt )
2911 << QRect( QPoint(INT_MIN+1,2 ), QPoint(INT_MIN, 1 ) );
2912 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
2913 << QRect( QPoint(INT_MIN/2+1, 2 ), QPoint(INT_MIN/2, 1 ) );
2914 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
2915 << QRect( QPoint(1,2 ), QPoint(0, 1 ) );
2916 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
2917 << QRect( QPoint(INT_MAX/2+1,2 ), QPoint(INT_MAX/2, 1 ) );
2918 // QTest::newRow( "EmptyQRect_MaximumInt" ) -- Not tested as this would cause an overflow
2919 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
2920 << QRect( QPoint( 4954, 2 ), QPoint(4953, 1 ) );
2921 }
2922}
2923
2924void tst_QRect::newMoveRight()
2925{
2926 QFETCH( QRect, r );
2927 QFETCH( int, right );
2928 QFETCH( QRect, nr );
2929
2930 r.moveRight( pos: right );
2931
2932 QCOMPARE( r, nr );
2933}
2934
2935void tst_QRect::newMoveBottom_data()
2936{
2937 QTest::addColumn<QRect>(name: "r");
2938 QTest::addColumn<int>(name: "bottom");
2939 QTest::addColumn<QRect>(name: "nr");
2940
2941 {
2942 // QTest::newRow( "InvalidQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2943 QTest::newRow( dataTag: "InvalidQRect_MiddleNegativeInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddleNegativeInt )
2944 << QRect( QPoint(0,INT_MIN/2+1), QPoint(-1,INT_MIN/2) );
2945 QTest::newRow( dataTag: "InvalidQRect_ZeroInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: ZeroInt )
2946 << QRect( QPoint(0,1), QPoint(-1,0) );
2947 QTest::newRow( dataTag: "InvalidQRect_MiddlePositiveInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: MiddlePositiveInt )
2948 << QRect( QPoint(0,INT_MAX/2+1), QPoint(-1,INT_MAX/2) );
2949 // QTest::newRow( "InvalidQRect_MaximumInt" ) -- Not tested as it would cause an overflow
2950 QTest::newRow( dataTag: "InvalidQRect_RandomInt" ) << getQRectCase( c: InvalidQRect ) << getIntCase( i: RandomInt )
2951 << QRect( QPoint(0,4954), QPoint(-1,4953) );
2952 }
2953
2954 {
2955 QTest::newRow( dataTag: "SmallestQRect_MinimumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MinimumInt )
2956 << QRect( QPoint(1,INT_MIN), QPoint(1,INT_MIN) );
2957 QTest::newRow( dataTag: "SmallestQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddleNegativeInt )
2958 << QRect( QPoint(1,INT_MIN/2), QPoint(1,INT_MIN/2) );
2959 QTest::newRow( dataTag: "SmallestQRect_ZeroInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: ZeroInt )
2960 << QRect( QPoint(1,0), QPoint(1,0) );
2961 QTest::newRow( dataTag: "SmallestQRect_MiddlePositiveInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MiddlePositiveInt )
2962 << QRect( QPoint(1,INT_MAX/2), QPoint(1,INT_MAX/2) );
2963 QTest::newRow( dataTag: "SmallestQRect_MaximumInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: MaximumInt )
2964 << QRect( QPoint(1,INT_MAX), QPoint(1,INT_MAX) );
2965 QTest::newRow( dataTag: "SmallestQRect_RandomInt" ) << getQRectCase( c: SmallestQRect ) << getIntCase( i: RandomInt )
2966 << QRect( QPoint(1,4953), QPoint(1,4953) );
2967 }
2968
2969 {
2970 // QTest::newRow( "MiddleQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2971 // QTest::newRow( "MiddleQRect_MiddleNegativeInt" ) -- Not tested as it would cause an overflow
2972 QTest::newRow( dataTag: "MiddleQRect_ZeroInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: ZeroInt )
2973 << QRect( QPoint(INT_MIN/2,INT_MIN/2+(0-INT_MAX/2)), QPoint(INT_MAX/2,0));
2974 QTest::newRow( dataTag: "MiddleQRect_MiddlePositiveInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MiddlePositiveInt )
2975 << QRect(QPoint(INT_MIN/2,INT_MIN/2+(INT_MAX/2-INT_MAX/2)),QPoint(INT_MAX/2,INT_MAX/2));
2976 QTest::newRow( dataTag: "MiddleQRect_MaximumInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: MaximumInt )
2977 << QRect(QPoint(INT_MIN/2,INT_MIN/2+(INT_MAX-INT_MAX/2)),QPoint(INT_MAX/2,INT_MAX));
2978 QTest::newRow( dataTag: "MiddleQRect_RandomInt" ) << getQRectCase( c: MiddleQRect ) << getIntCase( i: RandomInt )
2979 << QRect(QPoint(INT_MIN/2,INT_MIN/2+(4953-INT_MAX/2)),QPoint(INT_MAX/2,4953));
2980 }
2981
2982 {
2983 // QTest::newRow( "LargestQRect_MinimumInt" ) -- Not tested as it would cause an overflow
2984 // QTest::newRow( "LargestQRect_MiddleNegativeInt" ) -- Not tested as it would cause an overflow
2985 QTest::newRow( dataTag: "LargestQRect_ZeroInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: ZeroInt )
2986 << QRect( QPoint(0,0-(INT_MAX-1)), QPoint(INT_MAX - 1,0 ) );
2987 QTest::newRow( dataTag: "LargestQRect_MiddlePositiveInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MiddlePositiveInt )
2988 << QRect( QPoint(0,INT_MAX/2-(INT_MAX-1)), QPoint(INT_MAX - 1,INT_MAX/2 ) );
2989 QTest::newRow( dataTag: "LargestQRect_MaximumInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: MaximumInt )
2990 << QRect( QPoint(0,INT_MAX-(INT_MAX-1)), QPoint(INT_MAX - 1,INT_MAX) );
2991 QTest::newRow( dataTag: "LargestQRect_RandomInt" ) << getQRectCase( c: LargestQRect ) << getIntCase( i: RandomInt )
2992 << QRect( QPoint(0,4953-(INT_MAX-1)), QPoint(INT_MAX - 1,4953) );
2993 }
2994
2995 {
2996 QTest::newRow( dataTag: "SmallestCoordQRect_MinimumInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MinimumInt )
2997 << QRect(QPoint(INT_MIN,INT_MIN+(INT_MIN-INT_MIN)), QPoint(INT_MIN,INT_MIN) );
2998 QTest::newRow( dataTag: "SmallestCoordQRect_MiddleNegativeInt" ) << getQRectCase( c: SmallestCoordQRect ) << getIntCase( i: MiddleNegativeInt )
2999 << QRect(QPoint(INT_MIN,INT_MIN+(INT_MIN/2-INT_MIN)), QPoint(INT_MIN,INT_MIN/2) );
3000 // QTest::newRow( "SmallestCoordQRect_ZeroInt" ) -- Not tested as it would cause an overflow
3001 // QTest::newRow( "SmallestCoordQRect_MiddlePositiveInt" ) -- Not tested as it would cause an overflow
3002 // QTest::newRow( "SmallestCoordQRect_MaximumInt" ) -- Not tested as it would cause an overflow
3003 // QTest::newRow( "SmallestCoordQRect_RandomInt" ) -- Not tested as it would cause an overflow
3004 }
3005
3006 {
3007 // LargestQRect cases -- Not tested as it would cause an overflow
3008 }
3009
3010 {
3011 // QTest::newRow( "RandomQRect_MinimumInt" ) -- Not tested as it would cause an overflow
3012 QTest::newRow( dataTag: "RandomQRect_MiddleNegativeInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddleNegativeInt )
3013 << QRect( QPoint(100,200+(INT_MIN/2-215)), QPoint(110,INT_MIN/2) );
3014 QTest::newRow( dataTag: "RandomQRect_ZeroInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: ZeroInt )
3015 << QRect( QPoint(100,-15), QPoint(110,0) );
3016 QTest::newRow( dataTag: "RandomQRect_MiddlePositiveInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MiddlePositiveInt )
3017 << QRect( QPoint(100,200+(INT_MAX/2-215)), QPoint(110,INT_MAX/2) );
3018 QTest::newRow( dataTag: "RandomQRect_MaximumInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: MaximumInt )
3019 << QRect( QPoint(100,200+(INT_MAX-215)), QPoint(110,INT_MAX) );
3020 QTest::newRow( dataTag: "RandomQRect_RandomInt" ) << getQRectCase( c: RandomQRect ) << getIntCase( i: RandomInt )
3021 << QRect( QPoint(100,4938), QPoint(110,4953) );
3022 }
3023
3024 {
3025 QTest::newRow( dataTag: "NegativeSizeQRect_MinimumInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MinimumInt )
3026 << QRect( QPoint(1,1+(INT_MIN-(-10))), QPoint(-10,INT_MIN));
3027 QTest::newRow( dataTag: "NegativeSizeQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: MiddleNegativeInt )
3028 << QRect( QPoint(1,1+(INT_MIN/2-(-10))), QPoint(-10,INT_MIN/2));
3029 QTest::newRow( dataTag: "NegativeSizeQRect_ZeroInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: ZeroInt )
3030 << QRect( QPoint(1,11), QPoint(-10,0) );
3031 // QTest::newRow( "NegativeSizeQRect_MiddlePositiveInt" ) -- Not tested as this would cause an overflow
3032 // QTest::newRow( "NegativeSizeQRect_MaximumInt" ) -- Not tested as this would cause an overflow
3033 QTest::newRow( dataTag: "NegativeSizeQRect_RandomInt" ) << getQRectCase( c: NegativeSizeQRect ) << getIntCase( i: RandomInt )
3034 << QRect( QPoint(1,4964), QPoint(-10,4953) );
3035 }
3036
3037 {
3038 // QTest::newRow( "NegativePointQRect_MinimumInt" ) -- Not tested as this would cause an overflow
3039 QTest::newRow( dataTag: "NegativePointQRect_MiddleNegativeInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddleNegativeInt )
3040 << QRect( QPoint(-10,(-10)+(INT_MIN/2-(-6))), QPoint(-6,INT_MIN/2) );
3041 QTest::newRow( dataTag: "NegativePointQRect_ZeroInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: ZeroInt )
3042 << QRect( QPoint(-10,-4), QPoint(-6,0) );
3043 QTest::newRow( dataTag: "NegativePointQRect_MiddlePositiveInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: MiddlePositiveInt )
3044 << QRect( QPoint(-10,(-10)+(INT_MAX/2-(-6))), QPoint(-6,INT_MAX/2) );
3045 // QTest::newRow( "NegativePointQRect_MaximumInt" ) -- Not tested as this would cause an overflow
3046 QTest::newRow( dataTag: "NegativePointQRect_RandomInt" ) << getQRectCase( c: NegativePointQRect ) << getIntCase( i: RandomInt )
3047 << QRect( QPoint(-10,4949), QPoint(-6,4953) );
3048 }
3049
3050 {
3051 // QTest::newRow( "NullQRect_MinimumInt" ) -- Not tested as this would cause an overflow
3052 QTest::newRow( dataTag: "NullQRect_MiddleNegativeInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddleNegativeInt )
3053 << QRect( QPoint(5,5+(INT_MIN/2-4)), QPoint(4,INT_MIN/2) );
3054 QTest::newRow( dataTag: "NullQRect_ZeroInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: ZeroInt )
3055 << QRect( QPoint(5,1), QPoint(4,0) );
3056 QTest::newRow( dataTag: "NullQRect_MiddlePositiveInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: MiddlePositiveInt )
3057 << QRect( QPoint(5,5+(INT_MAX/2-4)), QPoint(4,INT_MAX/2) );
3058 // QTest::newRow( "NullQRect_MaximumInt" ) -- Not tested as this would cause an overflow
3059 QTest::newRow( dataTag: "NullQRect_RandomInt" ) << getQRectCase( c: NullQRect ) << getIntCase( i: RandomInt )
3060 << QRect( QPoint(5,4954), QPoint(4,4953) );
3061 }
3062
3063 {
3064 QTest::newRow( dataTag: "EmptyQRect_MinimumInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MinimumInt )
3065 << QRect( QPoint(2,INT_MIN+1), QPoint(1,INT_MIN) );
3066 QTest::newRow( dataTag: "EmptyQRect_MiddleNegativeInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddleNegativeInt )
3067 << QRect( QPoint(2,INT_MIN/2+1), QPoint(1,INT_MIN/2) );
3068 QTest::newRow( dataTag: "EmptyQRect_ZeroInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: ZeroInt )
3069 << QRect( QPoint(2,1), QPoint(1,0) );
3070 QTest::newRow( dataTag: "EmptyQRect_MiddlePositiveInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: MiddlePositiveInt )
3071 << QRect( QPoint(2,INT_MAX/2+1), QPoint(1,INT_MAX/2) );
3072 // QTest::newRow( "EmptyQRect_MaximumInt" ) -- Not tested as this would cause an overflow
3073 QTest::newRow( dataTag: "EmptyQRect_RandomInt" ) << getQRectCase( c: EmptyQRect ) << getIntCase( i: RandomInt )
3074 << QRect( QPoint(2,4954), QPoint(1,4953) );
3075 }
3076}
3077
3078void tst_QRect::newMoveBottom()
3079{
3080 QFETCH( QRect, r );
3081 QFETCH( int, bottom );
3082 QFETCH( QRect, nr );
3083
3084 r.moveBottom( pos: bottom );
3085
3086 QCOMPARE( r, nr );
3087}
3088
3089void tst_QRect::newMoveTopLeft_data()
3090{
3091 QTest::addColumn<QRect>(name: "r");
3092 QTest::addColumn<QPoint>(name: "topLeft");
3093 QTest::addColumn<QRect>(name: "nr");
3094
3095 {
3096 QTest::newRow(dataTag: "InvalidQRect_NullQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NullQPoint)
3097 << QRect(QPoint(0,0), QPoint(-1,-1));
3098 // QTest::newRow("InvalidQRect_SmallestCoordQPoint") -- Not tested as this would cause an overflow
3099 QTest::newRow(dataTag: "InvalidQRect_MiddleNegCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3100 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(-1+(INT_MIN/2-0),-1+(INT_MIN/2-0)));
3101 QTest::newRow(dataTag: "InvalidQRect_MiddlePosCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3102 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(-1+(INT_MAX/2-0),-1+(INT_MAX/2-0)));
3103 QTest::newRow(dataTag: "InvalidQRect_LargestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: LargestCoordQPoint)
3104 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(-1+(INT_MAX-0),-1+(INT_MAX-0)));
3105 QTest::newRow(dataTag: "InvalidQRect_NegXQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegXQPoint)
3106 << QRect(QPoint(-12,7), QPoint(-13,6));
3107 QTest::newRow(dataTag: "InvalidQRect_NegYQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegYQPoint)
3108 << QRect(QPoint(12,-7), QPoint(11,-8));
3109 QTest::newRow(dataTag: "InvalidQRect_RandomQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: RandomQPoint)
3110 << QRect(QPoint(12,7), QPoint(11,6));
3111 }
3112
3113 {
3114 QTest::newRow(dataTag: "SmallestQRect_NullQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NullQPoint)
3115 << QRect(QPoint(0,0), QPoint(0,0));
3116 QTest::newRow(dataTag: "SmallestQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: SmallestCoordQPoint)
3117 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN,INT_MIN));
3118 QTest::newRow(dataTag: "SmallestQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3119 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MIN/2,INT_MIN/2));
3120 QTest::newRow(dataTag: "SmallestQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3121 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(INT_MAX/2,INT_MAX/2));
3122 QTest::newRow(dataTag: "SmallestQRect_LargestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: LargestCoordQPoint)
3123 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(INT_MAX,INT_MAX));
3124 QTest::newRow(dataTag: "SmallestQRect_NegXQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegXQPoint)
3125 << QRect(QPoint(-12,7), QPoint(-12,7));
3126 QTest::newRow(dataTag: "SmallestQRect_NegYQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegYQPoint)
3127 << QRect(QPoint(12,-7), QPoint(12,-7));
3128 QTest::newRow(dataTag: "SmallestQRect_RandomQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: RandomQPoint)
3129 << QRect(QPoint(12,7), QPoint(12,7));
3130 }
3131
3132 {
3133 QTest::newRow(dataTag: "MiddleQRect_NullQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NullQPoint)
3134 << QRect(QPoint(0,0), QPoint(INT_MAX/2+(0-INT_MIN/2),INT_MAX/2+(0-INT_MIN/2)));
3135 QTest::newRow(dataTag: "MiddleQRect_SmallestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: SmallestCoordQPoint)
3136 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX/2+(INT_MIN-INT_MIN/2),INT_MAX/2+(INT_MIN-INT_MIN/2)));
3137 QTest::newRow(dataTag: "MiddleQRect_MiddleNegCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3138 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MAX/2,INT_MAX/2));
3139 // QTest::newRow("MiddleQRect_MiddlePosCoordQPoint") -- Not tested as it would cause an overflow
3140 // QTest::newRow("MiddleQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3141 // QTest::newRow("MiddleQRect_NegXQPoint") -- Not tested as it would cause an overflow
3142 // QTest::newRow("MiddleQRect_NegYQPoint") -- Not tested as it would cause an overflow
3143 // QTest::newRow("MiddleQRect_RandomQPoint") -- Not tested as it would cause an overflow
3144 }
3145
3146 {
3147 QTest::newRow(dataTag: "LargestQRect_NullQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NullQPoint)
3148 << QRect(QPoint(0,0), QPoint(INT_MAX-1,INT_MAX-1));
3149 QTest::newRow(dataTag: "LargestQRect_SmallestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: SmallestCoordQPoint)
3150 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX-1+INT_MIN,INT_MAX-1+INT_MIN));
3151 // QTest::newRow("LargestQRect_MiddleNegCoordQPoint") -- Not tested as it would cause an overflow
3152 // QTest::newRow("LargestQRect_MiddlePosCoordQPoint") -- Not tested as it would cause an overflow
3153 // QTest::newRow("LargestQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3154 // QTest::newRow("LargestQRect_NegXQPoint") -- Not tested as it would cause an overflow
3155 // QTest::newRow("LargestQRect_NegYQPoint") -- Not tested as it would cause an overflow
3156 // QTest::newRow("LargestQRect_RandomQPoint") -- Not tested as it would cause an overflow
3157 }
3158
3159 {
3160 // QTest::newRow("SmallestCoordQRect_NullQPoint") -- Not tested as it would cause an overflow
3161 QTest::newRow(dataTag: "SmallestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
3162 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN,INT_MIN));
3163 QTest::newRow(dataTag: "SmallestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3164 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(INT_MIN+(INT_MIN/2-INT_MIN),INT_MIN+(INT_MIN/2-INT_MIN)));
3165 // QTest::newRow("SmallestCoordQRect_MiddlePosCoordQPoint") -- Not tested as it would cause an overflow
3166 // QTest::newRow("SmallestCoordQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3167 // QTest::newRow("SmallestCoordQRect_NegXQPoint") -- Not tested as it would cause an overflow
3168 // QTest::newRow("SmallestCoordQRect_NegYQPoint") -- Not tested as it would cause an overflow
3169 // QTest::newRow("SmallestCoordQRect_RandomQPoint") -- Not tested as it would cause an overflow
3170 }
3171
3172 {
3173 // QTest::newRow("LargestCoordQRect_NullQPoint") -- Not tested as it would cause an overflow
3174 QTest::newRow(dataTag: "LargestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
3175 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MAX,INT_MAX));
3176 // QTest::newRow("LargestCoordQRect_MiddleNegCoordQPoint") -- Not tested as it would cause an overflow
3177 // QTest::newRow("LargestCoordQRect_MiddlePosCoordQPoint") -- Not tested as it would cause an overflow
3178 // QTest::newRow("LargestCoordQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3179 // QTest::newRow("LargestCoordQRect_NegXQPoint") -- Not tested as it would cause an overflow
3180 // QTest::newRow("LargestCoordQRect_NegYQPoint") -- Not tested as it would cause an overflow
3181 // QTest::newRow("LargestCoordQRect_RandomQPoint") -- Not tested as it would cause an overflow
3182 }
3183
3184 {
3185 QTest::newRow(dataTag: "RandomQRect_NullQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NullQPoint)
3186 << QRect(QPoint(0,0), QPoint(10,15));
3187 // QTest::newRow("RandomQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3188 QTest::newRow(dataTag: "RandomQRect_MiddleNegCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3189 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(110+(INT_MIN/2-100),215+(INT_MIN/2-200)));
3190 QTest::newRow(dataTag: "RandomQRect_MiddlePosCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3191 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(110+(INT_MAX/2-100),215+(INT_MAX/2-200)));
3192 // QTest::newRow("RandomQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3193 QTest::newRow(dataTag: "RandomQRect_NegXQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegXQPoint)
3194 << QRect(QPoint(-12,7), QPoint(-2,22));
3195 QTest::newRow(dataTag: "RandomQRect_NegYQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegYQPoint)
3196 << QRect(QPoint(12,-7), QPoint(22,8));
3197 QTest::newRow(dataTag: "RandomQRect_RandomQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: RandomQPoint)
3198 << QRect(QPoint(12,7), QPoint(22,22));
3199 }
3200
3201 {
3202 QTest::newRow(dataTag: "NegativeSizeQRect_NullQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NullQPoint)
3203 << QRect(QPoint(0,0), QPoint(-11,-11));
3204 // QTest::newRow("NegativeSizeQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3205 QTest::newRow(dataTag: "NegativeSizeQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3206 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint(-10+((INT_MIN/2)-1),-10+((INT_MIN/2)-1)));
3207 QTest::newRow(dataTag: "NegativeSizeQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3208 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint(-10+((INT_MAX/2)-1),-10+((INT_MAX/2)-1)));
3209 // QTest::newRow("NegativeSizeQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3210 QTest::newRow(dataTag: "NegativeSizeQRect_NegXQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegXQPoint)
3211 << QRect(QPoint(-12,7), QPoint(-23,-4));
3212 QTest::newRow(dataTag: "NegativeSizeQRect_NegYQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegYQPoint)
3213 << QRect(QPoint(12,-7), QPoint(1,-18));
3214 QTest::newRow(dataTag: "NegativeSizeQRect_RandomQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: RandomQPoint)
3215 << QRect(QPoint(12,7), QPoint(1,-4));
3216 }
3217
3218 {
3219 QTest::newRow(dataTag: "NegativePointQRect_NullQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NullQPoint)
3220 << QRect(QPoint(0,0), QPoint(4,4));
3221 QTest::newRow(dataTag: "NegativePointQRect_SmallestCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: SmallestCoordQPoint)
3222 << QRect(QPoint(INT_MIN,INT_MIN), QPoint(INT_MIN+4,INT_MIN+4));
3223 QTest::newRow(dataTag: "NegativePointQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3224 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint((INT_MIN/2)+4,(INT_MIN/2)+4));
3225 QTest::newRow(dataTag: "NegativePointQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3226 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint((INT_MAX/2)+4,(INT_MAX/2)+4));
3227 // QTest::newRow("NegativePointQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3228 QTest::newRow(dataTag: "NegativePointQRect_NegXQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegXQPoint)
3229 << QRect(QPoint(-12,7), QPoint(-8,11));
3230 QTest::newRow(dataTag: "NegativePointQRect_NegYQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegYQPoint)
3231 << QRect(QPoint(12,-7), QPoint(16,-3));
3232 QTest::newRow(dataTag: "NegativePointQRect_RandomQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: RandomQPoint)
3233 << QRect(QPoint(12,7), QPoint(16,11));
3234 }
3235
3236 {
3237 QTest::newRow(dataTag: "NullQRect_NullQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NullQPoint)
3238 << QRect(QPoint(0,0), QPoint(-1,-1));
3239 // QTest::newRow("NullQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3240 QTest::newRow(dataTag: "NullQRect_MiddleNegCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3241 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint((INT_MIN/2)-1,(INT_MIN/2)-1));
3242 QTest::newRow(dataTag: "NullQRect_MiddlePosCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3243 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint((INT_MAX/2)-1,(INT_MAX/2)-1));
3244 QTest::newRow(dataTag: "NullQRect_LargestCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: LargestCoordQPoint)
3245 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(INT_MAX-1,INT_MAX-1));
3246 QTest::newRow(dataTag: "NullQRect_NegXQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegXQPoint)
3247 << QRect(QPoint(-12,7), QPoint(-13,6));
3248 QTest::newRow(dataTag: "NullQRect_NegYQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegYQPoint)
3249 << QRect(QPoint(12,-7), QPoint(11,-8));
3250 QTest::newRow(dataTag: "NullQRect_RandomQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: RandomQPoint)
3251 << QRect(QPoint(12,7), QPoint(11,6));
3252 }
3253
3254 {
3255 QTest::newRow(dataTag: "EmptyQRect_NullQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NullQPoint)
3256 << QRect(QPoint(0,0), QPoint(-1,-1));
3257 // QTest::newRow("EmptyQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3258 QTest::newRow(dataTag: "EmptyQRect_MiddleNegCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3259 << QRect(QPoint(INT_MIN/2,INT_MIN/2), QPoint((INT_MIN/2)-1,(INT_MIN/2)-1));
3260 QTest::newRow(dataTag: "EmptyQRect_MiddlePosCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3261 << QRect(QPoint(INT_MAX/2,INT_MAX/2), QPoint((INT_MAX/2)-1,(INT_MAX/2)-1));
3262 QTest::newRow(dataTag: "EmptyQRect_LargestCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: LargestCoordQPoint)
3263 << QRect(QPoint(INT_MAX,INT_MAX), QPoint(INT_MAX-1,INT_MAX-1));
3264 QTest::newRow(dataTag: "EmptyQRect_NegXQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegXQPoint)
3265 << QRect(QPoint(-12,7), QPoint(-13,6));
3266 QTest::newRow(dataTag: "EmptyQRect_NegYQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegYQPoint)
3267 << QRect(QPoint(12,-7), QPoint(11,-8));
3268 QTest::newRow(dataTag: "EmptyQRect_RandomQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: RandomQPoint)
3269 << QRect(QPoint(12,7), QPoint(11,6));
3270 }
3271}
3272
3273void tst_QRect::newMoveTopLeft()
3274{
3275 QFETCH(QRect,r);
3276 QFETCH(QPoint,topLeft);
3277 QFETCH(QRect,nr);
3278
3279 r.moveTopLeft(p: topLeft);
3280
3281 QCOMPARE(r,nr);
3282}
3283
3284void tst_QRect::newMoveBottomRight_data()
3285{
3286 QTest::addColumn<QRect>(name: "r");
3287 QTest::addColumn<QPoint>(name: "bottomRight");
3288 QTest::addColumn<QRect>(name: "nr");
3289
3290 {
3291 QTest::newRow(dataTag: "InvalidQRect_NullQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NullQPoint)
3292 << QRect(QPoint(0+(0-(-1)),0+(0-(-1))), QPoint(0,0));
3293 QTest::newRow(dataTag: "InvalidQRect_SmallestCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: SmallestCoordQPoint)
3294 << QRect(QPoint(0+(INT_MIN-(-1)),0+(INT_MIN-(-1))), QPoint(INT_MIN,INT_MIN));
3295 QTest::newRow(dataTag: "InvalidQRect_MiddleNegCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3296 << QRect(QPoint(0+((INT_MIN/2)-(-1)),0+((INT_MIN/2)-(-1))), QPoint(INT_MIN/2,INT_MIN/2));
3297 QTest::newRow(dataTag: "InvalidQRect_MiddlePosCoordQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3298 << QRect(QPoint(0+((INT_MAX/2)-(-1)),0+((INT_MAX/2)-(-1))), QPoint(INT_MAX/2,INT_MAX/2));
3299 // QTest::newRow("InvalidQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3300 QTest::newRow(dataTag: "InvalidQRect_NegXQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegXQPoint)
3301 << QRect(QPoint(0+(-12-(-1)),0+(7-(-1))), QPoint(-12,7));
3302 QTest::newRow(dataTag: "InvalidQRect_NegYQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: NegYQPoint)
3303 << QRect(QPoint(0+(12-(-1)),0+(-7-(-1))), QPoint(12,-7));
3304 QTest::newRow(dataTag: "InvalidQRect_RandomQPoint") << getQRectCase(c: InvalidQRect) << getQPointCase(p: RandomQPoint)
3305 << QRect(QPoint(0+(12-(-1)),0+(7-(-1))), QPoint(12,7));
3306 }
3307
3308 {
3309 QTest::newRow(dataTag: "SmallestQRect_NullQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NullQPoint)
3310 << QRect(QPoint(1+(0-1),1+(0-1)), QPoint(0,0));
3311 // QTest::newRow("SmallestQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3312 QTest::newRow(dataTag: "SmallestQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3313 << QRect(QPoint(1+((INT_MIN/2)-1),1+((INT_MIN/2)-1)), QPoint(INT_MIN/2,INT_MIN/2));
3314 QTest::newRow(dataTag: "SmallestQRect_MiddlePosCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3315 << QRect(QPoint(1+((INT_MAX/2)-1),1+((INT_MAX/2)-1)), QPoint(INT_MAX/2,INT_MAX/2));
3316 QTest::newRow(dataTag: "SmallestQRect_LargestCoordQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: LargestCoordQPoint)
3317 << QRect(QPoint(1+(INT_MAX-1),1+(INT_MAX-1)), QPoint(INT_MAX,INT_MAX));
3318 QTest::newRow(dataTag: "SmallestQRect_NegXQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegXQPoint)
3319 << QRect(QPoint(1+(-12-1),1+(7-1)), QPoint(-12,7));
3320 QTest::newRow(dataTag: "SmallestQRect_NegYQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: NegYQPoint)
3321 << QRect(QPoint(1+(12-1),1+(-7-1)), QPoint(12,-7));
3322 QTest::newRow(dataTag: "SmallestQRect_RandomQPoint") << getQRectCase(c: SmallestQRect) << getQPointCase(p: RandomQPoint)
3323 << QRect(QPoint(1+(12-1),1+(7-1)), QPoint(12,7));
3324 }
3325
3326 {
3327 QTest::newRow(dataTag: "MiddleQRect_NullQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: NullQPoint)
3328 << QRect(QPoint(INT_MIN/2+(0-(INT_MAX/2)),INT_MIN/2+(0-(INT_MAX/2))), QPoint(0,0));
3329 // QTest::newRow("MiddleQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3330 // QTest::newRow("MiddleQRect_MiddleNegCoordQPoint") -- Not tested as it would cause an overflow
3331 QTest::newRow(dataTag: "MiddleQRect_MiddlePosCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3332 << QRect(QPoint(INT_MIN/2+((INT_MAX/2)-(INT_MAX/2)),INT_MIN/2+((INT_MAX/2)-(INT_MAX/2))), QPoint(INT_MAX/2,INT_MAX/2));
3333 QTest::newRow(dataTag: "MiddleQRect_LargestCoordQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: LargestCoordQPoint)
3334 << QRect(QPoint(INT_MIN/2+(INT_MAX-(INT_MAX/2)),INT_MIN/2+(INT_MAX-(INT_MAX/2))), QPoint(INT_MAX,INT_MAX));
3335 // QTest::newRow("MiddleQRect_NegXQPoint") -- Not tested as it would cause an overflow
3336 // QTest::newRow("MiddleQRect_NegYQPoint") -- Not tested as it would cause an overflow
3337 QTest::newRow(dataTag: "MiddleQRect_RandomQPoint") << getQRectCase(c: MiddleQRect) << getQPointCase(p: RandomQPoint)
3338 << QRect(QPoint(INT_MIN/2+(12-(INT_MAX/2)),INT_MIN/2+(7-(INT_MAX/2))), QPoint(12,7));
3339 }
3340
3341 {
3342 QTest::newRow(dataTag: "LargestQRect_NullQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: NullQPoint)
3343 << QRect(QPoint(0+(0-(INT_MAX-1)),0+(0-(INT_MAX-1))), QPoint(0,0));
3344 // QTest::newRow("LargestQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3345 // QTest::newRow("LargestQRect_MiddleNegCoordQPoint") -- Not tested as it would cause an overflow
3346 QTest::newRow(dataTag: "LargestQRect_MiddlePosCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3347 << QRect(QPoint(0+((INT_MAX/2)-(INT_MAX-1)),0+((INT_MAX/2)-(INT_MAX-1))), QPoint(INT_MAX/2,INT_MAX/2));
3348 QTest::newRow(dataTag: "LargestQRect_LargestCoordQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: LargestCoordQPoint)
3349 << QRect(QPoint(0+(INT_MAX-(INT_MAX-1)),0+(INT_MAX-(INT_MAX-1))), QPoint(INT_MAX,INT_MAX));
3350 // QTest::newRow("LargestQRect_NegXQPoint") -- Not tested as it would cause an overflow
3351 // QTest::newRow("LargestQRect_NegYQPoint") -- Not tested as it would cause an overflow
3352 QTest::newRow(dataTag: "LargestQRect_RandomQPoint") << getQRectCase(c: LargestQRect) << getQPointCase(p: RandomQPoint)
3353 << QRect(QPoint(0+(12-(INT_MAX-1)),0+(7-(INT_MAX-1))), QPoint(12,7));
3354 }
3355
3356 {
3357 // QTest::newRow("SmallestCoordQRect_NullQPoint") -- Not tested as it would cause an overflow
3358 QTest::newRow(dataTag: "SmallestCoordQRect_SmallestCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: SmallestCoordQPoint)
3359 << QRect(QPoint(INT_MIN+(INT_MIN-INT_MIN),INT_MIN+(INT_MIN-INT_MIN)), QPoint(INT_MIN,INT_MIN));
3360 QTest::newRow(dataTag: "SmallestCoordQRect_MiddleNegCoordQPoint") << getQRectCase(c: SmallestCoordQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3361 << QRect(QPoint(INT_MIN+((INT_MIN/2)-INT_MIN),INT_MIN+((INT_MIN/2)-INT_MIN)), QPoint(INT_MIN/2,INT_MIN/2));
3362 // QTest::newRow("SmallestCoordQRect_MiddlePosCoordQPoint") -- Not tested as it would cause an overflow
3363 // QTest::newRow("SmallestCoordQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3364 // QTest::newRow("SmallestCoordQRect_NegXQPoint") -- Not tested as it would cause an overflow
3365 // QTest::newRow("SmallestCoordQRect_NegYQPoint") -- Not tested as it would cause an overflow
3366 // QTest::newRow("SmallestCoordQRect_RandomQPoint") -- Not tested as it would cause an overflow
3367 }
3368
3369 {
3370 // QTest::newRow("LargestCoordQRect_NullQPoint") -- Not tested as it would cause an overflow
3371 // QTest::newRow("LargestCoordQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3372 // QTest::newRow("LargestCoordQRect_MiddleNegCoordQPoint") -- Not tested as it would cause an overflow
3373 // QTest::newRow("LargestCoordQRect_MiddlePosCoordQPoint") -- Not tested as it would cause an overflow
3374 QTest::newRow(dataTag: "LargestCoordQRect_LargestCoordQPoint") << getQRectCase(c: LargestCoordQRect) << getQPointCase(p: LargestCoordQPoint)
3375 << QRect(QPoint(INT_MIN+(INT_MAX-INT_MAX),INT_MIN+(INT_MAX-INT_MAX)), QPoint(INT_MAX,INT_MAX));
3376 // QTest::newRow("LargestCoordQRect_NegXQPoint") -- Not tested as it would cause an overflow
3377 // QTest::newRow("LargestCoordQRect_NegYQPoint") -- Not tested as it would cause an overflow
3378 // QTest::newRow("LargestCoordQRect_RandomQPoint") -- Not tested as it would cause an overflow
3379 }
3380
3381 {
3382 QTest::newRow(dataTag: "RandomQRect_NullQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NullQPoint)
3383 << QRect(QPoint(100+(0-110),200+(0-215)), QPoint(0,0));
3384 // QTest::newRow("RandomQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3385 QTest::newRow(dataTag: "RandomQRect_MiddleNegCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3386 << QRect(QPoint(100+((INT_MIN/2)-110),200+((INT_MIN/2)-215)), QPoint(INT_MIN/2,INT_MIN/2));
3387 QTest::newRow(dataTag: "RandomQRect_MiddlePosCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3388 << QRect(QPoint(100+((INT_MAX/2)-110),200+((INT_MAX/2)-215)), QPoint(INT_MAX/2,INT_MAX/2));
3389 QTest::newRow(dataTag: "RandomQRect_LargestCoordQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: LargestCoordQPoint)
3390 << QRect(QPoint(100+(INT_MAX-110),200+(INT_MAX-215)), QPoint(INT_MAX,INT_MAX));
3391 QTest::newRow(dataTag: "RandomQRect_NegXQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegXQPoint)
3392 << QRect(QPoint(100+(-12-110),200+(7-215)), QPoint(-12,7));
3393 QTest::newRow(dataTag: "RandomQRect_NegYQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: NegYQPoint)
3394 << QRect(QPoint(100+(12-110),200+(-7-215)), QPoint(12,-7));
3395 QTest::newRow(dataTag: "RandomQRect_RandomQPoint") << getQRectCase(c: RandomQRect) << getQPointCase(p: RandomQPoint)
3396 << QRect(QPoint(100+(12-110),200+(7-215)), QPoint(12,7));
3397 }
3398
3399 {
3400 QTest::newRow(dataTag: "NegativeSizeQRect_NullQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NullQPoint)
3401 << QRect(QPoint(1+(0-(-10)),1+(0-(-10))), QPoint(0,0));
3402 QTest::newRow(dataTag: "NegativeSizeQRect_SmallestCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: SmallestCoordQPoint)
3403 << QRect(QPoint(1+(INT_MIN-(-10)),1+(INT_MIN-(-10))), QPoint(INT_MIN,INT_MIN));
3404 QTest::newRow(dataTag: "NegativeSizeQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3405 << QRect(QPoint(1+((INT_MIN/2)-(-10)),1+((INT_MIN/2)-(-10))), QPoint(INT_MIN/2,INT_MIN/2));
3406 QTest::newRow(dataTag: "NegativeSizeQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3407 << QRect(QPoint(1+((INT_MAX/2)-(-10)),1+((INT_MAX/2)-(-10))), QPoint(INT_MAX/2,INT_MAX/2));
3408 // QTest::newRow("NegativeSizeQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3409 QTest::newRow(dataTag: "NegativeSizeQRect_NegXQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegXQPoint)
3410 << QRect(QPoint(1+(-12-(-10)),1+(7-(-10))), QPoint(-12,7));
3411 QTest::newRow(dataTag: "NegativeSizeQRect_NegYQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: NegYQPoint)
3412 << QRect(QPoint(1+(12-(-10)),1+(-7-(-10))), QPoint(12,-7));
3413 QTest::newRow(dataTag: "NegativeSizeQRect_RandomQPoint") << getQRectCase(c: NegativeSizeQRect) << getQPointCase(p: RandomQPoint)
3414 << QRect(QPoint(1+(12-(-10)),1+(7-(-10))), QPoint(12,7));
3415 }
3416
3417 {
3418 QTest::newRow(dataTag: "NegativePointQRect_NullQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NullQPoint)
3419 << QRect(QPoint((-10)+(0-(-6)),(-10)+(0-(-6))), QPoint(0,0));
3420 // QTest::newRow("NegativePointQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3421 QTest::newRow(dataTag: "NegativePointQRect_MiddleNegCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3422 << QRect(QPoint((-10)+((INT_MIN/2)-(-6)),(-10)+((INT_MIN/2)-(-6))), QPoint(INT_MIN/2,INT_MIN/2));
3423 QTest::newRow(dataTag: "NegativePointQRect_MiddlePosCoordQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3424 << QRect(QPoint((-10)+((INT_MAX/2)-(-6)),(-10)+((INT_MAX/2)-(-6))), QPoint(INT_MAX/2,INT_MAX/2));
3425 // QTest::newRow("NegativePointQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3426 QTest::newRow(dataTag: "NegativePointQRect_NegXQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegXQPoint)
3427 << QRect(QPoint((-10)+(-12-(-6)),(-10)+(7-(-6))), QPoint(-12,7));
3428 QTest::newRow(dataTag: "NegativePointQRect_NegYQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: NegYQPoint)
3429 << QRect(QPoint((-10)+(12-(-6)),(-10)+(-7-(-6))), QPoint(12,-7));
3430 QTest::newRow(dataTag: "NegativePointQRect_RandomQPoint") << getQRectCase(c: NegativePointQRect) << getQPointCase(p: RandomQPoint)
3431 << QRect(QPoint((-10)+(12-(-6)),(-10)+(7-(-6))), QPoint(12,7));
3432 }
3433
3434 {
3435 QTest::newRow(dataTag: "NullQRect_NullQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NullQPoint)
3436 << QRect(QPoint(5+(0-4),5+(0-4)), QPoint(0,0));
3437 // QTest::newRow("NullQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3438 QTest::newRow(dataTag: "NullQRect_MiddleNegCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3439 << QRect(QPoint(5+((INT_MIN/2)-4),5+((INT_MIN/2)-4)), QPoint(INT_MIN/2,INT_MIN/2));
3440 QTest::newRow(dataTag: "NullQRect_MiddlePosCoordQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3441 << QRect(QPoint(5+((INT_MAX/2)-4),5+((INT_MAX/2)-4)), QPoint(INT_MAX/2,INT_MAX/2));
3442 // QTest::newRow("NullQRect_LargestCoordQPoint") -- Not tested as it would cause an overflow
3443 QTest::newRow(dataTag: "NullQRect_NegXQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegXQPoint)
3444 << QRect(QPoint(5+(-12-4),5+(7-4)), QPoint(-12,7));
3445 QTest::newRow(dataTag: "NullQRect_NegYQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: NegYQPoint)
3446 << QRect(QPoint(5+(12-4),5+(-7-4)), QPoint(12,-7));
3447 QTest::newRow(dataTag: "NullQRect_RandomQPoint") << getQRectCase(c: NullQRect) << getQPointCase(p: RandomQPoint)
3448 << QRect(QPoint(5+(12-4),5+(7-4)), QPoint(12,7));
3449 }
3450
3451 {
3452 QTest::newRow(dataTag: "EmptyQRect_NullQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NullQPoint)
3453 << QRect(QPoint(2+(0-1),2+(0-1)), QPoint(0,0));
3454 // QTest::newRow("EmptyQRect_SmallestCoordQPoint") -- Not tested as it would cause an overflow
3455 QTest::newRow(dataTag: "EmptyQRect_MiddleNegCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddleNegCoordQPoint)
3456 << QRect(QPoint(2+((INT_MIN/2)-1),2+((INT_MIN/2)-1)), QPoint(INT_MIN/2,INT_MIN/2));
3457 QTest::newRow(dataTag: "EmptyQRect_MiddlePosCoordQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: MiddlePosCoordQPoint)
3458 << QRect(QPoint(2+((INT_MAX/2)-1),2+((INT_MAX/2)-1)), QPoint(INT_MAX/2,INT_MAX/2));
3459 // QTest::newRow("EmptyQRect_LargestCoordQPoint") << getQRectCase(EmptyQRect) -- Not tested as it would cause an overflow
3460 QTest::newRow(dataTag: "EmptyQRect_NegXQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegXQPoint)
3461 << QRect(QPoint(2+(-12-1),2+(7-1)), QPoint(-12,7));
3462 QTest::newRow(dataTag: "EmptyQRect_NegYQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: NegYQPoint)
3463 << QRect(QPoint(2+(12-1),2+(-7-1)), QPoint(12,-7));
3464 QTest::newRow(dataTag: "EmptyQRect_RandomQPoint") << getQRectCase(c: EmptyQRect) << getQPointCase(p: RandomQPoint)
3465 << QRect(QPoint(2+(12-1),2+(7-1)), QPoint(12,7));
3466 }
3467}
3468
3469void tst_QRect::newMoveBottomRight()
3470{
3471 QFETCH(QRect,r);
3472 QFETCH(QPoint,bottomRight);
3473 QFETCH(QRect,nr);
3474
3475 r.moveBottomRight(p: bottomRight);
3476
3477 QCOMPARE(r,nr);
3478}
3479
3480void tst_QRect::margins()
3481{
3482 const QRect rectangle = QRect(QPoint(10, 10), QSize(50 ,50));
3483 const QMargins margins = QMargins(2, 3, 4, 5);
3484
3485 const QRect added = rectangle + margins;
3486 QCOMPARE(added, QRect(QPoint(8, 7), QSize(56, 58)));
3487 QCOMPARE(added, margins + rectangle);
3488 QCOMPARE(added, rectangle.marginsAdded(margins));
3489
3490 const QRect subtracted = rectangle - margins;
3491 QCOMPARE(subtracted, QRect(QPoint(12, 13), QSize(44, 42)));
3492 QCOMPARE(subtracted, rectangle.marginsRemoved(margins));
3493
3494 QRect a = rectangle;
3495 a += margins;
3496 QCOMPARE(added, a);
3497
3498 a = rectangle;
3499 a -= margins;
3500 QCOMPARE(a, QRect(QPoint(12, 13), QSize(44, 42)));
3501 QCOMPARE(a, rectangle.marginsRemoved(margins));
3502}
3503
3504void tst_QRect::marginsf()
3505{
3506 const QRectF rectangle = QRectF(QPointF(10.5, 10.5), QSizeF(50.5 ,150.5));
3507 const QMarginsF margins = QMarginsF(2.5, 3.5, 4.5, 5.5);
3508
3509 const QRectF added = rectangle + margins;
3510 QCOMPARE(added, QRectF(QPointF(8.0, 7.0), QSizeF(57.5, 159.5)));
3511 QCOMPARE(added, margins + rectangle);
3512 QCOMPARE(added, rectangle.marginsAdded(margins));
3513
3514 const QRectF subtracted = rectangle - margins;
3515 QCOMPARE(subtracted, QRectF(QPointF(13.0, 14.0), QSizeF(43.5, 141.5)));
3516 QCOMPARE(subtracted, rectangle.marginsRemoved(margins));
3517
3518 QRectF a = rectangle;
3519 a += margins;
3520 QCOMPARE(added, a);
3521
3522 a = rectangle;
3523 a -= margins;
3524 QCOMPARE(a, QRectF(QPoint(13.0, 14.0), QSizeF(43.5, 141.5)));
3525 QCOMPARE(a, rectangle.marginsRemoved(margins));
3526}
3527
3528void tst_QRect::translate_data()
3529{
3530 QTest::addColumn<QRect>(name: "r");
3531 QTest::addColumn<QPoint>(name: "delta");
3532 QTest::addColumn<QRect>(name: "result");
3533
3534 QTest::newRow(dataTag: "Case 1") << QRect(10,20,5,15) << QPoint(3,7) << QRect(13,27,5,15);
3535 QTest::newRow(dataTag: "Case 2") << QRect(0,0,-1,-1) << QPoint(3,7) << QRect(3,7,-1,-1);
3536 QTest::newRow(dataTag: "Case 3") << QRect(0,0,-1,-1) << QPoint(0,0) << QRect(0,0,-1,-1);
3537 QTest::newRow(dataTag: "Case 4") << QRect(10,20,5,15) << QPoint(3,0) << QRect(13,20, 5,15);
3538 QTest::newRow(dataTag: "Case 5") << QRect(10,20,5,15) << QPoint(0,7) << QRect(10,27,5,15);
3539 QTest::newRow(dataTag: "Case 6") << QRect(10,20,5,15) << QPoint(-3,7) << QRect(7,27,5,15);
3540 QTest::newRow(dataTag: "Case 7") << QRect(10,20,5,15) << QPoint(3,-7) << QRect(13,13,5,15);
3541}
3542
3543void tst_QRect::translate()
3544{
3545 QFETCH(QRect, r);
3546 QFETCH(QPoint, delta);
3547 QFETCH(QRect, result);
3548
3549 QRect oldr = r;
3550 QRect r2 = r;
3551 r2.translate(p: delta);
3552 QCOMPARE(result,r2);
3553
3554 r2 = r;
3555 r2.translate(dx: delta.x(), dy: delta.y());
3556 QCOMPARE(result,r2);
3557
3558 r2 = r.translated(p: delta);
3559 QCOMPARE(result,r2);
3560 QCOMPARE(oldr,r); //r should not change
3561
3562 r2 = r.translated(dx: delta.x(), dy: delta.y());
3563 QCOMPARE(result,r2);
3564 QCOMPARE(oldr,r);
3565
3566}
3567
3568void tst_QRect::transposed_data()
3569{
3570 QTest::addColumn<QRect>(name: "r");
3571
3572 QTest::newRow(dataTag: "InvalidQRect") << getQRectCase(c: InvalidQRect);
3573 QTest::newRow(dataTag: "SmallestQRect") << getQRectCase(c: SmallestQRect);
3574 QTest::newRow(dataTag: "MiddleQRect") << getQRectCase(c: MiddleQRect);
3575 QTest::newRow(dataTag: "LargestQRect") << getQRectCase(c: LargestQRect);
3576 QTest::newRow(dataTag: "SmallestCoordQRect") << getQRectCase(c: SmallestCoordQRect);
3577 QTest::newRow(dataTag: "LargestCoordQRect") << getQRectCase(c: LargestCoordQRect);
3578 QTest::newRow(dataTag: "RandomQRect") << getQRectCase(c: RandomQRect);
3579 QTest::newRow(dataTag: "NegativeSizeQRect") << getQRectCase(c: NegativeSizeQRect);
3580 QTest::newRow(dataTag: "NegativePointQRect") << getQRectCase(c: NegativePointQRect);
3581 QTest::newRow(dataTag: "NullQRect") << getQRectCase(c: NullQRect);
3582 QTest::newRow(dataTag: "EmptyQRect") << getQRectCase(c: EmptyQRect);
3583}
3584
3585void tst_QRect::transposed()
3586{
3587 QFETCH(QRect, r);
3588
3589 const QRect rt = r.transposed();
3590 QCOMPARE(rt.height(), r.width());
3591 QCOMPARE(rt.width(), r.height());
3592 QCOMPARE(rt.topLeft(), r.topLeft());
3593
3594 const QRectF rf = r;
3595
3596 const QRectF rtf = rf.transposed();
3597 QCOMPARE(rtf.height(), rf.width());
3598 QCOMPARE(rtf.width(), rf.height());
3599 QCOMPARE(rtf.topLeft(), rf.topLeft());
3600
3601 QCOMPARE(rtf, QRectF(rt));
3602}
3603
3604void tst_QRect::moveTop()
3605{
3606 {
3607 QRect r( 10, 10, 100, 100 );
3608 r.moveTop( pos: 3 );
3609 QCOMPARE( r, QRect(10, 3, 100, 100) );
3610
3611 r = QRect( 10, 3, 100, 100 );
3612 r.moveTop( pos: -22 );
3613 QCOMPARE( r, QRect(10, -22, 100, 100) );
3614 }
3615 {
3616 QRectF r( 10, 10, 100, 100 );
3617 r.moveTop( pos: 3 );
3618 QCOMPARE( r, QRectF(10, 3, 100, 100) );
3619
3620 r = QRectF( 10, 3, 100, 100 );
3621 r.moveTop( pos: -22 );
3622 QCOMPARE( r, QRectF(10, -22, 100, 100) );
3623 }
3624}
3625
3626void tst_QRect::moveBottom()
3627{
3628 {
3629 QRect r( 10, -22, 100, 100 );
3630 r.moveBottom( pos: 104 );
3631 QCOMPARE( r, QRect(10, 5, 100, 100) );
3632 }
3633 {
3634 QRectF r( 10, -22, 100, 100 );
3635 r.moveBottom( pos: 104 );
3636 QCOMPARE( r, QRectF(10, 4, 100, 100) );
3637 }
3638}
3639
3640void tst_QRect::moveLeft()
3641{
3642 {
3643 QRect r( 10, 5, 100, 100 );
3644 r.moveLeft( pos: 11 );
3645 QCOMPARE( r, QRect(11, 5, 100, 100) );
3646 }
3647 {
3648 QRectF r( 10, 5, 100, 100 );
3649 r.moveLeft( pos: 11 );
3650 QCOMPARE( r, QRectF(11, 5, 100, 100) );
3651 }
3652}
3653
3654void tst_QRect::moveRight()
3655{
3656 {
3657 QRect r( 11, 5, 100, 100 );
3658 r.moveRight( pos: 106 );
3659 QCOMPARE( r, QRect(7, 5, 100, 100) );
3660 }
3661 {
3662 QRectF r( 11, 5, 100, 100 );
3663 r.moveRight( pos: 106 );
3664 QCOMPARE( r, QRectF(6, 5, 100, 100) );
3665 }
3666}
3667
3668void tst_QRect::moveTopLeft()
3669{
3670 {
3671 QRect r( 7, 5, 100, 100 );
3672 r.moveTopLeft( p: QPoint(1, 2) );
3673 QCOMPARE( r, QRect(1, 2, 100, 100) );
3674 }
3675 {
3676 QRectF r( 7, 5, 100, 100 );
3677 r.moveTopLeft( p: QPoint(1, 2) );
3678 QCOMPARE( r, QRectF(1, 2, 100, 100) );
3679 }
3680}
3681
3682void tst_QRect::moveTopRight()
3683{
3684 {
3685 QRect r( 1, 2, 100, 100 );
3686 r.moveTopRight( p: QPoint(103, 5) );
3687 QCOMPARE( r, QRect(4, 5, 100, 100) );
3688 }
3689 {
3690 QRectF r( 1, 2, 100, 100 );
3691 r.moveTopRight( p: QPoint(103, 5) );
3692 QCOMPARE( r, QRectF(3, 5, 100, 100) );
3693 }
3694}
3695
3696void tst_QRect::moveBottomLeft()
3697{
3698 {
3699 QRect r( 4, 5, 100, 100 );
3700 r.moveBottomLeft( p: QPoint(3, 105) );
3701 QCOMPARE( r, QRect(3, 6, 100, 100) );
3702 }
3703 {
3704 QRectF r( 4, 5, 100, 100 );
3705 r.moveBottomLeft( p: QPoint(3, 105) );
3706 QCOMPARE( r, QRectF(3, 5, 100, 100) );
3707 }
3708}
3709
3710void tst_QRect::moveBottomRight()
3711{
3712 {
3713 QRect r( 3, 6, 100, 100 );
3714 r.moveBottomRight( p: QPoint(103, 105) );
3715 QCOMPARE( r, QRect(4, 6, 100, 100) );
3716 }
3717 {
3718 QRectF r( 3, 6, 100, 100 );
3719 r.moveBottomRight( p: QPoint(103, 105) );
3720 QCOMPARE( r, QRectF(3, 5, 100, 100) );
3721 }
3722}
3723
3724void tst_QRect::setTopLeft()
3725{
3726 {
3727 QRect r( 20, 10, 200, 100 );
3728 r.setTopLeft( QPoint(5, 7) );
3729 QCOMPARE( r, QRect(5, 7, 215, 103) );
3730 }
3731 {
3732 QRectF r( 20, 10, 200, 100 );
3733 r.setTopLeft( QPoint(5, 7) );
3734 QCOMPARE( r, QRectF(5, 7, 215, 103) );
3735 }
3736}
3737
3738void tst_QRect::setTopRight()
3739{
3740 {
3741 QRect r( 20, 10, 200, 100 );
3742 r.setTopRight( QPoint(225, 7) );
3743 QCOMPARE( r, QRect(20, 7, 206, 103) );
3744 }
3745 {
3746 QRectF r( 20, 10, 200, 100 );
3747 r.setTopRight( QPoint(225, 7) );
3748 QCOMPARE( r, QRectF(20, 7, 205, 103) );
3749 }
3750}
3751
3752void tst_QRect::setBottomLeft()
3753{
3754 {
3755 QRect r( 20, 10, 200, 100 );
3756 r.setBottomLeft( QPoint(5, 117) );
3757 QCOMPARE( r, QRect(5, 10, 215, 108) );
3758 }
3759 {
3760 QRectF r( 20, 10, 200, 100 );
3761 r.setBottomLeft( QPoint(5, 117) );
3762 QCOMPARE( r, QRectF(5, 10, 215, 107) );
3763 }
3764}
3765
3766void tst_QRect::setBottomRight()
3767{
3768 {
3769 QRect r( 20, 10, 200, 100 );
3770 r.setBottomRight( QPoint(225, 117) );
3771 QCOMPARE( r, QRect(20, 10, 206, 108) );
3772 }
3773 {
3774 QRectF r( 20, 10, 200, 100 );
3775 r.setBottomRight( QPoint(225, 117) );
3776 QCOMPARE( r, QRectF(20, 10, 205, 107) );
3777 }
3778}
3779
3780void tst_QRect::operator_amp()
3781{
3782 QRect r( QPoint(20, 10), QPoint(200, 100) );
3783 QRect r2( QPoint(50, 50), QPoint(300, 300) );
3784 QRect r3 = r & r2;
3785 QCOMPARE( r3, QRect( QPoint(50, 50), QPoint(200, 100) ) );
3786 QVERIFY( !r3.isEmpty() );
3787 QVERIFY( r3.isValid() );
3788
3789 QRect r4( QPoint(300, 300), QPoint(400, 400) );
3790 QRect r5 = r & r4;
3791 QVERIFY( r5.isEmpty() );
3792 QVERIFY( !r5.isValid() );
3793}
3794
3795void tst_QRect::operator_amp_eq()
3796{
3797 QRect r( QPoint(20, 10), QPoint(200, 100) );
3798 QRect r2( QPoint(50, 50), QPoint(300, 300) );
3799 r &= r2;
3800 QCOMPARE( r, QRect( QPoint(50, 50), QPoint(200, 100) ) );
3801 QVERIFY( !r.isEmpty() );
3802 QVERIFY( r.isValid() );
3803
3804 QRect r3( QPoint(300, 300), QPoint(400, 400) );
3805 r &= r3;
3806 QVERIFY( r.isEmpty() );
3807 QVERIFY( !r.isValid() );
3808}
3809
3810void tst_QRect::isValid()
3811{
3812 QRect r;
3813 QVERIFY( !r.isValid() );
3814 QRect r2( 0, 0, 0, 0 );
3815 QVERIFY( !r2.isValid() );
3816 QRect r3( 100, 200, 300, 400 );
3817 QVERIFY( r3.isValid() );
3818}
3819
3820void tst_QRect::isEmpty()
3821{
3822 QRect r;
3823 QVERIFY( r.isEmpty() );
3824 QRect r2( 0, 0, 0, 0 );
3825 QVERIFY( r2.isEmpty() );
3826 QRect r3( 100, 200, 300, 400 );
3827 QVERIFY( !r3.isEmpty() );
3828 QRect r4( QPoint(300, 100), QPoint(200, 200) );
3829 QVERIFY( r4.isEmpty() );
3830 QRect r5( QPoint(200, 200), QPoint(200, 100) );
3831 QVERIFY( r5.isEmpty() );
3832 QRect r6( QPoint(300, 200), QPoint(200, 100) );
3833 QVERIFY( r6.isEmpty() );
3834}
3835
3836
3837void tst_QRect::testAdjust_data()
3838{
3839 QTest::addColumn<QRect>(name: "original");
3840 QTest::addColumn<int>(name: "x1_adjust");
3841 QTest::addColumn<int>(name: "y1_adjust");
3842 QTest::addColumn<int>(name: "x2_adjust");
3843 QTest::addColumn<int>(name: "y2_adjust");
3844 QTest::addColumn<QRect>(name: "expected");
3845
3846 QTest::newRow(dataTag: "test 01") << QRect(13, 12, 11, 10) << 4 << 3 << 2 << 1 << QRect(17, 15, 9, 8);
3847 QTest::newRow(dataTag: "test 02") << QRect(13, 12, 11, 10) << 4 << 3 << 2 << 0 << QRect(17, 15, 9, 7);
3848 QTest::newRow(dataTag: "test 03") << QRect(13, 12, 11, 10) << 4 << 3 << 0 << 1 << QRect(17, 15, 7, 8);
3849 QTest::newRow(dataTag: "test 04") << QRect(13, 12, 11, 10) << 4 << 3 << 0 << 0 << QRect(17, 15, 7, 7);
3850 QTest::newRow(dataTag: "test 05") << QRect(13, 12, 11, 10) << 4 << 0 << 2 << 1 << QRect(17, 12, 9, 11);
3851 QTest::newRow(dataTag: "test 06") << QRect(13, 12, 11, 10) << 4 << 0 << 2 << 0 << QRect(17, 12, 9, 10);
3852 QTest::newRow(dataTag: "test 07") << QRect(13, 12, 11, 10) << 4 << 0 << 0 << 1 << QRect(17, 12, 7, 11);
3853 QTest::newRow(dataTag: "test 08") << QRect(13, 12, 11, 10) << 4 << 0 << 0 << 0 << QRect(17, 12, 7, 10);
3854 QTest::newRow(dataTag: "test 09") << QRect(13, 12, 11, 10) << 0 << 3 << 2 << 1 << QRect(13, 15, 13, 8);
3855 QTest::newRow(dataTag: "test 10") << QRect(13, 12, 11, 10) << 0 << 3 << 2 << 0 << QRect(13, 15, 13, 7);
3856 QTest::newRow(dataTag: "test 11") << QRect(13, 12, 11, 10) << 0 << 3 << 0 << 1 << QRect(13, 15, 11, 8);
3857 QTest::newRow(dataTag: "test 12") << QRect(13, 12, 11, 10) << 0 << 3 << 0 << 0 << QRect(13, 15, 11, 7);
3858 QTest::newRow(dataTag: "test 13") << QRect(13, 12, 11, 10) << 0 << 0 << 2 << 1 << QRect(13, 12, 13, 11);
3859 QTest::newRow(dataTag: "test 14") << QRect(13, 12, 11, 10) << 0 << 0 << 2 << 0 << QRect(13, 12, 13, 10);
3860 QTest::newRow(dataTag: "test 15") << QRect(13, 12, 11, 10) << 0 << 0 << 0 << 1 << QRect(13, 12, 11, 11);
3861 QTest::newRow(dataTag: "test 16") << QRect(13, 12, 11, 10) << 0 << 0 << 0 << 0 << QRect(13, 12, 11, 10);
3862
3863 QTest::newRow(dataTag: "test 17") << QRect(13, 12, 11, 10) << -4 << -3 << -2 << -1 << QRect( 9, 9, 13, 12);
3864 QTest::newRow(dataTag: "test 18") << QRect(13, 12, 11, 10) << -4 << -3 << -2 << 0 << QRect( 9, 9, 13, 13);
3865 QTest::newRow(dataTag: "test 19") << QRect(13, 12, 11, 10) << -4 << -3 << 0 << -1 << QRect( 9, 9, 15, 12);
3866 QTest::newRow(dataTag: "test 20") << QRect(13, 12, 11, 10) << -4 << -3 << 0 << 0 << QRect( 9, 9, 15, 13);
3867 QTest::newRow(dataTag: "test 21") << QRect(13, 12, 11, 10) << -4 << 0 << -2 << -1 << QRect( 9, 12, 13, 9);
3868 QTest::newRow(dataTag: "test 22") << QRect(13, 12, 11, 10) << -4 << 0 << -2 << 0 << QRect( 9, 12, 13, 10);
3869 QTest::newRow(dataTag: "test 23") << QRect(13, 12, 11, 10) << -4 << 0 << 0 << -1 << QRect( 9, 12, 15, 9);
3870 QTest::newRow(dataTag: "test 24") << QRect(13, 12, 11, 10) << -4 << 0 << 0 << 0 << QRect( 9, 12, 15, 10);
3871 QTest::newRow(dataTag: "test 25") << QRect(13, 12, 11, 10) << 0 << -3 << -2 << -1 << QRect(13, 9, 9, 12);
3872 QTest::newRow(dataTag: "test 26") << QRect(13, 12, 11, 10) << 0 << -3 << -2 << 0 << QRect(13, 9, 9, 13);
3873 QTest::newRow(dataTag: "test 27") << QRect(13, 12, 11, 10) << 0 << -3 << 0 << -1 << QRect(13, 9, 11, 12);
3874 QTest::newRow(dataTag: "test 28") << QRect(13, 12, 11, 10) << 0 << -3 << 0 << 0 << QRect(13, 9, 11, 13);
3875 QTest::newRow(dataTag: "test 29") << QRect(13, 12, 11, 10) << 0 << 0 << -2 << -1 << QRect(13, 12, 9, 9);
3876 QTest::newRow(dataTag: "test 30") << QRect(13, 12, 11, 10) << 0 << 0 << -2 << 0 << QRect(13, 12, 9, 10);
3877 QTest::newRow(dataTag: "test 31") << QRect(13, 12, 11, 10) << 0 << 0 << 0 << -1 << QRect(13, 12, 11, 9);
3878 QTest::newRow(dataTag: "test 32") << QRect(13, 12, 11, 10) << 0 << 0 << 0 << 0 << QRect(13, 12, 11, 10);
3879
3880}
3881
3882void tst_QRect::testAdjust()
3883{
3884 QFETCH(QRect, original);
3885 QFETCH(int, x1_adjust);
3886 QFETCH(int, y1_adjust);
3887 QFETCH(int, x2_adjust);
3888 QFETCH(int, y2_adjust);
3889 QFETCH(QRect, expected);
3890
3891 {
3892 QRect r1 = original;
3893 r1.adjust(dx1: x1_adjust, dy1: y1_adjust, dx2: x2_adjust, dy2: y2_adjust);
3894 QCOMPARE(r1.x(), expected.x());
3895 QCOMPARE(r1.y(), expected.y());
3896 QCOMPARE(r1.width(), expected.width());
3897 QCOMPARE(r1.height(), expected.height());
3898
3899 QRect r2 = original.adjusted(xp1: x1_adjust, yp1: y1_adjust, xp2: x2_adjust, yp2: y2_adjust);
3900 QCOMPARE(r2.x(), expected.x());
3901 QCOMPARE(r2.y(), expected.y());
3902 QCOMPARE(r2.width(), expected.width());
3903 QCOMPARE(r2.height(), expected.height());
3904 }
3905 {
3906 QRectF expectedF(expected);
3907
3908 QRectF r1 = original;
3909 r1.adjust(xp1: x1_adjust, yp1: y1_adjust, xp2: x2_adjust, yp2: y2_adjust);
3910 QCOMPARE(r1.x(), expectedF.x());
3911 QCOMPARE(r1.y(), expectedF.y());
3912 QCOMPARE(r1.width(), expectedF.width());
3913 QCOMPARE(r1.height(), expectedF.height());
3914
3915 QRectF r2 = original.adjusted(xp1: x1_adjust, yp1: y1_adjust, xp2: x2_adjust, yp2: y2_adjust);
3916 QCOMPARE(r2.x(), expectedF.x());
3917 QCOMPARE(r2.y(), expectedF.y());
3918 QCOMPARE(r2.width(), expectedF.width());
3919 QCOMPARE(r2.height(), expectedF.height());
3920 }
3921}
3922
3923void tst_QRect::intersectedRect_data()
3924{
3925 QTest::addColumn<QRect>(name: "rect1");
3926 QTest::addColumn<QRect>(name: "rect2");
3927 QTest::addColumn<QRect>(name: "intersect");
3928
3929 QTest::newRow(dataTag: "test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << QRect(2, 2, 6, 6);
3930 QTest::newRow(dataTag: "test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << QRect(0, 0, 10, 10);
3931 QTest::newRow(dataTag: "test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << QRect(2, 2, 8, 8);
3932 QTest::newRow(dataTag: "test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << QRect();
3933
3934 QTest::newRow(dataTag: "test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << QRect(2, 2, 6, 6);
3935 QTest::newRow(dataTag: "test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << QRect(0, 0, 10, 10);
3936 QTest::newRow(dataTag: "test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << QRect(2, 2, 8, 8);
3937 QTest::newRow(dataTag: "test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << QRect();
3938
3939 QTest::newRow(dataTag: "test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << QRect(2, 2, 6, 6);
3940 QTest::newRow(dataTag: "test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << QRect(0, 0, 10, 10);
3941 QTest::newRow(dataTag: "test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << QRect(2, 2, 8, 8);
3942 QTest::newRow(dataTag: "test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << QRect();
3943
3944 QTest::newRow(dataTag: "test 13") << QRect(0, 0, 10, 10) << QRect() << QRect();
3945 QTest::newRow(dataTag: "test 14") << QRect() << QRect(0, 0, 10, 10) << QRect();
3946 QTest::newRow(dataTag: "test 15") << QRect() << QRect() << QRect();
3947 QTest::newRow(dataTag: "test 16") << QRect(2, 0, 1, 652) << QRect(2, 0, 1, 652) << QRect(2, 0, 1, 652);
3948}
3949
3950void tst_QRect::intersectedRect()
3951{
3952 QFETCH(QRect, rect1);
3953 QFETCH(QRect, rect2);
3954 QFETCH(QRect, intersect);
3955
3956 if (intersect.isValid())
3957 QCOMPARE(rect1.intersected(rect2), intersect);
3958 else
3959 QVERIFY(rect1.intersected(rect2).isEmpty());
3960
3961 QRect wayOutside(rect1.right() + 100, rect1.bottom() + 100, 10, 10);
3962 QRect empty = rect1 & wayOutside;
3963 QVERIFY(empty.intersected(rect2).isEmpty());
3964}
3965
3966void tst_QRect::intersectedRectF_data()
3967{
3968 QTest::addColumn<QRectF>(name: "rect1");
3969 QTest::addColumn<QRectF>(name: "rect2");
3970 QTest::addColumn<QRectF>(name: "intersect");
3971
3972 QTest::newRow(dataTag: "test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << QRectF(2, 2, 6, 6);
3973 QTest::newRow(dataTag: "test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << QRectF(0, 0, 10, 10);
3974 QTest::newRow(dataTag: "test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << QRectF(2, 2, 8, 8);
3975 QTest::newRow(dataTag: "test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << QRectF();
3976
3977 QTest::newRow(dataTag: "test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << QRectF(2, 2, 6, 6);
3978 QTest::newRow(dataTag: "test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << QRectF(0, 0, 10, 10);
3979 QTest::newRow(dataTag: "test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << QRectF(2, 2, 8, 8);
3980 QTest::newRow(dataTag: "test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << QRectF();
3981
3982 QTest::newRow(dataTag: "test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << QRectF(2, 2, 6, 6);
3983 QTest::newRow(dataTag: "test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << QRectF(0, 0, 10, 10);
3984 QTest::newRow(dataTag: "test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << QRectF(2, 2, 8, 8);
3985 QTest::newRow(dataTag: "test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << QRectF();
3986
3987 QTest::newRow(dataTag: "test 13") << QRectF(-1, 1, 10, 10) << QRectF() << QRectF();
3988 QTest::newRow(dataTag: "test 14") << QRectF() << QRectF(0, 0, 10, 10) << QRectF();
3989 QTest::newRow(dataTag: "test 15") << QRectF() << QRectF() << QRectF();
3990}
3991
3992void tst_QRect::intersectedRectF()
3993{
3994 QFETCH(QRectF, rect1);
3995 QFETCH(QRectF, rect2);
3996 QFETCH(QRectF, intersect);
3997
3998 if (intersect.isValid())
3999 QCOMPARE(rect1.intersected(rect2), intersect);
4000 else
4001 QVERIFY(rect1.intersected(rect2).isEmpty());
4002
4003 QRectF wayOutside(rect1.right() + 100.0, rect1.bottom() + 100.0, 10.0, 10.0);
4004 QRectF empty = rect1 & wayOutside;
4005 QVERIFY(empty.intersected(rect2).isEmpty());
4006}
4007
4008void tst_QRect::unitedRect_data()
4009{
4010 QTest::addColumn<QRect>(name: "rect1");
4011 QTest::addColumn<QRect>(name: "rect2");
4012 QTest::addColumn<QRect>(name: "unite");
4013
4014 QTest::newRow(dataTag: "test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << QRect(0, 0, 10, 10);
4015 QTest::newRow(dataTag: "test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << QRect(0, 0, 10, 10);
4016 QTest::newRow(dataTag: "test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << QRect(0, 0, 12, 12);
4017 QTest::newRow(dataTag: "test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << QRect(0, 0, 30, 30);
4018
4019 QTest::newRow(dataTag: "test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << QRect(0, 0, 10, 10);
4020 QTest::newRow(dataTag: "test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << QRect(0, 0, 10, 10);
4021 QTest::newRow(dataTag: "test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << QRect(0, 0, 12, 12);
4022 QTest::newRow(dataTag: "test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << QRect(0, 0, 30, 30);
4023
4024 QTest::newRow(dataTag: "test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << QRect(0, 0, 10, 10);
4025 QTest::newRow(dataTag: "test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << QRect(0, 0, 10, 10);
4026 QTest::newRow(dataTag: "test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << QRect(0, 0, 12, 12);
4027 QTest::newRow(dataTag: "test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << QRect(0, 0, 30, 30);
4028
4029 QTest::newRow(dataTag: "test 13") << QRect() << QRect(10, 10, 10, 10) << QRect(10, 10, 10, 10);
4030 QTest::newRow(dataTag: "test 14") << QRect(10, 10, 10, 10) << QRect() << QRect(10, 10, 10, 10);
4031 QTest::newRow(dataTag: "test 15") << QRect() << QRect() << QRect();
4032 QTest::newRow(dataTag: "test 16") << QRect(0, 0, 100, 0) << QRect(0, 0, 0, 100) << QRect(0, 0, 100, 100);
4033}
4034
4035void tst_QRect::unitedRect()
4036{
4037 QFETCH(QRect, rect1);
4038 QFETCH(QRect, rect2);
4039 QFETCH(QRect, unite);
4040
4041 QCOMPARE(rect1.united(rect2), unite);
4042}
4043
4044void tst_QRect::unitedRectF_data()
4045{
4046 QTest::addColumn<QRectF>(name: "rect1");
4047 QTest::addColumn<QRectF>(name: "rect2");
4048 QTest::addColumn<QRectF>(name: "unite");
4049
4050 QTest::newRow(dataTag: "test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << QRectF(0, 0, 10, 10);
4051 QTest::newRow(dataTag: "test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << QRectF(0, 0, 10, 10);
4052 QTest::newRow(dataTag: "test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << QRectF(0, 0, 12, 12);
4053 QTest::newRow(dataTag: "test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << QRectF(0, 0, 30, 30);
4054
4055 QTest::newRow(dataTag: "test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << QRectF(0, 0, 10, 10);
4056 QTest::newRow(dataTag: "test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << QRectF(0, 0, 10, 10);
4057 QTest::newRow(dataTag: "test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << QRectF(0, 0, 12, 12);
4058 QTest::newRow(dataTag: "test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << QRectF(0, 0, 30, 30);
4059
4060 QTest::newRow(dataTag: "test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << QRectF(0, 0, 10, 10);
4061 QTest::newRow(dataTag: "test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << QRectF(0, 0, 10, 10);
4062 QTest::newRow(dataTag: "test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << QRectF(0, 0, 12, 12);
4063 QTest::newRow(dataTag: "test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << QRectF(0, 0, 30, 30);
4064
4065 QTest::newRow(dataTag: "test 13") << QRectF() << QRectF(10, 10, 10, 10) << QRectF(10, 10, 10, 10);
4066 QTest::newRow(dataTag: "test 14") << QRectF(10, 10, 10, 10) << QRectF() << QRectF(10, 10, 10, 10);
4067 QTest::newRow(dataTag: "test 15") << QRectF() << QRectF() << QRectF();
4068 QTest::newRow(dataTag: "test 16") << QRectF(0, 0, 100, 0) << QRectF(0, 0, 0, 100) << QRectF(0, 0, 100, 100);
4069}
4070
4071void tst_QRect::unitedRectF()
4072{
4073 QFETCH(QRectF, rect1);
4074 QFETCH(QRectF, rect2);
4075 QFETCH(QRectF, unite);
4076
4077 QCOMPARE(rect1.united(rect2), unite);
4078}
4079
4080void tst_QRect::intersectsRect_data()
4081{
4082 QTest::addColumn<QRect>(name: "rect1");
4083 QTest::addColumn<QRect>(name: "rect2");
4084 QTest::addColumn<bool>(name: "intersects");
4085
4086 QTest::newRow(dataTag: "test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << true;
4087 QTest::newRow(dataTag: "test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << true;
4088 QTest::newRow(dataTag: "test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << true;
4089 QTest::newRow(dataTag: "test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << false;
4090
4091 QTest::newRow(dataTag: "test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << true;
4092 QTest::newRow(dataTag: "test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << true;
4093 QTest::newRow(dataTag: "test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << true;
4094 QTest::newRow(dataTag: "test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << false;
4095
4096 QTest::newRow(dataTag: "test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << true;
4097 QTest::newRow(dataTag: "test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << true;
4098 QTest::newRow(dataTag: "test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << true;
4099 QTest::newRow(dataTag: "test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << false;
4100
4101 QTest::newRow(dataTag: "test 13") << QRect() << QRect(10, 10, 10, 10) << false;
4102 QTest::newRow(dataTag: "test 14") << QRect(10, 10, 10, 10) << QRect() << false;
4103 QTest::newRow(dataTag: "test 15") << QRect() << QRect() << false;
4104 QTest::newRow(dataTag: "test 16") << QRect(10, 10, 10, 10) << QRect(19, 15, 1, 5) << true;
4105
4106 QTest::newRow(dataTag: "test 17") << QRect(10, 10, 10, 10) << QRect(15, 19, 5, 1) << true;
4107 QTest::newRow(dataTag: "test 18") << QRect(2, 0, 1, 652) << QRect(2, 0, 1, 652) << true;
4108}
4109
4110void tst_QRect::intersectsRect()
4111{
4112 QFETCH(QRect, rect1);
4113 QFETCH(QRect, rect2);
4114 QFETCH(bool, intersects);
4115
4116 QVERIFY(rect1.intersects(rect2) == intersects);
4117}
4118
4119void tst_QRect::intersectsRectF_data()
4120{
4121 QTest::addColumn<QRectF>(name: "rect1");
4122 QTest::addColumn<QRectF>(name: "rect2");
4123 QTest::addColumn<bool>(name: "intersects");
4124
4125 QTest::newRow(dataTag: "test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << true;
4126 QTest::newRow(dataTag: "test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << true;
4127 QTest::newRow(dataTag: "test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << true;
4128 QTest::newRow(dataTag: "test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << false;
4129
4130 QTest::newRow(dataTag: "test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << true;
4131 QTest::newRow(dataTag: "test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << true;
4132 QTest::newRow(dataTag: "test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << true;
4133 QTest::newRow(dataTag: "test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << false;
4134
4135 QTest::newRow(dataTag: "test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << true;
4136 QTest::newRow(dataTag: "test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << true;
4137 QTest::newRow(dataTag: "test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << true;
4138 QTest::newRow(dataTag: "test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << false;
4139
4140 QTest::newRow(dataTag: "test 13") << QRectF() << QRectF(10, 10, 10, 10) << false;
4141 QTest::newRow(dataTag: "test 14") << QRectF(10, 10, 10, 10) << QRectF() << false;
4142 QTest::newRow(dataTag: "test 15") << QRectF() << QRectF() << false;
4143
4144 QTest::newRow(dataTag: "test 16") << QRectF(0, 0, 10, 10) << QRectF(10, 10, 10, 10) << false;
4145 QTest::newRow(dataTag: "test 17") << QRectF(0, 0, 10, 10) << QRectF(0, 10, 10, 10) << false;
4146 QTest::newRow(dataTag: "test 18") << QRectF(0, 0, 10, 10) << QRectF(10, 0, 10, 10) << false;
4147}
4148
4149void tst_QRect::intersectsRectF()
4150{
4151 QFETCH(QRectF, rect1);
4152 QFETCH(QRectF, rect2);
4153 QFETCH(bool, intersects);
4154
4155 QVERIFY(rect1.intersects(rect2) == intersects);
4156}
4157
4158void tst_QRect::containsRect_data()
4159{
4160 QTest::addColumn<QRect>(name: "rect1");
4161 QTest::addColumn<QRect>(name: "rect2");
4162 QTest::addColumn<bool>(name: "contains");
4163
4164 QTest::newRow(dataTag: "test 01") << QRect(0, 0, 10, 10) << QRect( 2, 2, 6, 6) << true;
4165 QTest::newRow(dataTag: "test 02") << QRect(0, 0, 10, 10) << QRect( 0, 0, 10, 10) << true;
4166 QTest::newRow(dataTag: "test 03") << QRect(0, 0, 10, 10) << QRect( 2, 2, 10, 10) << false;
4167 QTest::newRow(dataTag: "test 04") << QRect(0, 0, 10, 10) << QRect(20, 20, 10, 10) << false;
4168
4169 QTest::newRow(dataTag: "test 05") << QRect(9, 9, -8, -8) << QRect( 2, 2, 6, 6) << true;
4170 QTest::newRow(dataTag: "test 06") << QRect(9, 9, -8, -8) << QRect( 0, 0, 10, 10) << true;
4171 QTest::newRow(dataTag: "test 07") << QRect(9, 9, -8, -8) << QRect( 2, 2, 10, 10) << false;
4172 QTest::newRow(dataTag: "test 08") << QRect(9, 9, -8, -8) << QRect(20, 20, 10, 10) << false;
4173
4174 QTest::newRow(dataTag: "test 09") << QRect(0, 0, 10, 10) << QRect( 7, 7, -4, -4) << true;
4175 QTest::newRow(dataTag: "test 10") << QRect(0, 0, 10, 10) << QRect( 9, 9, -8, -8) << true;
4176 QTest::newRow(dataTag: "test 11") << QRect(0, 0, 10, 10) << QRect(11, 11, -8, -8) << false;
4177 QTest::newRow(dataTag: "test 12") << QRect(0, 0, 10, 10) << QRect(29, 29, -8, -8) << false;
4178
4179 QTest::newRow(dataTag: "test 13") << QRect(-1, 1, 10, 10) << QRect() << false;
4180 QTest::newRow(dataTag: "test 14") << QRect() << QRect(0, 0, 10, 10) << false;
4181 QTest::newRow(dataTag: "test 15") << QRect() << QRect() << false;
4182}
4183
4184void tst_QRect::containsRect()
4185{
4186 QFETCH(QRect, rect1);
4187 QFETCH(QRect, rect2);
4188 QFETCH(bool, contains);
4189
4190 QVERIFY(rect1.contains(rect2) == contains);
4191}
4192
4193void tst_QRect::containsRectF_data()
4194{
4195 QTest::addColumn<QRectF>(name: "rect1");
4196 QTest::addColumn<QRectF>(name: "rect2");
4197 QTest::addColumn<bool>(name: "contains");
4198
4199 QTest::newRow(dataTag: "test 01") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 6, 6) << true;
4200 QTest::newRow(dataTag: "test 02") << QRectF(0, 0, 10, 10) << QRectF( 0, 0, 10, 10) << true;
4201 QTest::newRow(dataTag: "test 03") << QRectF(0, 0, 10, 10) << QRectF( 2, 2, 10, 10) << false;
4202 QTest::newRow(dataTag: "test 04") << QRectF(0, 0, 10, 10) << QRectF(20, 20, 10, 10) << false;
4203
4204 QTest::newRow(dataTag: "test 05") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 6, 6) << true;
4205 QTest::newRow(dataTag: "test 06") << QRectF(10, 10, -10, -10) << QRectF( 0, 0, 10, 10) << true;
4206 QTest::newRow(dataTag: "test 07") << QRectF(10, 10, -10, -10) << QRectF( 2, 2, 10, 10) << false;
4207 QTest::newRow(dataTag: "test 08") << QRectF(10, 10, -10, -10) << QRectF(20, 20, 10, 10) << false;
4208
4209 QTest::newRow(dataTag: "test 09") << QRectF(0, 0, 10, 10) << QRectF( 8, 8, -6, -6) << true;
4210 QTest::newRow(dataTag: "test 10") << QRectF(0, 0, 10, 10) << QRectF(10, 10, -10, -10) << true;
4211 QTest::newRow(dataTag: "test 11") << QRectF(0, 0, 10, 10) << QRectF(12, 12, -10, -10) << false;
4212 QTest::newRow(dataTag: "test 12") << QRectF(0, 0, 10, 10) << QRectF(30, 30, -10, -10) << false;
4213
4214 QTest::newRow(dataTag: "test 13") << QRectF(-1, 1, 10, 10) << QRectF() << false;
4215 QTest::newRow(dataTag: "test 14") << QRectF() << QRectF(0, 0, 10, 10) << false;
4216 QTest::newRow(dataTag: "test 15") << QRectF() << QRectF() << false;
4217}
4218
4219void tst_QRect::containsRectF()
4220{
4221 QFETCH(QRectF, rect1);
4222 QFETCH(QRectF, rect2);
4223 QFETCH(bool, contains);
4224
4225 QVERIFY(rect1.contains(rect2) == contains);
4226}
4227
4228void tst_QRect::containsPoint_data()
4229{
4230 QTest::addColumn<QRect>(name: "rect");
4231 QTest::addColumn<QPoint>(name: "point");
4232 QTest::addColumn<bool>(name: "contains");
4233 QTest::addColumn<bool>(name: "containsProper");
4234
4235 QTest::newRow(dataTag: "test 01") << QRect(0, 0, 10, 10) << QPoint( 0, 0) << true << false;
4236 QTest::newRow(dataTag: "test 02") << QRect(0, 0, 10, 10) << QPoint( 0, 10) << false << false;
4237 QTest::newRow(dataTag: "test 03") << QRect(0, 0, 10, 10) << QPoint(10, 0) << false << false;
4238 QTest::newRow(dataTag: "test 04") << QRect(0, 0, 10, 10) << QPoint(10, 10) << false << false;
4239 QTest::newRow(dataTag: "test 05") << QRect(0, 0, 10, 10) << QPoint( 0, 9) << true << false;
4240 QTest::newRow(dataTag: "test 06") << QRect(0, 0, 10, 10) << QPoint( 9, 0) << true << false;
4241 QTest::newRow(dataTag: "test 07") << QRect(0, 0, 10, 10) << QPoint( 9, 9) << true << false;
4242 QTest::newRow(dataTag: "test 08") << QRect(0, 0, 10, 10) << QPoint( 1, 0) << true << false;
4243 QTest::newRow(dataTag: "test 09") << QRect(0, 0, 10, 10) << QPoint( 9, 1) << true << false;
4244 QTest::newRow(dataTag: "test 10") << QRect(0, 0, 10, 10) << QPoint( 1, 1) << true << true;
4245 QTest::newRow(dataTag: "test 11") << QRect(0, 0, 10, 10) << QPoint( 1, 8) << true << true;
4246 QTest::newRow(dataTag: "test 12") << QRect(0, 0, 10, 10) << QPoint( 8, 8) << true << true;
4247
4248 QTest::newRow(dataTag: "test 13") << QRect(9, 9, -8, -8) << QPoint( 0, 0) << true << false;
4249 QTest::newRow(dataTag: "test 14") << QRect(9, 9, -8, -8) << QPoint( 0, 10) << false << false;
4250 QTest::newRow(dataTag: "test 15") << QRect(9, 9, -8, -8) << QPoint(10, 0) << false << false;
4251 QTest::newRow(dataTag: "test 16") << QRect(9, 9, -8, -8) << QPoint(10, 10) << false << false;
4252 QTest::newRow(dataTag: "test 17") << QRect(9, 9, -8, -8) << QPoint( 0, 9) << true << false;
4253 QTest::newRow(dataTag: "test 18") << QRect(9, 9, -8, -8) << QPoint( 9, 0) << true << false;
4254 QTest::newRow(dataTag: "test 19") << QRect(9, 9, -8, -8) << QPoint( 9, 9) << true << false;
4255 QTest::newRow(dataTag: "test 20") << QRect(9, 9, -8, -8) << QPoint( 1, 0) << true << false;
4256 QTest::newRow(dataTag: "test 21") << QRect(9, 9, -8, -8) << QPoint( 9, 1) << true << false;
4257 QTest::newRow(dataTag: "test 22") << QRect(9, 9, -8, -8) << QPoint( 1, 1) << true << true;
4258 QTest::newRow(dataTag: "test 23") << QRect(9, 9, -8, -8) << QPoint( 1, 8) << true << true;
4259 QTest::newRow(dataTag: "test 24") << QRect(9, 9, -8, -8) << QPoint( 8, 8) << true << true;
4260
4261 QTest::newRow(dataTag: "test 25") << QRect(-1, 1, 10, 10) << QPoint() << false << false;
4262 QTest::newRow(dataTag: "test 26") << QRect() << QPoint(1, 1) << false << false;
4263 QTest::newRow(dataTag: "test 27") << QRect() << QPoint() << false << false;
4264}
4265
4266void tst_QRect::containsPoint()
4267{
4268 QFETCH(QRect, rect);
4269 QFETCH(QPoint, point);
4270 QFETCH(bool, contains);
4271 QFETCH(bool, containsProper);
4272
4273 QVERIFY(rect.contains(point) == contains);
4274 QVERIFY(rect.contains(point, true) == containsProper);
4275}
4276
4277void tst_QRect::containsPointF_data()
4278{
4279 QTest::addColumn<QRectF>(name: "rect");
4280 QTest::addColumn<QPointF>(name: "point");
4281 QTest::addColumn<bool>(name: "contains");
4282
4283 QTest::newRow(dataTag: "test 27") << QRectF() << QPointF() << false;
4284
4285 QTest::newRow(dataTag: "test 01") << QRectF(0, 0, 10, 10) << QPointF( 0, 0) << true;
4286 QTest::newRow(dataTag: "test 02") << QRectF(0, 0, 10, 10) << QPointF( 0, 10) << true;
4287 QTest::newRow(dataTag: "test 03") << QRectF(0, 0, 10, 10) << QPointF(10, 0) << true;
4288 QTest::newRow(dataTag: "test 04") << QRectF(0, 0, 10, 10) << QPointF(10, 10) << true;
4289 QTest::newRow(dataTag: "test 05") << QRectF(0, 0, 10, 10) << QPointF( 0, 9) << true;
4290 QTest::newRow(dataTag: "test 06") << QRectF(0, 0, 10, 10) << QPointF( 9, 0) << true;
4291 QTest::newRow(dataTag: "test 07") << QRectF(0, 0, 10, 10) << QPointF( 9, 9) << true;
4292 QTest::newRow(dataTag: "test 08") << QRectF(0, 0, 10, 10) << QPointF( 1, 0) << true;
4293 QTest::newRow(dataTag: "test 09") << QRectF(0, 0, 10, 10) << QPointF( 9, 1) << true;
4294 QTest::newRow(dataTag: "test 10") << QRectF(0, 0, 10, 10) << QPointF( 1, 1) << true;
4295 QTest::newRow(dataTag: "test 11") << QRectF(0, 0, 10, 10) << QPointF( 1, 8) << true;
4296 QTest::newRow(dataTag: "test 12") << QRectF(0, 0, 10, 10) << QPointF( 8, 8) << true;
4297
4298 QTest::newRow(dataTag: "test 13") << QRectF(10, 10, -10, -10) << QPointF( 0, 0) << true;
4299 QTest::newRow(dataTag: "test 14") << QRectF(10, 10, -10, -10) << QPointF( 0, 10) << true;
4300 QTest::newRow(dataTag: "test 15") << QRectF(10, 10, -10, -10) << QPointF(10, 0) << true;
4301 QTest::newRow(dataTag: "test 16") << QRectF(10, 10, -10, -10) << QPointF(10, 10) << true;
4302 QTest::newRow(dataTag: "test 17") << QRectF(10, 10, -10, -10) << QPointF( 0, 9) << true;
4303 QTest::newRow(dataTag: "test 18") << QRectF(10, 10, -10, -10) << QPointF( 9, 0) << true;
4304 QTest::newRow(dataTag: "test 19") << QRectF(10, 10, -10, -10) << QPointF( 9, 9) << true;
4305 QTest::newRow(dataTag: "test 20") << QRectF(10, 10, -10, -10) << QPointF( 1, 0) << true;
4306 QTest::newRow(dataTag: "test 21") << QRectF(10, 10, -10, -10) << QPointF( 9, 1) << true;
4307 QTest::newRow(dataTag: "test 22") << QRectF(10, 10, -10, -10) << QPointF( 1, 1) << true;
4308 QTest::newRow(dataTag: "test 23") << QRectF(10, 10, -10, -10) << QPointF( 1, 8) << true;
4309 QTest::newRow(dataTag: "test 24") << QRectF(10, 10, -10, -10) << QPointF( 8, 8) << true;
4310
4311 QTest::newRow(dataTag: "test 25") << QRectF(-1, 1, 10, 10) << QPointF() << false;
4312 QTest::newRow(dataTag: "test 26") << QRectF() << QPointF(1, 1) << false;
4313 QTest::newRow(dataTag: "test 27") << QRectF() << QPointF() << false;
4314}
4315
4316void tst_QRect::containsPointF()
4317{
4318 QFETCH(QRectF, rect);
4319 QFETCH(QPointF, point);
4320 QFETCH(bool, contains);
4321
4322 QVERIFY(rect.contains(point) == contains);
4323}
4324
4325void tst_QRect::smallRects() const
4326{
4327 const QRectF r1( 0, 0, 1e-12, 1e-12 );
4328 const QRectF r2( 0, 0, 1e-14, 1e-14 );
4329
4330 // r2 is 10000 times bigger than r1
4331 QVERIFY(!(r1 == r2));
4332 QVERIFY(r1 != r2);
4333}
4334
4335void tst_QRect::toRect()
4336{
4337 for (qreal x = 1.0; x < 2.0; x += 0.25) {
4338 for (qreal y = 1.0; y < 2.0; y += 0.25) {
4339 for (qreal w = 1.0; w < 2.0; w += 0.25) {
4340 for (qreal h = 1.0; h < 2.0; h += 0.25) {
4341 const QRectF rectf(x, y, w, h);
4342 const QRectF rect = rectf.toRect();
4343 QVERIFY(qAbs(rect.x() - rectf.x()) < 1.0);
4344 QVERIFY(qAbs(rect.y() - rectf.y()) < 1.0);
4345 QVERIFY(qAbs(rect.width() - rectf.width()) < 1.0);
4346 QVERIFY(qAbs(rect.height() - rectf.height()) < 1.0);
4347 QVERIFY(qAbs(rect.right() - rectf.right()) < 1.0);
4348 QVERIFY(qAbs(rect.bottom() - rectf.bottom()) < 1.0);
4349
4350 const QRectF arect = rectf.toAlignedRect();
4351 QVERIFY(qAbs(arect.x() - rectf.x()) < 1.0);
4352 QVERIFY(qAbs(arect.y() - rectf.y()) < 1.0);
4353 QVERIFY(qAbs(arect.width() - rectf.width()) < 2.0);
4354 QVERIFY(qAbs(arect.height() - rectf.height()) < 2.0);
4355 QVERIFY(qAbs(arect.right() - rectf.right()) < 1.0);
4356 QVERIFY(qAbs(arect.bottom() - rectf.bottom()) < 1.0);
4357
4358 QVERIFY(arect.contains(rectf));
4359 QVERIFY(arect.contains(rect));
4360 }
4361 }
4362 }
4363 }
4364}
4365
4366QTEST_MAIN(tst_QRect)
4367#include "tst_qrect.moc"
4368

source code of qtbase/tests/auto/corelib/tools/qrect/tst_qrect.cpp