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