OpenCoverage

qabstractprintdialog.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/printsupport/dialogs/qabstractprintdialog.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6-
7class QPrintDialogPrivate : public QAbstractPrintDialogPrivate-
8{-
9};-
10QAbstractPrintDialog::QAbstractPrintDialog(QPrinter *printer, QWidget *parent)-
11 : QDialog(*(new QAbstractPrintDialogPrivate), parent)-
12{-
13 QAbstractPrintDialogPrivate * const d = d_func();-
14 setWindowTitle(QCoreApplication::translate("QPrintDialog", "Print"));-
15 d->setPrinter(printer);-
16 d->minPage = printer->fromPage();-
17 int to = printer->toPage();-
18 d->maxPage = to > 0
to > 0Description
TRUEnever evaluated
FALSEevaluated 3 times by 1 test
Evaluated by:
  • tst_QAbstractPrintDialog
? to : 2147483647;
0-3
19}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QAbstractPrintDialog
3
20-
21-
22-
23-
24QAbstractPrintDialog::QAbstractPrintDialog(QAbstractPrintDialogPrivate &ptr,-
25 QPrinter *printer,-
26 QWidget *parent)-
27 : QDialog(ptr, parent)-
28{-
29 QAbstractPrintDialogPrivate * const d = d_func();-
30 setWindowTitle(QCoreApplication::translate("QPrintDialog", "Print"));-
31 d->setPrinter(printer);-
32}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QPrinter
3
33-
34-
35-
36-
37QAbstractPrintDialog::~QAbstractPrintDialog()-
38{-
39 QAbstractPrintDialogPrivate * const d = d_func();-
40 if (d->ownsPrinter
d->ownsPrinterDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
)
1-5
41 delete d->printer;
executed 1 time by 1 test: delete d->printer;
Executed by:
  • tst_QPrinter
1
42}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
6
43-
44-
45-
46-
47-
48-
49-
50void QPrintDialog::setOption(PrintDialogOption option, bool on)-
51{-
52 QPrintDialogPrivate * const d = d_func();-
53 if (!(d->options & option) != !on
!(d->options & option) != !onDescription
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEnever evaluated
)
0-1
54 setOptions(d->options ^ option);
executed 1 time by 1 test: setOptions(d->options ^ option);
Executed by:
  • tst_QPrinter
1
55}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
56-
57-
58-
59-
60-
61-
62-
63bool QPrintDialog::testOption(PrintDialogOption option) const-
64{-
65 const QPrintDialogPrivate * const d = d_func();-
66 return
never executed: return (d->options & option) != 0;
(d->options & option) != 0;
never executed: return (d->options & option) != 0;
0
67}-
68void QPrintDialog::setOptions(PrintDialogOptions options)-
69{-
70 QPrintDialogPrivate * const d = d_func();-
71-
72 PrintDialogOptions changed = (options ^ d->options);-
73 if (!changed
!changedDescription
TRUEnever evaluated
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
)
0-1
74 return;
never executed: return;
0
75-
76 d->options = options;-
77}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
78-
79QPrintDialog::PrintDialogOptions QPrintDialog::options() const-
80{-
81 const QPrintDialogPrivate * const d = d_func();-
82 return
never executed: return d->options;
d->options;
never executed: return d->options;
0
83}-
84-
85-
86-
87-
88-
89-
90void QAbstractPrintDialog::setEnabledOptions(PrintDialogOptions options)-
91{-
92 QAbstractPrintDialogPrivate * const d = d_func();-
93 d->options = options;-
94}
executed 10 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
10
95-
96-
97-
98-
99-
100-
101void QAbstractPrintDialog::addEnabledOption(PrintDialogOption option)-
102{-
103 QAbstractPrintDialogPrivate * const d = d_func();-
104 d->options |= option;-
105}
never executed: end of block
0
106-
107-
108-
109-
110-
111-
112QAbstractPrintDialog::PrintDialogOptions QAbstractPrintDialog::enabledOptions() const-
113{-
114 const QAbstractPrintDialogPrivate * const d = d_func();-
115 return
executed 5 times by 1 test: return d->options;
Executed by:
  • tst_QAbstractPrintDialog
d->options;
executed 5 times by 1 test: return d->options;
Executed by:
  • tst_QAbstractPrintDialog
5
116}-
117-
118-
119-
120-
121-
122-
123bool QAbstractPrintDialog::isOptionEnabled(PrintDialogOption option) const-
124{-
125 const QAbstractPrintDialogPrivate * const d = d_func();-
126 return
executed 27 times by 1 test: return d->options & option;
Executed by:
  • tst_QPrinter
d->options & option;
executed 27 times by 1 test: return d->options & option;
Executed by:
  • tst_QPrinter
27
127}-
128-
129-
130-
131-
132void QAbstractPrintDialog::setPrintRange(PrintRange range)-
133{-
134 QAbstractPrintDialogPrivate * const d = d_func();-
135 d->printer->setPrintRange(QPrinter::PrintRange(range));-
136}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QAbstractPrintDialog
3
137-
138-
139-
140-
141QAbstractPrintDialog::PrintRange QAbstractPrintDialog::printRange() const-
142{-
143 const QAbstractPrintDialogPrivate * const d = d_func();-
144 return
executed 4 times by 2 tests: return QAbstractPrintDialog::PrintRange(d->pd->printRange);
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
QAbstractPrintDialog::PrintRange(d->pd->printRange);
executed 4 times by 2 tests: return QAbstractPrintDialog::PrintRange(d->pd->printRange);
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
4
145}-
146-
147-
148-
149-
150-
151void QAbstractPrintDialog::setMinMax(int min, int max)-
152{-
153 QAbstractPrintDialogPrivate * const d = d_func();-
154 ((!(min <= max)) ? qt_assert_x("QAbstractPrintDialog::setMinMax", "'min' must be less than or equal to 'max'",-
155 __FILE__-
156 ,-
157 267-
158 ) : qt_noop())-
159 ;-
160 d->minPage = min;-
161 d->maxPage = max;-
162 d->options |= PrintPageRange;-
163}
executed 2 times by 1 test: end of block
Executed by:
  • tst_QAbstractPrintDialog
