| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/printsupport/kernel/qprintengine_pdf.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||
|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||
| 2 | - | |||||||
| 3 | - | |||||||
| 4 | - | |||||||
| 5 | - | |||||||
| 6 | - | |||||||
| 7 | - | |||||||
| 8 | - | |||||||
| 9 | - | |||||||
| 10 | - | |||||||
| 11 | - | |||||||
| 12 | - | |||||||
| 13 | - | |||||||
| 14 | QPdfPrintEngine::QPdfPrintEngine(QPrinter::PrinterMode m) | - | ||||||
| 15 | : QPdfEngine(*new QPdfPrintEnginePrivate(m)) | - | ||||||
| 16 | { | - | ||||||
| 17 | state = QPrinter::Idle; | - | ||||||
| 18 | } executed 128 times by 2 tests: end of blockExecuted by:
| 128 | ||||||
| 19 | - | |||||||
| 20 | QPdfPrintEngine::QPdfPrintEngine(QPdfPrintEnginePrivate &p) | - | ||||||
| 21 | : QPdfEngine(p) | - | ||||||
| 22 | { | - | ||||||
| 23 | state = QPrinter::Idle; | - | ||||||
| 24 | } never executed: end of block | 0 | ||||||
| 25 | - | |||||||
| 26 | QPdfPrintEngine::~QPdfPrintEngine() | - | ||||||
| 27 | { | - | ||||||
| 28 | } | - | ||||||
| 29 | - | |||||||
| 30 | bool QPdfPrintEngine::begin(QPaintDevice *pdev) | - | ||||||
| 31 | { | - | ||||||
| 32 | QPdfPrintEnginePrivate * const d = d_func(); | - | ||||||
| 33 | - | |||||||
| 34 | if (!d->openPrintDevice()
| 1-20 | ||||||
| 35 | state = QPrinter::Error; | - | ||||||
| 36 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||
| 37 | } | - | ||||||
| 38 | state = QPrinter::Active; | - | ||||||
| 39 | - | |||||||
| 40 | return executed 20 times by 1 test: QPdfEngine::begin(pdev);return QPdfEngine::begin(pdev);Executed by:
executed 20 times by 1 test: return QPdfEngine::begin(pdev);Executed by:
| 20 | ||||||
| 41 | } | - | ||||||
| 42 | - | |||||||
| 43 | bool QPdfPrintEngine::end() | - | ||||||
| 44 | { | - | ||||||
| 45 | QPdfPrintEnginePrivate * const d = d_func(); | - | ||||||
| 46 | - | |||||||
| 47 | QPdfEngine::end(); | - | ||||||
| 48 | - | |||||||
| 49 | d->closePrintDevice(); | - | ||||||
| 50 | state = QPrinter::Idle; | - | ||||||
| 51 | - | |||||||
| 52 | return executed 20 times by 1 test: true;return true;Executed by:
executed 20 times by 1 test: return true;Executed by:
| 20 | ||||||
| 53 | } | - | ||||||
| 54 | - | |||||||
| 55 | bool QPdfPrintEngine::newPage() | - | ||||||
| 56 | { | - | ||||||
| 57 | return never executed: QPdfEngine::newPage();return QPdfEngine::newPage();never executed: return QPdfEngine::newPage(); | 0 | ||||||
| 58 | } | - | ||||||
| 59 | - | |||||||
| 60 | int QPdfPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const | - | ||||||
| 61 | { | - | ||||||
| 62 | return executed 193 times by 1 test: QPdfEngine::metric(m);return QPdfEngine::metric(m);Executed by:
executed 193 times by 1 test: return QPdfEngine::metric(m);Executed by:
| 193 | ||||||
| 63 | } | - | ||||||
| 64 | - | |||||||
| 65 | void QPdfPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value) | - | ||||||
| 66 | { | - | ||||||
| 67 | QPdfPrintEnginePrivate * const d = d_func(); | - | ||||||
| 68 | - | |||||||
| 69 | switch (int(key)) { | - | ||||||
| 70 | - | |||||||
| 71 | - | |||||||
| 72 | case never executed: PPK_PageRect:case PPK_PageRect:never executed: case PPK_PageRect: | 0 | ||||||
| 73 | break; never executed: break; | 0 | ||||||
| 74 | case never executed: PPK_PaperRect:case PPK_PaperRect:never executed: case PPK_PaperRect: | 0 | ||||||
| 75 | break; never executed: break; | 0 | ||||||
| 76 | case never executed: PPK_PaperSources:case PPK_PaperSources:never executed: case PPK_PaperSources: | 0 | ||||||
| 77 | break; never executed: break; | 0 | ||||||
| 78 | case never executed: PPK_SupportsMultipleCopies:case PPK_SupportsMultipleCopies:never executed: case PPK_SupportsMultipleCopies: | 0 | ||||||
| 79 | break; never executed: break; | 0 | ||||||
| 80 | case never executed: PPK_SupportedResolutions:case PPK_SupportedResolutions:never executed: case PPK_SupportedResolutions: | 0 | ||||||
| 81 | break; never executed: break; | 0 | ||||||
| 82 | - | |||||||
| 83 | - | |||||||
| 84 | case never executed: PPK_CustomBase:case PPK_CustomBase:never executed: case PPK_CustomBase: | 0 | ||||||
| 85 | break; never executed: break; | 0 | ||||||
| 86 | - | |||||||
| 87 | - | |||||||
| 88 | case executed 1 time by 1 test: PPK_CollateCopies:case PPK_CollateCopies:Executed by:
executed 1 time by 1 test: case PPK_CollateCopies:Executed by:
| 1 | ||||||
| 89 | d->collate = value.toBool(); | - | ||||||
| 90 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 91 | case executed 1 time by 1 test: PPK_ColorMode:case PPK_ColorMode:Executed by:
executed 1 time by 1 test: case PPK_ColorMode:Executed by:
| 1 | ||||||
| 92 | d->grayscale = (QPrinter::ColorMode(value.toInt()) == QPrinter::GrayScale); | - | ||||||
| 93 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 94 | case executed 1 time by 1 test: PPK_Creator:case PPK_Creator:Executed by:
executed 1 time by 1 test: case PPK_Creator:Executed by:
| 1 | ||||||
| 95 | d->creator = value.toString(); | - | ||||||
| 96 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 97 | case executed 2 times by 1 test: PPK_DocumentName:case PPK_DocumentName:Executed by:
executed 2 times by 1 test: case PPK_DocumentName:Executed by:
| 2 | ||||||
| 98 | d->title = value.toString(); | - | ||||||
| 99 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 100 | case executed 19 times by 1 test: PPK_FullPage:case PPK_FullPage:Executed by:
executed 19 times by 1 test: case PPK_FullPage:Executed by:
| 19 | ||||||
| 101 | if (value.toBool()
| 5-14 | ||||||
| 102 | d->m_pageLayout.setMode(QPageLayout::FullPageMode); executed 14 times by 1 test: d->m_pageLayout.setMode(QPageLayout::FullPageMode);Executed by:
| 14 | ||||||
| 103 | else | - | ||||||
| 104 | d->m_pageLayout.setMode(QPageLayout::StandardMode); executed 5 times by 1 test: d->m_pageLayout.setMode(QPageLayout::StandardMode);Executed by:
| 5 | ||||||
| 105 | break; executed 19 times by 1 test: break;Executed by:
| 19 | ||||||
| 106 | case executed 1 time by 1 test: PPK_CopyCount:case PPK_CopyCount:Executed by:
executed 1 time by 1 test: case PPK_CopyCount:Executed by:
| 1 | ||||||
| 107 | case executed 1 time by 1 test: PPK_NumberOfCopies:case PPK_NumberOfCopies:Executed by:
executed 1 time by 1 test: case PPK_NumberOfCopies:Executed by:
| 1 | ||||||
| 108 | d->copies = value.toInt(); | - | ||||||
| 109 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 110 | case executed 48 times by 1 test: PPK_Orientation:case PPK_Orientation:Executed by:
executed 48 times by 1 test: case PPK_Orientation:Executed by:
| 48 | ||||||
| 111 | d->m_pageLayout.setOrientation(QPageLayout::Orientation(value.toInt())); | - | ||||||
| 112 | break; executed 48 times by 1 test: break;Executed by:
| 48 | ||||||
| 113 | case executed 39 times by 1 test: PPK_OutputFileName:case PPK_OutputFileName:Executed by:
executed 39 times by 1 test: case PPK_OutputFileName:Executed by:
| 39 | ||||||
| 114 | d->outputFileName = value.toString(); | - | ||||||
| 115 | break; executed 39 times by 1 test: break;Executed by:
| 39 | ||||||
| 116 | case executed 1 time by 1 test: PPK_PageOrder:case PPK_PageOrder:Executed by:
executed 1 time by 1 test: case PPK_PageOrder:Executed by:
| 1 | ||||||
| 117 | d->pageOrder = QPrinter::PageOrder(value.toInt()); | - | ||||||
| 118 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 119 | case never executed: PPK_PageSize:case PPK_PageSize:never executed: {case PPK_PageSize: | 0 | ||||||
| 120 | QPageSize pageSize = QPageSize(QPageSize::PageSizeId(value.toInt())); | - | ||||||
| 121 | if (pageSize.isValid()
| 0 | ||||||
| 122 | d->m_pageLayout.setPageSize(pageSize); never executed: d->m_pageLayout.setPageSize(pageSize); | 0 | ||||||
| 123 | break; never executed: break; | 0 | ||||||
| 124 | } | - | ||||||
| 125 | case never executed: PPK_PaperName:case PPK_PaperName:never executed: {case PPK_PaperName: | 0 | ||||||
| 126 | QString name = value.toString(); | - | ||||||
| 127 | for (int i = 0; i <= QPageSize::LastPageSize
| 0 | ||||||
| 128 | QPageSize pageSize = QPageSize(QPageSize::PageSizeId(i)); | - | ||||||
| 129 | if (name == pageSize.name()
| 0 | ||||||
| 130 | d->m_pageLayout.setPageSize(pageSize); | - | ||||||
| 131 | break; never executed: break; | 0 | ||||||
| 132 | } | - | ||||||
| 133 | } never executed: end of block | 0 | ||||||
| 134 | break; never executed: break; | 0 | ||||||
| 135 | } | - | ||||||
| 136 | case executed 1 time by 1 test: PPK_WindowsPageSize:case PPK_WindowsPageSize:Executed by:
executed 1 time by 1 test: case PPK_WindowsPageSize:Executed by:
| 1 | ||||||
| 137 | d->m_pageLayout.setPageSize(QPageSize(QPageSize::id(value.toInt()))); | - | ||||||
| 138 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 139 | case executed 1 time by 1 test: PPK_PaperSource:case PPK_PaperSource:Executed by:
executed 1 time by 1 test: case PPK_PaperSource:Executed by:
| 1 | ||||||
| 140 | d->paperSource = QPrinter::PaperSource(value.toInt()); | - | ||||||
| 141 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 142 | case executed 128 times by 2 tests: PPK_PrinterName:case PPK_PrinterName:Executed by:
executed 128 times by 2 tests: case PPK_PrinterName:Executed by:
| 128 | ||||||
| 143 | d->printerName = value.toString(); | - | ||||||
| 144 | break; executed 128 times by 2 tests: break;Executed by:
| 128 | ||||||
| 145 | case executed 1 time by 1 test: PPK_PrinterProgram:case PPK_PrinterProgram:Executed by:
executed 1 time by 1 test: case PPK_PrinterProgram:Executed by:
| 1 | ||||||
| 146 | d->printProgram = value.toString(); | - | ||||||
| 147 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 148 | case executed 27 times by 1 test: PPK_Resolution:case PPK_Resolution:Executed by:
executed 27 times by 1 test: case PPK_Resolution:Executed by:
| 27 | ||||||
| 149 | d->resolution = value.toInt(); | - | ||||||
| 150 | break; executed 27 times by 1 test: break;Executed by:
| 27 | ||||||
| 151 | case executed 1 time by 1 test: PPK_SelectionOption:case PPK_SelectionOption:Executed by:
executed 1 time by 1 test: case PPK_SelectionOption:Executed by:
| 1 | ||||||
| 152 | d->selectionOption = value.toString(); | - | ||||||
| 153 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 154 | case executed 1 time by 1 test: PPK_FontEmbedding:case PPK_FontEmbedding:Executed by:
executed 1 time by 1 test: case PPK_FontEmbedding:Executed by:
| 1 | ||||||
| 155 | d->embedFonts = value.toBool(); | - | ||||||
| 156 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 157 | case executed 2 times by 1 test: PPK_Duplex:case PPK_Duplex:Executed by:
executed 2 times by 1 test: case PPK_Duplex:Executed by:
| 2 | ||||||
| 158 | d->duplex = static_cast<QPrint::DuplexMode>(value.toInt()); | - | ||||||
| 159 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 160 | case never executed: PPK_CustomPaperSize:case PPK_CustomPaperSize:never executed: case PPK_CustomPaperSize: | 0 | ||||||
| 161 | d->m_pageLayout.setPageSize(QPageSize(value.toSizeF(), QPageSize::Point)); | - | ||||||
| 162 | break; never executed: break; | 0 | ||||||
| 163 | case never executed: PPK_PageMargins:case PPK_PageMargins:never executed: {case PPK_PageMargins: | 0 | ||||||
| 164 | QList<QVariant> margins(value.toList()); | - | ||||||
| 165 | ((!(margins.size() == 4)) ? qt_assert("margins.size() == 4",__FILE__,212) : qt_noop()); | - | ||||||
| 166 | d->m_pageLayout.setUnits(QPageLayout::Point); | - | ||||||
| 167 | d->m_pageLayout.setMargins(QMarginsF(margins.at(0).toReal(), margins.at(1).toReal(), | - | ||||||
| 168 | margins.at(2).toReal(), margins.at(3).toReal())); | - | ||||||
| 169 | break; never executed: break; | 0 | ||||||
| 170 | } | - | ||||||
| 171 | case executed 47 times by 1 test: PPK_QPageSize:case PPK_QPageSize:Executed by:
executed 47 times by 1 test: {case PPK_QPageSize:Executed by:
| 47 | ||||||
| 172 | QPageSize pageSize = value.value<QPageSize>(); | - | ||||||
| 173 | if (pageSize.isValid()
| 0-47 | ||||||
| 174 | d->m_pageLayout.setPageSize(pageSize); executed 47 times by 1 test: d->m_pageLayout.setPageSize(pageSize);Executed by:
| 47 | ||||||
| 175 | break; executed 47 times by 1 test: break;Executed by:
| 47 | ||||||
| 176 | } | - | ||||||
| 177 | case executed 13 times by 1 test: PPK_QPageMargins:case PPK_QPageMargins:Executed by:
executed 13 times by 1 test: {case PPK_QPageMargins:Executed by:
| 13 | ||||||
| 178 | QPair<QMarginsF, QPageLayout::Unit> pair = value.value<QPair<QMarginsF, QPageLayout::Unit> >(); | - | ||||||
| 179 | d->m_pageLayout.setUnits(pair.second); | - | ||||||
| 180 | d->m_pageLayout.setMargins(pair.first); | - | ||||||
| 181 | break; executed 13 times by 1 test: break;Executed by:
| 13 | ||||||
| 182 | } | - | ||||||
| 183 | case never executed: PPK_QPageLayout:case PPK_QPageLayout:never executed: {case PPK_QPageLayout: | 0 | ||||||
| 184 | QPageLayout pageLayout = value.value<QPageLayout>(); | - | ||||||
| 185 | if (pageLayout.isValid()
| 0 | ||||||
| 186 | d->m_pageLayout = pageLayout; never executed: d->m_pageLayout = pageLayout; | 0 | ||||||
| 187 | break; never executed: break; | 0 | ||||||
| 188 | } | - | ||||||
| 189 | - | |||||||
| 190 | } | - | ||||||
| 191 | } executed 336 times by 2 tests: end of blockExecuted by:
| 336 | ||||||
| 192 | - | |||||||
| 193 | QVariant QPdfPrintEngine::property(PrintEnginePropertyKey key) const | - | ||||||
| 194 | { | - | ||||||
| 195 | const QPdfPrintEnginePrivate * const d = d_func(); | - | ||||||
| 196 | - | |||||||
| 197 | QVariant ret; | - | ||||||
| 198 | switch (int(key)) { | - | ||||||
| 199 | - | |||||||
| 200 | - | |||||||
| 201 | - | |||||||
| 202 | case never executed: PPK_CustomBase:case PPK_CustomBase:never executed: case PPK_CustomBase: | 0 | ||||||
| 203 | - | |||||||
| 204 | break; never executed: break; | 0 | ||||||
| 205 | - | |||||||
| 206 | - | |||||||
| 207 | case executed 6 times by 1 test: PPK_CollateCopies:case PPK_CollateCopies:Executed by:
executed 6 times by 1 test: case PPK_CollateCopies:Executed by:
| 6 | ||||||
| 208 | ret = d->collate; | - | ||||||
| 209 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||
| 210 | case executed 6 times by 1 test: PPK_ColorMode:case PPK_ColorMode:Executed by:
executed 6 times by 1 test: case PPK_ColorMode:Executed by:
| 6 | ||||||
| 211 | ret = d->grayscale
| 1-5 | ||||||
| 212 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||
| 213 | case executed 2 times by 1 test: PPK_Creator:case PPK_Creator:Executed by:
executed 2 times by 1 test: case PPK_Creator:Executed by:
| 2 | ||||||
| 214 | ret = d->creator; | - | ||||||
| 215 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 216 | case executed 6 times by 1 test: PPK_DocumentName:case PPK_DocumentName:Executed by:
executed 6 times by 1 test: case PPK_DocumentName:Executed by:
| 6 | ||||||
| 217 | ret = d->title; | - | ||||||
| 218 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||
| 219 | case executed 3 times by 1 test: PPK_FullPage:case PPK_FullPage:Executed by:
executed 3 times by 1 test: case PPK_FullPage:Executed by:
| 3 | ||||||
| 220 | ret = d->m_pageLayout.mode() == QPageLayout::FullPageMode; | - | ||||||
| 221 | break; executed 3 times by 1 test: break;Executed by:
| 3 | ||||||
| 222 | case executed 10 times by 1 test: PPK_CopyCount:case PPK_CopyCount:Executed by:
executed 10 times by 1 test: case PPK_CopyCount:Executed by:
| 10 | ||||||
| 223 | ret = d->copies; | - | ||||||
| 224 | break; executed 10 times by 1 test: break;Executed by:
| 10 | ||||||
| 225 | case executed 1 time by 1 test: PPK_SupportsMultipleCopies:case PPK_SupportsMultipleCopies:Executed by:
executed 1 time by 1 test: case PPK_SupportsMultipleCopies:Executed by:
| 1 | ||||||
| 226 | ret = false; | - | ||||||
| 227 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 228 | case executed 3 times by 1 test: PPK_NumberOfCopies:case PPK_NumberOfCopies:Executed by:
executed 3 times by 1 test: case PPK_NumberOfCopies:Executed by:
| 3 | ||||||
| 229 | ret = d->copies; | - | ||||||
| 230 | break; executed 3 times by 1 test: break;Executed by:
| 3 | ||||||
| 231 | case never executed: PPK_Orientation:case PPK_Orientation:never executed: case PPK_Orientation: | 0 | ||||||
| 232 | ret = d->m_pageLayout.orientation(); | - | ||||||
| 233 | break; never executed: break; | 0 | ||||||
| 234 | case executed 5 times by 1 test: PPK_OutputFileName:case PPK_OutputFileName:Executed by:
executed 5 times by 1 test: case PPK_OutputFileName:Executed by:
| 5 | ||||||
| 235 | ret = d->outputFileName; | - | ||||||
| 236 | break; executed 5 times by 1 test: break;Executed by:
| 5 | ||||||
| 237 | case executed 6 times by 1 test: PPK_PageOrder:case PPK_PageOrder:Executed by:
executed 6 times by 1 test: case PPK_PageOrder:Executed by:
| 6 | ||||||
| 238 | ret = d->pageOrder; | - | ||||||
| 239 | break; executed 6 times by 1 test: break;Executed by:
| 6 | ||||||
| 240 | case never executed: PPK_PageSize:case PPK_PageSize:never executed: case PPK_PageSize: | 0 | ||||||
| 241 | ret = d->m_pageLayout.pageSize().id(); | - | ||||||
| 242 | break; never executed: break; | 0 | ||||||
| 243 | case never executed: PPK_PaperName:case PPK_PaperName:never executed: case PPK_PaperName: | 0 | ||||||
| 244 | ret = d->m_pageLayout.pageSize().name(); | - | ||||||
| 245 | break; never executed: break; | 0 | ||||||
| 246 | case executed 2 times by 1 test: PPK_WindowsPageSize:case PPK_WindowsPageSize:Executed by:
executed 2 times by 1 test: case PPK_WindowsPageSize:Executed by:
| 2 | ||||||
| 247 | ret = d->m_pageLayout.pageSize().windowsId(); | - | ||||||
| 248 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 249 | case executed 2 times by 1 test: PPK_PaperSource:case PPK_PaperSource:Executed by:
executed 2 times by 1 test: case PPK_PaperSource:Executed by:
| 2 | ||||||
| 250 | ret = d->paperSource; | - | ||||||
| 251 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 252 | case executed 15 times by 1 test: PPK_PrinterName:case PPK_PrinterName:Executed by:
executed 15 times by 1 test: case PPK_PrinterName:Executed by:
| 15 | ||||||
| 253 | ret = d->printerName; | - | ||||||
| 254 | break; executed 15 times by 1 test: break;Executed by:
| 15 | ||||||
| 255 | case executed 2 times by 1 test: PPK_PrinterProgram:case PPK_PrinterProgram:Executed by:
executed 2 times by 1 test: case PPK_PrinterProgram:Executed by:
| 2 | ||||||
| 256 | ret = d->printProgram; | - | ||||||
| 257 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 258 | case executed 110 times by 1 test: PPK_Resolution:case PPK_Resolution:Executed by:
executed 110 times by 1 test: case PPK_Resolution:Executed by:
| 110 | ||||||
| 259 | ret = d->resolution; | - | ||||||
| 260 | break; executed 110 times by 1 test: break;Executed by:
| 110 | ||||||
| 261 | case executed 1 time by 1 test: PPK_SupportedResolutions:case PPK_SupportedResolutions:Executed by:
executed 1 time by 1 test: case PPK_SupportedResolutions:Executed by:
| 1 | ||||||
| 262 | ret = QList<QVariant>() << 72; | - | ||||||
| 263 | break; executed 1 time by 1 test: break;Executed by:
| 1 | ||||||
| 264 | case executed 78 times by 1 test: PPK_PaperRect:case PPK_PaperRect:Executed by:
executed 78 times by 1 test: case PPK_PaperRect:Executed by:
| 78 | ||||||
| 265 | ret = d->m_pageLayout.fullRectPixels(d->resolution); | - | ||||||
| 266 | break; executed 78 times by 1 test: break;Executed by:
| 78 | ||||||
| 267 | case executed 24 times by 1 test: PPK_PageRect:case PPK_PageRect:Executed by:
executed 24 times by 1 test: case PPK_PageRect:Executed by:
| 24 | ||||||
| 268 | ret = d->m_pageLayout.paintRectPixels(d->resolution); | - | ||||||
| 269 | break; executed 24 times by 1 test: break;Executed by:
| 24 | ||||||
| 270 | case executed 2 times by 1 test: PPK_SelectionOption:case PPK_SelectionOption:Executed by:
executed 2 times by 1 test: case PPK_SelectionOption:Executed by:
| 2 | ||||||
| 271 | ret = d->selectionOption; | - | ||||||
| 272 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 273 | case executed 2 times by 1 test: PPK_FontEmbedding:case PPK_FontEmbedding:Executed by:
executed 2 times by 1 test: case PPK_FontEmbedding:Executed by:
| 2 | ||||||
| 274 | ret = d->embedFonts; | - | ||||||
| 275 | break; executed 2 times by 1 test: break;Executed by:
| 2 | ||||||
| 276 | case executed 8 times by 1 test: PPK_Duplex:case PPK_Duplex:Executed by:
executed 8 times by 1 test: case PPK_Duplex:Executed by:
| 8 | ||||||
| 277 | ret = d->duplex; | - | ||||||
| 278 | break; executed 8 times by 1 test: break;Executed by:
| 8 | ||||||
| 279 | case never executed: PPK_CustomPaperSize:case PPK_CustomPaperSize:never executed: case PPK_CustomPaperSize: | 0 | ||||||
| 280 | ret = d->m_pageLayout.fullRectPoints().size(); | - | ||||||
| 281 | break; never executed: break; | 0 | ||||||
| 282 | case never executed: PPK_PageMargins:case PPK_PageMargins:never executed: {case PPK_PageMargins: | 0 | ||||||
| 283 | QList<QVariant> list; | - | ||||||
| 284 | QMarginsF margins = d->m_pageLayout.margins(QPageLayout::Point); | - | ||||||
| 285 | list << margins.left() << margins.top() << margins.right() << margins.bottom(); | - | ||||||
| 286 | ret = list; | - | ||||||
| 287 | break; never executed: break; | 0 | ||||||
| 288 | } | - | ||||||
| 289 | case never executed: PPK_QPageSize:case PPK_QPageSize:never executed: case PPK_QPageSize: | 0 | ||||||
| 290 | ret.setValue(d->m_pageLayout.pageSize()); | - | ||||||
| 291 | break; never executed: break; | 0 | ||||||
| 292 | case never executed: PPK_QPageMargins:case PPK_QPageMargins:never executed: {case PPK_QPageMargins: | 0 | ||||||
| 293 | QPair<QMarginsF, QPageLayout::Unit> pair = qMakePair(d->m_pageLayout.margins(), d->m_pageLayout.units()); | - | ||||||
| 294 | ret.setValue(pair); | - | ||||||
| 295 | break; never executed: break; | 0 | ||||||
| 296 | } | - | ||||||
| 297 | case executed 462 times by 1 test: PPK_QPageLayout:case PPK_QPageLayout:Executed by:
executed 462 times by 1 test: case PPK_QPageLayout:Executed by:
| 462 | ||||||
| 298 | ret.setValue(d->m_pageLayout); | - | ||||||
| 299 | break; executed 462 times by 1 test: break;Executed by:
| 462 | ||||||
| 300 | - | |||||||
| 301 | } | - | ||||||
| 302 | return executed 756 times by 1 test: ret;return ret;Executed by:
executed 756 times by 1 test: return ret;Executed by:
| 756 | ||||||
| 303 | } | - | ||||||
| 304 | - | |||||||
| 305 | - | |||||||
| 306 | bool QPdfPrintEnginePrivate::openPrintDevice() | - | ||||||
| 307 | { | - | ||||||
| 308 | if (outDevice
| 0-21 | ||||||
| 309 | return never executed: false;return false;never executed: return false; | 0 | ||||||
| 310 | - | |||||||
| 311 | if (!outputFileName.isEmpty()
| 0-21 | ||||||
| 312 | QFile *file = new QFile(outputFileName); | - | ||||||
| 313 | if (! file->open(QFile::WriteOnly|QFile::Truncate)
| 1-20 | ||||||
| 314 | delete file; | - | ||||||
| 315 | return executed 1 time by 1 test: false;return false;Executed by:
executed 1 time by 1 test: return false;Executed by:
| 1 | ||||||
| 316 | } | - | ||||||
| 317 | outDevice = file; | - | ||||||
| 318 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||
| 319 | - | |||||||
| 320 | return executed 20 times by 1 test: true;return true;Executed by:
executed 20 times by 1 test: return true;Executed by:
| 20 | ||||||
| 321 | } | - | ||||||
| 322 | - | |||||||
| 323 | void QPdfPrintEnginePrivate::closePrintDevice() | - | ||||||
| 324 | { | - | ||||||
| 325 | if (outDevice
| 0-20 | ||||||
| 326 | outDevice->close(); | - | ||||||
| 327 | if (fd >= 0
| 0-20 | ||||||
| 328 | - | |||||||
| 329 | - | |||||||
| 330 | - | |||||||
| 331 | :: never executed: close(fd);::close(fd);never executed: ::close(fd); | 0 | ||||||
| 332 | - | |||||||
| 333 | fd = -1; | - | ||||||
| 334 | delete outDevice; | - | ||||||
| 335 | outDevice = 0; | - | ||||||
| 336 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||
| 337 | } executed 20 times by 1 test: end of blockExecuted by:
| 20 | ||||||
| 338 | - | |||||||
| 339 | - | |||||||
| 340 | - | |||||||
| 341 | QPdfPrintEnginePrivate::QPdfPrintEnginePrivate(QPrinter::PrinterMode m) | - | ||||||
| 342 | : QPdfEnginePrivate(), | - | ||||||
| 343 | duplex(QPrint::DuplexNone), | - | ||||||
| 344 | collate(true), | - | ||||||
| 345 | copies(1), | - | ||||||
| 346 | pageOrder(QPrinter::FirstPageFirst), | - | ||||||
| 347 | paperSource(QPrinter::Auto), | - | ||||||
| 348 | fd(-1) | - | ||||||
| 349 | { | - | ||||||
| 350 | resolution = 72; | - | ||||||
| 351 | if (m == QPrinter::HighResolution
| 32-96 | ||||||
| 352 | resolution = 1200; executed 32 times by 1 test: resolution = 1200;Executed by:
| 32 | ||||||
| 353 | else if (m == QPrinter::ScreenResolution
| 4-92 | ||||||
| 354 | resolution = qt_defaultDpi(); executed 92 times by 2 tests: resolution = qt_defaultDpi();Executed by:
| 92 | ||||||
| 355 | } executed 128 times by 2 tests: end of blockExecuted by:
| 128 | ||||||
| 356 | - | |||||||
| 357 | QPdfPrintEnginePrivate::~QPdfPrintEnginePrivate() | - | ||||||
| 358 | { | - | ||||||
| 359 | } | - | ||||||
| 360 | - | |||||||
| 361 | - | |||||||
| Switch to Source code | Preprocessed file |