1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the test suite of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | #include <QtTest/QtTest> |
29 | #include <QtCore/QSize> |
30 | #include <QtCore/QRectF> |
31 | #include <QtGui/QTransform> |
32 | #include <QtGui/QGuiApplication> |
33 | #include <QtGui/QPainterPath> |
34 | #include <QtGui/QScreen> |
35 | #include <QtWidgets/QStyle> |
36 | #include <QtWidgets/QStyleFactory> |
37 | |
38 | #include "tst_qgraphicsview.h" |
39 | |
40 | Q_DECLARE_METATYPE(ExpectedValueDescription) |
41 | Q_DECLARE_METATYPE(QList<int>) |
42 | Q_DECLARE_METATYPE(QList<QRectF>) |
43 | Q_DECLARE_METATYPE(QMatrix) |
44 | Q_DECLARE_METATYPE(QPainterPath) |
45 | Q_DECLARE_METATYPE(Qt::ScrollBarPolicy) |
46 | Q_DECLARE_METATYPE(ScrollBarCount) |
47 | |
48 | static void _scrollBarRanges_addTestData(const QByteArray &style, bool styled) |
49 | { |
50 | const int viewWidth = 250; |
51 | const int viewHeight = 100; |
52 | |
53 | static Q_CONSTEXPR struct Data { |
54 | const char *name; |
55 | QRectF sceneRect; |
56 | ScrollBarCount sceneRectOffsetFactors; |
57 | int scale; |
58 | Qt::ScrollBarPolicy hbarpolicy, vbarpolicy; |
59 | ExpectedValueDescription hmin, hmax, vmin, vmax; |
60 | } data [] = { |
61 | { |
62 | .name: "1" , |
63 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
64 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
65 | .scale: 1, |
66 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
67 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
68 | .hmin: ExpectedValueDescription(), |
69 | .hmax: ExpectedValueDescription(), |
70 | .vmin: ExpectedValueDescription(), |
71 | .vmax: ExpectedValueDescription(), |
72 | }, |
73 | { |
74 | .name: "2" , |
75 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
76 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
77 | .scale: 1, |
78 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
79 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
80 | .hmin: ExpectedValueDescription(), |
81 | .hmax: ExpectedValueDescription(50, 1, 1), |
82 | .vmin: ExpectedValueDescription(), |
83 | .vmax: ExpectedValueDescription(0, 1, 1), |
84 | }, |
85 | { |
86 | .name: "3" , |
87 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
88 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
89 | .scale: 1, |
90 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
91 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
92 | .hmin: ExpectedValueDescription(), |
93 | .hmax: ExpectedValueDescription(50, 1, 1), |
94 | .vmin: ExpectedValueDescription(0, 0), |
95 | .vmax: ExpectedValueDescription(100, 1, 1), |
96 | }, |
97 | { |
98 | .name: "4" , |
99 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
100 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
101 | .scale: 1, |
102 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
103 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
104 | .hmin: ExpectedValueDescription(), |
105 | .hmax: ExpectedValueDescription(), |
106 | .vmin: ExpectedValueDescription(), |
107 | .vmax: ExpectedValueDescription(), |
108 | }, |
109 | { |
110 | .name: "5" , |
111 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
112 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
113 | .scale: 1, |
114 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
115 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
116 | .hmin: ExpectedValueDescription(-100), |
117 | .hmax: ExpectedValueDescription(-50, 1, 1), |
118 | .vmin: ExpectedValueDescription(-100), |
119 | .vmax: ExpectedValueDescription(-100, 1, 1), |
120 | }, |
121 | { |
122 | .name: "6" , |
123 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
124 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
125 | .scale: 1, |
126 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
127 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
128 | .hmin: ExpectedValueDescription(-100), |
129 | .hmax: ExpectedValueDescription(-50, 1, 1), |
130 | .vmin: ExpectedValueDescription(-100), |
131 | .vmax: ExpectedValueDescription(0, 1, 1), |
132 | }, |
133 | { |
134 | .name: "7" , |
135 | .sceneRect: QRectF(0, 0, viewWidth + 1, viewHeight + 1), |
136 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
137 | .scale: 1, |
138 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
139 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
140 | .hmin: ExpectedValueDescription(), |
141 | .hmax: ExpectedValueDescription(1, 1, 1), |
142 | .vmin: ExpectedValueDescription(), |
143 | .vmax: ExpectedValueDescription(1, 1, 1), |
144 | }, |
145 | { |
146 | .name: "8" , |
147 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 1), |
148 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
149 | .scale: 1, |
150 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
151 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
152 | .hmin: ExpectedValueDescription(), |
153 | .hmax: ExpectedValueDescription(51, 1, 1), |
154 | .vmin: ExpectedValueDescription(), |
155 | .vmax: ExpectedValueDescription(1, 1, 1), |
156 | }, |
157 | { |
158 | .name: "9" , |
159 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 101), |
160 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
161 | .scale: 1, |
162 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
163 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
164 | .hmin: ExpectedValueDescription(), |
165 | .hmax: ExpectedValueDescription(51, 1, 1), |
166 | .vmin: ExpectedValueDescription(), |
167 | .vmax: ExpectedValueDescription(101, 1, 1), |
168 | }, |
169 | { |
170 | .name: "10" , |
171 | .sceneRect: QRectF(-101, -101, viewWidth + 1, viewHeight + 1), |
172 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
173 | .scale: 1, |
174 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
175 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
176 | .hmin: ExpectedValueDescription(-101), |
177 | .hmax: ExpectedValueDescription(-100, 1, 1), |
178 | .vmin: ExpectedValueDescription(-101), |
179 | .vmax: ExpectedValueDescription(-100, 1, 1), |
180 | }, |
181 | { |
182 | .name: "11" , |
183 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 1), |
184 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
185 | .scale: 1, |
186 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
187 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
188 | .hmin: ExpectedValueDescription(-101), |
189 | .hmax: ExpectedValueDescription(-50, 1, 1), |
190 | .vmin: ExpectedValueDescription(-101), |
191 | .vmax: ExpectedValueDescription(-100, 1, 1), |
192 | }, |
193 | { |
194 | .name: "12" , |
195 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 101), |
196 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
197 | .scale: 1, |
198 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
199 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
200 | .hmin: ExpectedValueDescription(-101), |
201 | .hmax: ExpectedValueDescription(-50, 1, 1), |
202 | .vmin: ExpectedValueDescription(-101), |
203 | .vmax: ExpectedValueDescription(0, 1, 1), |
204 | }, |
205 | { |
206 | .name: "13" , |
207 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
208 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
209 | .scale: 1, |
210 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
211 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
212 | .hmin: ExpectedValueDescription(), |
213 | .hmax: ExpectedValueDescription(0, 2, 1), |
214 | .vmin: ExpectedValueDescription(), |
215 | .vmax: ExpectedValueDescription(0, 2, 1), |
216 | }, |
217 | { |
218 | .name: "14" , |
219 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
220 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
221 | .scale: 1, |
222 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
223 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
224 | .hmin: ExpectedValueDescription(), |
225 | .hmax: ExpectedValueDescription(50, 2, 1), |
226 | .vmin: ExpectedValueDescription(), |
227 | .vmax: ExpectedValueDescription(0, 2, 1), |
228 | }, |
229 | { |
230 | .name: "15" , |
231 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
232 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
233 | .scale: 1, |
234 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
235 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
236 | .hmin: ExpectedValueDescription(), |
237 | .hmax: ExpectedValueDescription(50, 2, 1), |
238 | .vmin: ExpectedValueDescription(), |
239 | .vmax: ExpectedValueDescription(100, 2, 1), |
240 | }, |
241 | { |
242 | .name: "16" , |
243 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
244 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
245 | .scale: 1, |
246 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
247 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
248 | .hmin: ExpectedValueDescription(-100, -1), |
249 | .hmax: ExpectedValueDescription(-100, 1, 1), |
250 | .vmin: ExpectedValueDescription(-100, -1), |
251 | .vmax: ExpectedValueDescription(-100, 1, 1), |
252 | }, |
253 | { |
254 | .name: "17" , |
255 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
256 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
257 | .scale: 1, |
258 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
259 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
260 | .hmin: ExpectedValueDescription(-100, -1), |
261 | .hmax: ExpectedValueDescription(-50, 1, 1), |
262 | .vmin: ExpectedValueDescription(-100, -1), |
263 | .vmax: ExpectedValueDescription(-100, 1, 1), |
264 | }, |
265 | { |
266 | .name: "18" , |
267 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
268 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
269 | .scale: 1, |
270 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
271 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
272 | .hmin: ExpectedValueDescription(-100, -1), |
273 | .hmax: ExpectedValueDescription(-50, 1, 1), |
274 | .vmin: ExpectedValueDescription(-100, -1), |
275 | .vmax: ExpectedValueDescription(0, 1, 1), |
276 | }, |
277 | { |
278 | .name: "1 x2" , |
279 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
280 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
281 | .scale: 2, |
282 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
283 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
284 | .hmin: ExpectedValueDescription(), |
285 | .hmax: ExpectedValueDescription(viewWidth, 1, 1), |
286 | .vmin: ExpectedValueDescription(), |
287 | .vmax: ExpectedValueDescription(viewHeight, 1, 1), |
288 | }, |
289 | { |
290 | .name: "2 x2" , |
291 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
292 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
293 | .scale: 2, |
294 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
295 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
296 | .hmin: ExpectedValueDescription(), |
297 | .hmax: ExpectedValueDescription(viewWidth + 100, 1, 1), |
298 | .vmin: ExpectedValueDescription(), |
299 | .vmax: ExpectedValueDescription(viewHeight, 1, 1), |
300 | }, |
301 | { |
302 | .name: "3 x2" , |
303 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
304 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
305 | .scale: 2, |
306 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
307 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
308 | .hmin: ExpectedValueDescription(), |
309 | .hmax: ExpectedValueDescription(viewWidth + 100, 1, 1), |
310 | .vmin: ExpectedValueDescription(), |
311 | .vmax: ExpectedValueDescription(viewHeight + 200, 1, 1), |
312 | }, |
313 | { |
314 | .name: "4 x2" , |
315 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
316 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
317 | .scale: 2, |
318 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
319 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
320 | .hmin: ExpectedValueDescription(-200), |
321 | .hmax: ExpectedValueDescription(viewWidth - 200, 1, 1), |
322 | .vmin: ExpectedValueDescription(-200), |
323 | .vmax: ExpectedValueDescription(viewHeight - 200, 1, 1), |
324 | }, |
325 | { |
326 | .name: "5 x2" , |
327 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
328 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
329 | .scale: 2, |
330 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
331 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
332 | .hmin: ExpectedValueDescription(-200), |
333 | .hmax: ExpectedValueDescription(viewWidth - 100, 1, 1), |
334 | .vmin: ExpectedValueDescription(-200), |
335 | .vmax: ExpectedValueDescription(viewHeight - 200, 1, 1), |
336 | }, |
337 | { |
338 | .name: "6 x2" , |
339 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
340 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
341 | .scale: 2, |
342 | .hbarpolicy: Qt::ScrollBarAsNeeded, |
343 | .vbarpolicy: Qt::ScrollBarAsNeeded, |
344 | .hmin: ExpectedValueDescription(-200), |
345 | .hmax: ExpectedValueDescription(viewWidth - 100, 1, 1), |
346 | .vmin: ExpectedValueDescription(-200), |
347 | .vmax: ExpectedValueDescription(viewHeight, 1, 1), |
348 | }, |
349 | { |
350 | .name: "1 No ScrollBars" , |
351 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
352 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
353 | .scale: 1, |
354 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
355 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
356 | .hmin: ExpectedValueDescription(), |
357 | .hmax: ExpectedValueDescription(), |
358 | .vmin: ExpectedValueDescription(), |
359 | .vmax: ExpectedValueDescription(), |
360 | }, |
361 | { |
362 | .name: "2 No ScrollBars" , |
363 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
364 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
365 | .scale: 1, |
366 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
367 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
368 | .hmin: ExpectedValueDescription(), |
369 | .hmax: ExpectedValueDescription(50), |
370 | .vmin: ExpectedValueDescription(), |
371 | .vmax: ExpectedValueDescription(), |
372 | }, |
373 | { |
374 | .name: "3 No ScrollBars" , |
375 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
376 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
377 | .scale: 1, |
378 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
379 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
380 | .hmin: ExpectedValueDescription(), |
381 | .hmax: ExpectedValueDescription(50), |
382 | .vmin: ExpectedValueDescription(), |
383 | .vmax: ExpectedValueDescription(100), |
384 | }, |
385 | { |
386 | .name: "4 No ScrollBars" , |
387 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
388 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
389 | .scale: 1, |
390 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
391 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
392 | .hmin: ExpectedValueDescription(), |
393 | .hmax: ExpectedValueDescription(), |
394 | .vmin: ExpectedValueDescription(), |
395 | .vmax: ExpectedValueDescription(), |
396 | }, |
397 | { |
398 | .name: "5 No ScrollBars" , |
399 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
400 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
401 | .scale: 1, |
402 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
403 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
404 | .hmin: ExpectedValueDescription(-100), |
405 | .hmax: ExpectedValueDescription(-50), |
406 | .vmin: ExpectedValueDescription(), |
407 | .vmax: ExpectedValueDescription(), |
408 | }, |
409 | { |
410 | .name: "6 No ScrollBars" , |
411 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
412 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
413 | .scale: 1, |
414 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
415 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
416 | .hmin: ExpectedValueDescription(-100), |
417 | .hmax: ExpectedValueDescription(-50), |
418 | .vmin: ExpectedValueDescription(-100), |
419 | .vmax: ExpectedValueDescription(), |
420 | }, |
421 | { |
422 | .name: "7 No ScrollBars" , |
423 | .sceneRect: QRectF(0, 0, viewWidth + 1, viewHeight + 1), |
424 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
425 | .scale: 1, |
426 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
427 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
428 | .hmin: ExpectedValueDescription(), |
429 | .hmax: ExpectedValueDescription(1), |
430 | .vmin: ExpectedValueDescription(), |
431 | .vmax: ExpectedValueDescription(1), |
432 | }, |
433 | { |
434 | .name: "8 No ScrollBars" , |
435 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 1), |
436 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
437 | .scale: 1, |
438 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
439 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
440 | .hmin: ExpectedValueDescription(), |
441 | .hmax: ExpectedValueDescription(51), |
442 | .vmin: ExpectedValueDescription(), |
443 | .vmax: ExpectedValueDescription(1), |
444 | }, |
445 | { |
446 | .name: "9 No ScrollBars" , |
447 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 101), |
448 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
449 | .scale: 1, |
450 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
451 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
452 | .hmin: ExpectedValueDescription(), |
453 | .hmax: ExpectedValueDescription(51), |
454 | .vmin: ExpectedValueDescription(), |
455 | .vmax: ExpectedValueDescription(101), |
456 | }, |
457 | { |
458 | .name: "10 No ScrollBars" , |
459 | .sceneRect: QRectF(-101, -101, viewWidth + 1, viewHeight + 1), |
460 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
461 | .scale: 1, |
462 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
463 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
464 | .hmin: ExpectedValueDescription(-101), |
465 | .hmax: ExpectedValueDescription(-100), |
466 | .vmin: ExpectedValueDescription(-101), |
467 | .vmax: ExpectedValueDescription(-100), |
468 | }, |
469 | { |
470 | .name: "11 No ScrollBars" , |
471 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 1), |
472 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
473 | .scale: 1, |
474 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
475 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
476 | .hmin: ExpectedValueDescription(-101), |
477 | .hmax: ExpectedValueDescription(-50), |
478 | .vmin: ExpectedValueDescription(-101), |
479 | .vmax: ExpectedValueDescription(-100), |
480 | }, |
481 | { |
482 | .name: "12 No ScrollBars" , |
483 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 101), |
484 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
485 | .scale: 1, |
486 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
487 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
488 | .hmin: ExpectedValueDescription(-101), |
489 | .hmax: ExpectedValueDescription(-50), |
490 | .vmin: ExpectedValueDescription(-101), |
491 | .vmax: ExpectedValueDescription(), |
492 | }, |
493 | { |
494 | .name: "13 No ScrollBars" , |
495 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
496 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
497 | .scale: 1, |
498 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
499 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
500 | .hmin: ExpectedValueDescription(), |
501 | .hmax: ExpectedValueDescription(0, 1), |
502 | .vmin: ExpectedValueDescription(), |
503 | .vmax: ExpectedValueDescription(0, 1), |
504 | }, |
505 | { |
506 | .name: "14 No ScrollBars" , |
507 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
508 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
509 | .scale: 1, |
510 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
511 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
512 | .hmin: ExpectedValueDescription(), |
513 | .hmax: ExpectedValueDescription(50, 1), |
514 | .vmin: ExpectedValueDescription(), |
515 | .vmax: ExpectedValueDescription(0, 1), |
516 | }, |
517 | { |
518 | .name: "15 No ScrollBars" , |
519 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
520 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
521 | .scale: 1, |
522 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
523 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
524 | .hmin: ExpectedValueDescription(), |
525 | .hmax: ExpectedValueDescription(50, 1), |
526 | .vmin: ExpectedValueDescription(), |
527 | .vmax: ExpectedValueDescription(100, 1), |
528 | }, |
529 | { |
530 | .name: "16 No ScrollBars" , |
531 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
532 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
533 | .scale: 1, |
534 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
535 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
536 | .hmin: ExpectedValueDescription(-100, -1), |
537 | .hmax: ExpectedValueDescription(-100), |
538 | .vmin: ExpectedValueDescription(-100, -1), |
539 | .vmax: ExpectedValueDescription(-100), |
540 | }, |
541 | { |
542 | .name: "17 No ScrollBars" , |
543 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
544 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
545 | .scale: 1, |
546 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
547 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
548 | .hmin: ExpectedValueDescription(-100, -1), |
549 | .hmax: ExpectedValueDescription(-50), |
550 | .vmin: ExpectedValueDescription(-100, -1), |
551 | .vmax: ExpectedValueDescription(-100), |
552 | }, |
553 | { |
554 | .name: "18 No ScrollBars" , |
555 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
556 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
557 | .scale: 1, |
558 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
559 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
560 | .hmin: ExpectedValueDescription(-100, -1), |
561 | .hmax: ExpectedValueDescription(-50), |
562 | .vmin: ExpectedValueDescription(-100, -1), |
563 | .vmax: ExpectedValueDescription(), |
564 | }, |
565 | { |
566 | .name: "1 x2 No ScrollBars" , |
567 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
568 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
569 | .scale: 2, |
570 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
571 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
572 | .hmin: ExpectedValueDescription(), |
573 | .hmax: ExpectedValueDescription(viewWidth), |
574 | .vmin: ExpectedValueDescription(), |
575 | .vmax: ExpectedValueDescription(viewHeight), |
576 | }, |
577 | { |
578 | .name: "2 x2 No ScrollBars" , |
579 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
580 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
581 | .scale: 2, |
582 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
583 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
584 | .hmin: ExpectedValueDescription(), |
585 | .hmax: ExpectedValueDescription(viewWidth + 100), |
586 | .vmin: ExpectedValueDescription(), |
587 | .vmax: ExpectedValueDescription(viewHeight), |
588 | }, |
589 | { |
590 | .name: "3 x2 No ScrollBars" , |
591 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
592 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
593 | .scale: 2, |
594 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
595 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
596 | .hmin: ExpectedValueDescription(), |
597 | .hmax: ExpectedValueDescription(viewWidth + 100), |
598 | .vmin: ExpectedValueDescription(), |
599 | .vmax: ExpectedValueDescription(viewHeight + 200), |
600 | }, |
601 | { |
602 | .name: "4 x2 No ScrollBars" , |
603 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
604 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
605 | .scale: 2, |
606 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
607 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
608 | .hmin: ExpectedValueDescription(-200), |
609 | .hmax: ExpectedValueDescription(viewWidth - 200), |
610 | .vmin: ExpectedValueDescription(-200), |
611 | .vmax: ExpectedValueDescription(viewHeight - 200), |
612 | }, |
613 | { |
614 | .name: "5 x2 No ScrollBars" , |
615 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
616 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
617 | .scale: 2, |
618 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
619 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
620 | .hmin: ExpectedValueDescription(-200), |
621 | .hmax: ExpectedValueDescription(viewWidth - 100), |
622 | .vmin: ExpectedValueDescription(-200), |
623 | .vmax: ExpectedValueDescription(viewHeight - 200), |
624 | }, |
625 | { |
626 | .name: "6 x2 No ScrollBars" , |
627 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
628 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
629 | .scale: 2, |
630 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
631 | .vbarpolicy: Qt::ScrollBarAlwaysOff, |
632 | .hmin: ExpectedValueDescription(-200), |
633 | .hmax: ExpectedValueDescription(viewWidth - 100), |
634 | .vmin: ExpectedValueDescription(-200), |
635 | .vmax: ExpectedValueDescription(viewHeight), |
636 | }, |
637 | { |
638 | .name: "1 Always ScrollBars" , |
639 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
640 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
641 | .scale: 1, |
642 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
643 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
644 | .hmin: ExpectedValueDescription(), |
645 | .hmax: ExpectedValueDescription(0, 1, 1), |
646 | .vmin: ExpectedValueDescription(), |
647 | .vmax: ExpectedValueDescription(0, 1, 1), |
648 | }, |
649 | { |
650 | .name: "2 Always ScrollBars" , |
651 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
652 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
653 | .scale: 1, |
654 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
655 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
656 | .hmin: ExpectedValueDescription(), |
657 | .hmax: ExpectedValueDescription(50, 1, 1), |
658 | .vmin: ExpectedValueDescription(), |
659 | .vmax: ExpectedValueDescription(0, 1, 1), |
660 | }, |
661 | { |
662 | .name: "3 Always ScrollBars" , |
663 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
664 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
665 | .scale: 1, |
666 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
667 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
668 | .hmin: ExpectedValueDescription(), |
669 | .hmax: ExpectedValueDescription(50, 1, 1), |
670 | .vmin: ExpectedValueDescription(), |
671 | .vmax: ExpectedValueDescription(100, 1, 1), |
672 | }, |
673 | { |
674 | .name: "4 Always ScrollBars" , |
675 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
676 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
677 | .scale: 1, |
678 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
679 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
680 | .hmin: ExpectedValueDescription(-100), |
681 | .hmax: ExpectedValueDescription(-100, 1, 1), |
682 | .vmin: ExpectedValueDescription(-100), |
683 | .vmax: ExpectedValueDescription(-100, 1, 1), |
684 | }, |
685 | { |
686 | .name: "5 Always ScrollBars" , |
687 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
688 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
689 | .scale: 1, |
690 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
691 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
692 | .hmin: ExpectedValueDescription(-100), |
693 | .hmax: ExpectedValueDescription(-50, 1, 1), |
694 | .vmin: ExpectedValueDescription(-100), |
695 | .vmax: ExpectedValueDescription(-100, 1, 1), |
696 | }, |
697 | { |
698 | .name: "6 Always ScrollBars" , |
699 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
700 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
701 | .scale: 1, |
702 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
703 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
704 | .hmin: ExpectedValueDescription(-100), |
705 | .hmax: ExpectedValueDescription(-50, 1, 1), |
706 | .vmin: ExpectedValueDescription(-100), |
707 | .vmax: ExpectedValueDescription(0, 1, 1), |
708 | }, |
709 | { |
710 | .name: "7 Always ScrollBars" , |
711 | .sceneRect: QRectF(0, 0, viewWidth + 1, viewHeight + 1), |
712 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
713 | .scale: 1, |
714 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
715 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
716 | .hmin: ExpectedValueDescription(), |
717 | .hmax: ExpectedValueDescription(1, 1, 1), |
718 | .vmin: ExpectedValueDescription(), |
719 | .vmax: ExpectedValueDescription(1, 1, 1), |
720 | }, |
721 | { |
722 | .name: "8 Always ScrollBars" , |
723 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 1), |
724 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
725 | .scale: 1, |
726 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
727 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
728 | .hmin: ExpectedValueDescription(), |
729 | .hmax: ExpectedValueDescription(51, 1, 1), |
730 | .vmin: ExpectedValueDescription(), |
731 | .vmax: ExpectedValueDescription(1, 1, 1), |
732 | }, |
733 | { |
734 | .name: "9 Always ScrollBars" , |
735 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 101), |
736 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
737 | .scale: 1, |
738 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
739 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
740 | .hmin: ExpectedValueDescription(), |
741 | .hmax: ExpectedValueDescription(51, 1, 1), |
742 | .vmin: ExpectedValueDescription(), |
743 | .vmax: ExpectedValueDescription(101, 1, 1), |
744 | }, |
745 | { |
746 | .name: "10 Always ScrollBars" , |
747 | .sceneRect: QRectF(-101, -101, viewWidth + 1, viewHeight + 1), |
748 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
749 | .scale: 1, |
750 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
751 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
752 | .hmin: ExpectedValueDescription(-101), |
753 | .hmax: ExpectedValueDescription(-100, 1, 1), |
754 | .vmin: ExpectedValueDescription(-101), |
755 | .vmax: ExpectedValueDescription(-100, 1, 1), |
756 | }, |
757 | { |
758 | .name: "11 Always ScrollBars" , |
759 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 1), |
760 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
761 | .scale: 1, |
762 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
763 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
764 | .hmin: ExpectedValueDescription(-101), |
765 | .hmax: ExpectedValueDescription(-50, 1, 1), |
766 | .vmin: ExpectedValueDescription(-101), |
767 | .vmax: ExpectedValueDescription(-100, 1, 1), |
768 | }, |
769 | { |
770 | .name: "12 Always ScrollBars" , |
771 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 101), |
772 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
773 | .scale: 1, |
774 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
775 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
776 | .hmin: ExpectedValueDescription(-101), |
777 | .hmax: ExpectedValueDescription(-50, 1, 1), |
778 | .vmin: ExpectedValueDescription(-101), |
779 | .vmax: ExpectedValueDescription(0, 1, 1), |
780 | }, |
781 | { |
782 | .name: "13 Always ScrollBars" , |
783 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
784 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
785 | .scale: 1, |
786 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
787 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
788 | .hmin: ExpectedValueDescription(), |
789 | .hmax: ExpectedValueDescription(0, 2, 1), |
790 | .vmin: ExpectedValueDescription(), |
791 | .vmax: ExpectedValueDescription(0, 2, 1), |
792 | }, |
793 | { |
794 | .name: "14 Always ScrollBars" , |
795 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
796 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
797 | .scale: 1, |
798 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
799 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
800 | .hmin: ExpectedValueDescription(), |
801 | .hmax: ExpectedValueDescription(50, 2, 1), |
802 | .vmin: ExpectedValueDescription(), |
803 | .vmax: ExpectedValueDescription(0, 2, 1), |
804 | }, |
805 | { |
806 | .name: "15 Always ScrollBars" , |
807 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
808 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
809 | .scale: 1, |
810 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
811 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
812 | .hmin: ExpectedValueDescription(), |
813 | .hmax: ExpectedValueDescription(50, 2, 1), |
814 | .vmin: ExpectedValueDescription(), |
815 | .vmax: ExpectedValueDescription(100, 2, 1), |
816 | }, |
817 | { |
818 | .name: "16 Always ScrollBars" , |
819 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
820 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
821 | .scale: 1, |
822 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
823 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
824 | .hmin: ExpectedValueDescription(-100, -1), |
825 | .hmax: ExpectedValueDescription(-100, 1, 1), |
826 | .vmin: ExpectedValueDescription(-100, -1), |
827 | .vmax: ExpectedValueDescription(-100, 1, 1), |
828 | }, |
829 | { |
830 | .name: "17 Always ScrollBars" , |
831 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
832 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
833 | .scale: 1, |
834 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
835 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
836 | .hmin: ExpectedValueDescription(-100, -1), |
837 | .hmax: ExpectedValueDescription(-50, 1, 1), |
838 | .vmin: ExpectedValueDescription(-100, -1), |
839 | .vmax: ExpectedValueDescription(-100, 1, 1), |
840 | }, |
841 | { |
842 | .name: "18 Always ScrollBars" , |
843 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
844 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
845 | .scale: 1, |
846 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
847 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
848 | .hmin: ExpectedValueDescription(-100, -1), |
849 | .hmax: ExpectedValueDescription(-50, 1, 1), |
850 | .vmin: ExpectedValueDescription(-100, -1), |
851 | .vmax: ExpectedValueDescription(0, 1, 1), |
852 | }, |
853 | { |
854 | .name: "1 x2 Always ScrollBars" , |
855 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
856 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
857 | .scale: 2, |
858 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
859 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
860 | .hmin: ExpectedValueDescription(), |
861 | .hmax: ExpectedValueDescription(viewWidth, 1, 1), |
862 | .vmin: ExpectedValueDescription(), |
863 | .vmax: ExpectedValueDescription(viewHeight, 1, 1), |
864 | }, |
865 | { |
866 | .name: "2 x2 Always ScrollBars" , |
867 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
868 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
869 | .scale: 2, |
870 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
871 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
872 | .hmin: ExpectedValueDescription(), |
873 | .hmax: ExpectedValueDescription(viewWidth + 100, 1, 1), |
874 | .vmin: ExpectedValueDescription(), |
875 | .vmax: ExpectedValueDescription(viewHeight, 1, 1), |
876 | }, |
877 | { |
878 | .name: "3 x2 Always ScrollBars" , |
879 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
880 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
881 | .scale: 2, |
882 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
883 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
884 | .hmin: ExpectedValueDescription(), |
885 | .hmax: ExpectedValueDescription(viewWidth + 100, 1, 1), |
886 | .vmin: ExpectedValueDescription(), |
887 | .vmax: ExpectedValueDescription(viewHeight + 200, 1, 1), |
888 | }, |
889 | { |
890 | .name: "4 x2 Always ScrollBars" , |
891 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
892 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
893 | .scale: 2, |
894 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
895 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
896 | .hmin: ExpectedValueDescription(-200), |
897 | .hmax: ExpectedValueDescription(viewWidth - 200, 1, 1), |
898 | .vmin: ExpectedValueDescription(-200), |
899 | .vmax: ExpectedValueDescription(viewHeight - 200, 1, 1), |
900 | }, |
901 | { |
902 | .name: "5 x2 Always ScrollBars" , |
903 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
904 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
905 | .scale: 2, |
906 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
907 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
908 | .hmin: ExpectedValueDescription(-200), |
909 | .hmax: ExpectedValueDescription(viewWidth - 100, 1, 1), |
910 | .vmin: ExpectedValueDescription(-200), |
911 | .vmax: ExpectedValueDescription(viewHeight - 200, 1, 1), |
912 | }, |
913 | { |
914 | .name: "6 x2 Always ScrollBars" , |
915 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
916 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
917 | .scale: 2, |
918 | .hbarpolicy: Qt::ScrollBarAlwaysOn, |
919 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
920 | .hmin: ExpectedValueDescription(-200), |
921 | .hmax: ExpectedValueDescription(viewWidth - 100, 1, 1), |
922 | .vmin: ExpectedValueDescription(-200), |
923 | .vmax: ExpectedValueDescription(viewHeight, 1, 1), |
924 | }, |
925 | { |
926 | .name: "1 Vertical Only" , |
927 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
928 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
929 | .scale: 1, |
930 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
931 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
932 | .hmin: ExpectedValueDescription(), |
933 | .hmax: ExpectedValueDescription(0, 1, 1), |
934 | .vmin: ExpectedValueDescription(), |
935 | .vmax: ExpectedValueDescription(), |
936 | }, |
937 | { |
938 | .name: "2 Vertical Only" , |
939 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
940 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
941 | .scale: 1, |
942 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
943 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
944 | .hmin: ExpectedValueDescription(), |
945 | .hmax: ExpectedValueDescription(50, 1, 1), |
946 | .vmin: ExpectedValueDescription(), |
947 | .vmax: ExpectedValueDescription(), |
948 | }, |
949 | { |
950 | .name: "3 Vertical Only" , |
951 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
952 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
953 | .scale: 1, |
954 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
955 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
956 | .hmin: ExpectedValueDescription(), |
957 | .hmax: ExpectedValueDescription(50, 1, 1), |
958 | .vmin: ExpectedValueDescription(), |
959 | .vmax: ExpectedValueDescription(100), |
960 | }, |
961 | { |
962 | .name: "4 Vertical Only" , |
963 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
964 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
965 | .scale: 1, |
966 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
967 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
968 | .hmin: ExpectedValueDescription(-100), |
969 | .hmax: ExpectedValueDescription(-100, 1, 1), |
970 | .vmin: ExpectedValueDescription(), |
971 | .vmax: ExpectedValueDescription(), |
972 | }, |
973 | { |
974 | .name: "5 Vertical Only" , |
975 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
976 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
977 | .scale: 1, |
978 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
979 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
980 | .hmin: ExpectedValueDescription(-100), |
981 | .hmax: ExpectedValueDescription(-50, 1, 1), |
982 | .vmin: ExpectedValueDescription(), |
983 | .vmax: ExpectedValueDescription(), |
984 | }, |
985 | { |
986 | .name: "6 Vertical Only" , |
987 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
988 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
989 | .scale: 1, |
990 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
991 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
992 | .hmin: ExpectedValueDescription(-100), |
993 | .hmax: ExpectedValueDescription(-50, 1, 1), |
994 | .vmin: ExpectedValueDescription(-100), |
995 | .vmax: ExpectedValueDescription(), |
996 | }, |
997 | { |
998 | .name: "7 Vertical Only" , |
999 | .sceneRect: QRectF(0, 0, viewWidth + 1, viewHeight + 1), |
1000 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1001 | .scale: 1, |
1002 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1003 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1004 | .hmin: ExpectedValueDescription(), |
1005 | .hmax: ExpectedValueDescription(1, 1, 1), |
1006 | .vmin: ExpectedValueDescription(), |
1007 | .vmax: ExpectedValueDescription(1), |
1008 | }, |
1009 | { |
1010 | .name: "8 Vertical Only" , |
1011 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 1), |
1012 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1013 | .scale: 1, |
1014 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1015 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1016 | .hmin: ExpectedValueDescription(), |
1017 | .hmax: ExpectedValueDescription(51, 1, 1), |
1018 | .vmin: ExpectedValueDescription(), |
1019 | .vmax: ExpectedValueDescription(1), |
1020 | }, |
1021 | { |
1022 | .name: "9 Vertical Only" , |
1023 | .sceneRect: QRectF(0, 0, viewWidth + 51, viewHeight + 101), |
1024 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1025 | .scale: 1, |
1026 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1027 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1028 | .hmin: ExpectedValueDescription(), |
1029 | .hmax: ExpectedValueDescription(51, 1, 1), |
1030 | .vmin: ExpectedValueDescription(), |
1031 | .vmax: ExpectedValueDescription(101), |
1032 | }, |
1033 | { |
1034 | .name: "10 Vertical Only" , |
1035 | .sceneRect: QRectF(-101, -101, viewWidth + 1, viewHeight +1), |
1036 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1037 | .scale: 1, |
1038 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1039 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1040 | .hmin: ExpectedValueDescription(-101), |
1041 | .hmax: ExpectedValueDescription(-100, 1, 1), |
1042 | .vmin: ExpectedValueDescription(-101), |
1043 | .vmax: ExpectedValueDescription(-100), |
1044 | }, |
1045 | { |
1046 | .name: "11 Vertical Only" , |
1047 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 1), |
1048 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1049 | .scale: 1, |
1050 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1051 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1052 | .hmin: ExpectedValueDescription(-101), |
1053 | .hmax: ExpectedValueDescription(-50, 1, 1), |
1054 | .vmin: ExpectedValueDescription(-101), |
1055 | .vmax: ExpectedValueDescription(-100), |
1056 | }, |
1057 | { |
1058 | .name: "12 Vertical Only" , |
1059 | .sceneRect: QRectF(-101, -101, viewWidth + 51, viewHeight + 101), |
1060 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1061 | .scale: 1, |
1062 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1063 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1064 | .hmin: ExpectedValueDescription(-101), |
1065 | .hmax: ExpectedValueDescription(-50, 1, 1), |
1066 | .vmin: ExpectedValueDescription(-101), |
1067 | .vmax: ExpectedValueDescription(), |
1068 | }, |
1069 | { |
1070 | .name: "13 Vertical Only" , |
1071 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
1072 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
1073 | .scale: 1, |
1074 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1075 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1076 | .hmin: ExpectedValueDescription(), |
1077 | .hmax: ExpectedValueDescription(0, 2, 1), |
1078 | .vmin: ExpectedValueDescription(), |
1079 | .vmax: ExpectedValueDescription(0, 1), |
1080 | }, |
1081 | { |
1082 | .name: "14 Vertical Only" , |
1083 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
1084 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
1085 | .scale: 1, |
1086 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1087 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1088 | .hmin: ExpectedValueDescription(), |
1089 | .hmax: ExpectedValueDescription(50, 2, 1), |
1090 | .vmin: ExpectedValueDescription(), |
1091 | .vmax: ExpectedValueDescription(0, 1), |
1092 | }, |
1093 | { |
1094 | .name: "15 Vertical Only" , |
1095 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
1096 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 1, 1), |
1097 | .scale: 1, |
1098 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1099 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1100 | .hmin: ExpectedValueDescription(), |
1101 | .hmax: ExpectedValueDescription(50, 2, 1), |
1102 | .vmin: ExpectedValueDescription(), |
1103 | .vmax: ExpectedValueDescription(100, 1), |
1104 | }, |
1105 | { |
1106 | .name: "16 Vertical Only" , |
1107 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
1108 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
1109 | .scale: 1, |
1110 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1111 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1112 | .hmin: ExpectedValueDescription(-100, -1), |
1113 | .hmax: ExpectedValueDescription(-100, 1, 1), |
1114 | .vmin: ExpectedValueDescription(-100, -1), |
1115 | .vmax: ExpectedValueDescription(-100), |
1116 | }, |
1117 | { |
1118 | .name: "17 Vertical Only" , |
1119 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
1120 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
1121 | .scale: 1, |
1122 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1123 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1124 | .hmin: ExpectedValueDescription(-100, -1), |
1125 | .hmax: ExpectedValueDescription(-50, 1, 1), |
1126 | .vmin: ExpectedValueDescription(-100, -1), |
1127 | .vmax: ExpectedValueDescription(-100), |
1128 | }, |
1129 | { |
1130 | .name: "18 Vertical Only" , |
1131 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
1132 | .sceneRectOffsetFactors: ScrollBarCount(-1, -1, 1, 1), |
1133 | .scale: 1, |
1134 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1135 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1136 | .hmin: ExpectedValueDescription(-100, -1), |
1137 | .hmax: ExpectedValueDescription(-50, 1, 1), |
1138 | .vmin: ExpectedValueDescription(-100, -1), |
1139 | .vmax: ExpectedValueDescription(), |
1140 | }, |
1141 | { |
1142 | .name: "1 x2 Vertical Only" , |
1143 | .sceneRect: QRectF(0, 0, viewWidth, viewHeight), |
1144 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1145 | .scale: 2, |
1146 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1147 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1148 | .hmin: ExpectedValueDescription(), |
1149 | .hmax: ExpectedValueDescription(viewWidth, 1, 1), |
1150 | .vmin: ExpectedValueDescription(), |
1151 | .vmax: ExpectedValueDescription(viewHeight), |
1152 | }, |
1153 | { |
1154 | .name: "2 x2 Vertical Only" , |
1155 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight), |
1156 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1157 | .scale: 2, |
1158 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1159 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1160 | .hmin: ExpectedValueDescription(), |
1161 | .hmax: ExpectedValueDescription(viewWidth + 100, 1, 1), |
1162 | .vmin: ExpectedValueDescription(), |
1163 | .vmax: ExpectedValueDescription(viewHeight), |
1164 | }, |
1165 | { |
1166 | .name: "3 x2 Vertical Only" , |
1167 | .sceneRect: QRectF(0, 0, viewWidth + 50, viewHeight + 100), |
1168 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1169 | .scale: 2, |
1170 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1171 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1172 | .hmin: ExpectedValueDescription(), |
1173 | .hmax: ExpectedValueDescription(viewWidth + 100, 1, 1), |
1174 | .vmin: ExpectedValueDescription(), |
1175 | .vmax: ExpectedValueDescription(viewHeight + 200), |
1176 | }, |
1177 | { |
1178 | .name: "4 x2 Vertical Only" , |
1179 | .sceneRect: QRectF(-100, -100, viewWidth, viewHeight), |
1180 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1181 | .scale: 2, |
1182 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1183 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1184 | .hmin: ExpectedValueDescription(-200), |
1185 | .hmax: ExpectedValueDescription(viewWidth - 200, 1, 1), |
1186 | .vmin: ExpectedValueDescription(-200), |
1187 | .vmax: ExpectedValueDescription(viewHeight - 200), |
1188 | }, |
1189 | { |
1190 | .name: "5 x2 Vertical Only" , |
1191 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight), |
1192 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1193 | .scale: 2, |
1194 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1195 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1196 | .hmin: ExpectedValueDescription(-200), |
1197 | .hmax: ExpectedValueDescription(viewWidth - 100, 1, 1), |
1198 | .vmin: ExpectedValueDescription(-200), |
1199 | .vmax: ExpectedValueDescription(viewHeight - 200), |
1200 | }, |
1201 | { |
1202 | .name: "6 x2 Vertical Only" , |
1203 | .sceneRect: QRectF(-100, -100, viewWidth + 50, viewHeight + 100), |
1204 | .sceneRectOffsetFactors: ScrollBarCount(0, 0, 0, 0), |
1205 | .scale: 2, |
1206 | .hbarpolicy: Qt::ScrollBarAlwaysOff, |
1207 | .vbarpolicy: Qt::ScrollBarAlwaysOn, |
1208 | .hmin: ExpectedValueDescription(-200), |
1209 | .hmax: ExpectedValueDescription(viewWidth - 100, 1, 1), |
1210 | .vmin: ExpectedValueDescription(-200), |
1211 | .vmax: ExpectedValueDescription(viewHeight), |
1212 | }, |
1213 | }; |
1214 | |
1215 | const QSize viewSize(viewWidth, viewHeight); |
1216 | |
1217 | for (const Data &e : data) { |
1218 | QTest::addRow(format: "%s%s, %s" , style.data(), styled ? ", Styled" : "" , e.name) |
1219 | << style << viewSize |
1220 | << e.sceneRect |
1221 | << e.sceneRectOffsetFactors |
1222 | << QTransform().scale(sx: e.scale, sy: e.scale) |
1223 | << e.hbarpolicy |
1224 | << e.vbarpolicy |
1225 | << e.hmin << e.hmax << e.vmin << e.vmax |
1226 | << styled; |
1227 | } |
1228 | } |
1229 | |
1230 | void _scrollBarRanges_data() |
1231 | { |
1232 | QTest::addColumn<QByteArray>(name: "style" ); |
1233 | QTest::addColumn<QSize>(name: "viewportSize" ); |
1234 | QTest::addColumn<QRectF>(name: "sceneRect" ); |
1235 | QTest::addColumn<ScrollBarCount>(name: "sceneRectOffsetFactors" ); |
1236 | QTest::addColumn<QTransform>(name: "transform" ); |
1237 | QTest::addColumn<Qt::ScrollBarPolicy>(name: "hbarpolicy" ); |
1238 | QTest::addColumn<Qt::ScrollBarPolicy>(name: "vbarpolicy" ); |
1239 | QTest::addColumn<ExpectedValueDescription>(name: "hmin" ); |
1240 | QTest::addColumn<ExpectedValueDescription>(name: "hmax" ); |
1241 | QTest::addColumn<ExpectedValueDescription>(name: "vmin" ); |
1242 | QTest::addColumn<ExpectedValueDescription>(name: "vmax" ); |
1243 | QTest::addColumn<bool>(name: "useStyledPanel" ); |
1244 | |
1245 | const auto styles = QStyleFactory::keys(); |
1246 | for (const QString &style : styles) { |
1247 | _scrollBarRanges_addTestData(style: style.toLatin1(), styled: false); |
1248 | _scrollBarRanges_addTestData(style: style.toLatin1(), styled: true); |
1249 | } |
1250 | |
1251 | const QScreen *screen = QGuiApplication::primaryScreen(); |
1252 | if (screen && qFuzzyCompare(p1: (double)screen->logicalDotsPerInchX(), p2: 96.0)) { |
1253 | _scrollBarRanges_addTestData(style: "motif" , styled: false); |
1254 | _scrollBarRanges_addTestData(style: "motif" , styled: true); |
1255 | } |
1256 | } |
1257 | |