2
164-
165-
166-
167-
168-
169int QAbstractPrintDialog::minPage() const-
170{-
171 const QAbstractPrintDialogPrivate * const d = d_func();-
172 return
executed 4 times by 2 tests: return d->minPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
d->minPage;
executed 4 times by 2 tests: return d->minPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
4
173}-
174-
175-
176-
177-
178-
179-
180int QAbstractPrintDialog::maxPage() const-
181{-
182 const QAbstractPrintDialogPrivate * const d = d_func();-
183 return
executed 4 times by 2 tests: return d->maxPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
d->maxPage;
executed 4 times by 2 tests: return d->maxPage;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
4
184}-
185-
186-
187-
188-
189void QAbstractPrintDialog::setFromTo(int from, int to)-
190{-
191 QAbstractPrintDialogPrivate * const d = d_func();-
192 ((!(from <= to)) ? qt_assert_x("QAbstractPrintDialog::setFromTo", "'from' must be less than or equal to 'to'",-
193 __FILE__-
194 ,-
195 301-
196 ) : qt_noop())-
197 ;-
198 d->printer->setFromTo(from, to);-
199-
200 if (d->minPage == 0
d->minPage == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAbstractPrintDialog
FALSEnever evaluated
&& d->maxPage == 0
d->maxPage == 0Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QAbstractPrintDialog
FALSEnever evaluated
)
0-1
201 setMinMax(1, to);
executed 1 time by 1 test: setMinMax(1, to);
Executed by:
  • tst_QAbstractPrintDialog
1
202}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QAbstractPrintDialog
1
203-
204-
205-
206-
207-
208int QAbstractPrintDialog::fromPage() const-
209{-
210 const QAbstractPrintDialogPrivate * const d = d_func();-
211 return
executed 3 times by 2 tests: return d->printer->fromPage();
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
d->printer->fromPage();
executed 3 times by 2 tests: return d->printer->fromPage();
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
3
212}-
213-
214-
215-
216-
217-
218int QAbstractPrintDialog::toPage() const-
219{-
220 const QAbstractPrintDialogPrivate * const d = d_func();-
221 return
executed 3 times by 2 tests: return d->printer->toPage();
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
d->printer->toPage();
executed 3 times by 2 tests: return d->printer->toPage();
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
3
222}-
223-
224-
225-
226-
227-
228-
229QPrinter *QAbstractPrintDialog::printer() const-
230{-
231 const QAbstractPrintDialogPrivate * const d = d_func();-
232 return
executed 9 times by 2 tests: return d->printer;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
d->printer;
executed 9 times by 2 tests: return d->printer;
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
9
233}-
234-
235void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter)-
236{-
237 if (newPrinter
newPrinterDescription
TRUEevaluated 5 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
FALSEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
) {
1-5
238 printer = newPrinter;-
239 ownsPrinter = false;-
240 if (printer->fromPage()
printer->fromPage()Description
TRUEevaluated 1 time by 1 test
Evaluated by:
  • tst_QPrinter
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
|| printer->toPage()
printer->toPage()Description
TRUEnever evaluated
FALSEevaluated 4 times by 2 tests
Evaluated by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
)
0-4
241 options |= QAbstractPrintDialog::PrintPageRange;
executed 1 time by 1 test: options |= QAbstractPrintDialog::PrintPageRange;
Executed by:
  • tst_QPrinter
1
242 }
executed 5 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
else {
5
243 printer = new QPrinter;-
244 ownsPrinter = true;-
245 }
executed 1 time by 1 test: end of block
Executed by:
  • tst_QPrinter
1
246 pd = printer->d_func();-
247}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_QAbstractPrintDialog
  • tst_QPrinter
6
248void QAbstractPrintDialog::setOptionTabs(const QList<QWidget*> &tabs)-
249{-
250 QAbstractPrintDialogPrivate * const d = d_func();-
251 d->setTabs(tabs);-
252}
never executed: end of block
0
253void QPrintDialog::done(int result)-
254{-
255 QPrintDialogPrivate * const d = d_func();-
256 QDialog::done(result);-
257 if (result == Accepted
result == AcceptedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
258 accepted(printer());
never executed: accepted(printer());
0
259 if (d->receiverToDisconnectOnClose
d->receiverToDisconnectOnCloseDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
260 disconnect(this, qFlagLocation("2""accepted(QPrinter*)" "\0" __FILE__ ":" "474"),-
261 d->receiverToDisconnectOnClose, d->memberToDisconnectOnClose);-
262 d->receiverToDisconnectOnClose = 0;-
263 }
never executed: end of block
0
264 d->memberToDisconnectOnClose.clear();-
265}
never executed: end of block
0
266void QPrintDialog::open(QObject *receiver, const char *member)-
267{-
268 QPrintDialogPrivate * const d = d_func();-
269 connect(this, qFlagLocation("2""accepted(QPrinter*)" "\0" __FILE__ ":" "493"), receiver, member);-
270 d->receiverToDisconnectOnClose = receiver;-
271 d->memberToDisconnectOnClose = member;-
272 QDialog::open();-
273}
never executed: end of block
0
274-
275-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9