qsize.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/corelib/tools/qsize.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4void QSize::transpose() noexcept-
5{-
6 int tmp = wd;qSwap(wd= ht;, ht= tmp;);-
7}
executed 3 times by 1 test: end of block
Executed by:
  • tst_QSize
3
8QSize QSize::scaled(const QSize &s, Qt::AspectRatioMode mode) const noexcept-
9{-
10 if (mode == Qt::IgnoreAspectRatio
mode == Qt::IgnoreAspectRatioDescription
TRUEevaluated 596 times by 16 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
FALSEevaluated 5586 times by 18 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QPixmap
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
|| wd == 0
wd == 0Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSize
FALSEevaluated 5584 times by 18 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QPixmap
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
|| ht == 0
ht == 0Description
TRUEnever evaluated
FALSEevaluated 5584 times by 18 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QPixmap
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
) {
0-5586
11 return
executed 598 times by 16 tests: return s;
Executed by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
s;
executed 598 times by 16 tests: return s;
Executed by:
  • tst_QAccessibility
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QImageReader
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_QTreeWidget
  • tst_languageChange
598
12 } else {-
13 bool useHeight;-
14 qint64 rw = qint64(s.ht) * qint64(wd) / qint64(ht);-
15-
16 if (mode == Qt::KeepAspectRatio
mode == Qt::KeepAspectRatioDescription
TRUEevaluated 5582 times by 18 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QPixmap
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSize
) {
2-5582
17 useHeight = (rw <= s.wd);-
18 }
executed 5582 times by 18 tests: end of block
Executed by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QImage
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QPixmap
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
else {
5582
19 useHeight = (rw >= s.wd);-
20 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QSize
2
21-
22 if (useHeight
useHeightDescription
TRUEevaluated 5546 times by 16 tests
Evaluated by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
FALSEevaluated 38 times by 4 tests
Evaluated by:
  • tst_QIcon
  • tst_QImage
  • tst_QPixmap
  • tst_QSize
) {
38-5546
23 return
executed 5546 times by 16 tests: return QSize(rw, s.ht);
Executed by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
QSize(rw, s.ht);
executed 5546 times by 16 tests: return QSize(rw, s.ht);
Executed by:
  • tst_QAccessibility
  • tst_QCompleter
  • tst_QFileDialog2
  • tst_QFiledialog
  • tst_QGraphicsProxyWidget
  • tst_QIcoImageFormat
  • tst_QIcon
  • tst_QItemDelegate
  • tst_QLineEdit
  • tst_QMdiArea
  • tst_QMdiSubWindow
  • tst_QSidebar
  • tst_QSize
  • tst_QSystemTrayIcon
  • tst_QTreeView
  • tst_languageChange
5546
24 } else {-
25 return
executed 38 times by 4 tests: return QSize(s.wd, qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));
Executed by:
  • tst_QIcon
  • tst_QImage
  • tst_QPixmap
  • tst_QSize
QSize(s.wd,
executed 38 times by 4 tests: return QSize(s.wd, qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));
Executed by:
  • tst_QIcon
  • tst_QImage
  • tst_QPixmap
  • tst_QSize
38
26 qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));
executed 38 times by 4 tests: return QSize(s.wd, qint32(qint64(s.wd) * qint64(ht) / qint64(wd)));
Executed by:
  • tst_QIcon
  • tst_QImage
  • tst_QPixmap
  • tst_QSize
38
27 }-
28 }-
29}-
30QDataStream &operator<<(QDataStream &s, const QSize &sz)-
31{-
32 if (s.version() == 1)-
33 s << (qint16)sz.width() << (qint16)sz.height();-
34 else-
35 s << (qint32)sz.width() << (qint32)sz.height();-
36 return s;-
37}-
38QDataStream &operator>>(QDataStream &s, QSize &sz)-
39{-
40 if (s.version() == 1) {-
41 qint16 w, h;-
42 s >> w; sz.rwidth() = w;-
43 s >> h; sz.rheight() = h;-
44 }-
45 else {-
46 qint32 w, h;-
47 s >> w; sz.rwidth() = w;-
48 s >> h; sz.rheight() = h;-
49 }-
50 return s;-
51}-
52-
53-
54-
55QDebug operator<<(QDebug dbg, const QSize &s)-
56{-
57 QDebugStateSaver saver(dbg);-
58 dbg.nospace();-
59 dbg << "QSize(";-
60 QtDebugUtils::formatQSize(dbg, s);-
61 dbg << ')';-
62 return dbg;-
63}-
64void QSizeF::transpose() noexcept-
65{-
66 qreal tmp = wd;qSwap(wd= ht;, ht= tmp;);-
67}
executed 6 times by 2 tests: end of block
Executed by:
  • tst_QGraphicsLinearLayout
  • tst_QSizeF
6
68QSizeF QSizeF::scaled(const QSizeF &s, Qt::AspectRatioMode mode) const noexcept-
69{-
70 if (mode == Qt::IgnoreAspectRatio
mode == Qt::IgnoreAspectRatioDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSizeF
FALSEevaluated 6 times by 1 test
Evaluated by:
  • tst_QSizeF
|| qIsNull(wd)
qIsNull(wd)Description
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSizeF
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QSizeF
|| qIsNull(ht)
qIsNull(ht)Description
TRUEnever evaluated
FALSEevaluated 4 times by 1 test
Evaluated by:
  • tst_QSizeF
) {
0-6
71 return
executed 4 times by 1 test: return s;
Executed by:
  • tst_QSizeF
s;
executed 4 times by 1 test: return s;
Executed by:
  • tst_QSizeF
4
72 } else {-
73 bool useHeight;-
74 qreal rw = s.ht * wd / ht;-
75-
76 if (mode == Qt::KeepAspectRatio
mode == Qt::KeepAspectRatioDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSizeF
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSizeF
) {
2
77 useHeight = (rw <= s.wd);-
78 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QSizeF
else {
2
79 useHeight = (rw >= s.wd);-
80 }
executed 2 times by 1 test: end of block
Executed by:
  • tst_QSizeF
2
81-
82 if (useHeight
useHeightDescription
TRUEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSizeF
FALSEevaluated 2 times by 1 test
Evaluated by:
  • tst_QSizeF
) {
2
83 return
executed 2 times by 1 test: return QSizeF(rw, s.ht);
Executed by:
  • tst_QSizeF
QSizeF(rw, s.ht);
executed 2 times by 1 test: return QSizeF(rw, s.ht);
Executed by:
  • tst_QSizeF
2
84 } else {-
85 return
executed 2 times by 1 test: return QSizeF(s.wd, s.wd * ht / wd);
Executed by:
  • tst_QSizeF
QSizeF(s.wd, s.wd * ht / wd);
executed 2 times by 1 test: return QSizeF(s.wd, s.wd * ht / wd);
Executed by:
  • tst_QSizeF
2
86 }-
87 }-
88}-
89QDataStream &operator<<(QDataStream &s, const QSizeF &sz)-
90{-
91 s << double(sz.width()) << double(sz.height());-
92 return s;-
93}-
94QDataStream &operator>>(QDataStream &s, QSizeF &sz)-
95{-
96 double w, h;-
97 s >> w;-
98 s >> h;-
99 sz.setWidth(qreal(w));-
100 sz.setHeight(qreal(h));-
101 return s;-
102}-
103-
104-
105-
106QDebug operator<<(QDebug dbg, const QSizeF &s)-
107{-
108 QDebugStateSaver saver(dbg);-
109 dbg.nospace();-
110 dbg << "QSizeF(";-
111 QtDebugUtils::formatQSize(dbg, s);-
112 dbg << ')';-
113 return dbg;-
114}-
115-
116-
117-
Switch to Source codePreprocessed file

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