32 #include <private/qstylehelper_p.h>
37 static const ControlType E = QSizePolicy::E;
54 tst_QMacStyle() { qRegisterMetaType<QStyleHelper::WidgetSizePolicy>(
"WidgetSizePolicy"); }
57 void sizeHints_data();
59 void layoutMargins_data();
61 void layoutSpacings_data();
62 void layoutSpacings();
63 void smallMiniNormalExclusivity_data();
64 void smallMiniNormalExclusivity();
65 void passwordCharacter();
74 static int hgap(
QWidget *widget1,
QWidget *widget2) {
return gap(widget1, widget2).width(); }
75 static int vgap(
QWidget *widget1,
QWidget *widget2) {
return gap(widget1, widget2).height(); }
83 #define SIZE(x, y, z) \
84 ((size == QStyleHelper::SizeLarge) ? (x) : (size == QStyleHelper::SizeSmall) ? (y) : (z))
86 static bool bigSurOrAbove() {
90 void tst_QMacStyle::sizeHints_data()
92 QTest::addColumn<QStyleHelper::WidgetSizePolicy>(
"size");
98 void tst_QMacStyle::sizeHints()
109 qDebug() <<
"sh" << progress1.sizeHint();
122 comboBox1.setEditable(
false);
123 comboBox1.addItem(
"Foo");
127 comboBox2.setEditable(
true);
128 comboBox2.addItem(
"Foo");
136 comboBox3.addItem(
"Foo");
165 cancel1.setAutoDefault(
false);
167 cancel1.setAutoDefault(
true);
169 cancel1.setDefault(
true);
209 void tst_QMacStyle::layoutMargins_data()
211 tst_QMacStyle::sizeHints_data();
214 void tst_QMacStyle::layoutMargins()
222 void tst_QMacStyle::layoutSpacings_data()
224 tst_QMacStyle::sizeHints_data();
227 void tst_QMacStyle::layoutSpacings()
235 for (
int i = 0;
i < 4; ++
i) {
276 return item.sizeHint();
282 return item.sizeHint();
288 return item.geometry();
293 QPoint d = pos(widget2) - pos(widget1);
343 void tst_QMacStyle::smallMiniNormalExclusivity_data()
346 QTest::addColumn<int>(
"size1");
347 QTest::addColumn<int>(
"size2");
348 QTest::addColumn<int>(
"size3");
349 QTest::addColumn<int>(
"expectedHeight1");
350 QTest::addColumn<int>(
"expectedHeight2");
351 QTest::addColumn<int>(
"expectedHeight3");
361 void tst_QMacStyle::smallMiniNormalExclusivity()
367 QFETCH(
int, expectedHeight1);
368 QFETCH(
int, expectedHeight2);
369 QFETCH(
int, expectedHeight3);
371 static const int TotalSizes = 3;
372 int attrs[TotalSizes] = { size1, size2, size3 };
373 int expected[TotalSizes] = { expectedHeight1, expectedHeight2, expectedHeight3 };
378 for (
int i = 0;
i < TotalSizes; ++
i) {
382 QSize(0, 0), &dummyWidget);
383 if (
size.height() != expected[
i])
389 void tst_QMacStyle::passwordCharacter()
395 const QChar bullet(0x2022);
396 const QString expected(1, bullet);
401 #include "tst_qmacstyle.moc"
small capitals from c petite p scientific i
[1]
The QChar class provides a 16-bit Unicode character.
The QCheckBox widget provides a checkbox with a text label.
The QComboBox widget is a combined button and popup list.
The QDialog class is the base class of dialog windows.
The QLabel widget provides a text or image display.
The QLineEdit widget is a one-line text editor.
QString displayText
the displayed text.
void setEchoMode(EchoMode)
The QMessageBox class provides a modal dialog for informing the user or for asking the user a questio...
The QObject class is the base class of all Qt objects.
static QOperatingSystemVersion current()
[0]
static constexpr QOperatingSystemVersionBase MacOSBigSur
a version corresponding to macOS Big Sur
The QPoint class defines a point in the plane using integer precision.
The QProgressBar widget provides a horizontal or vertical progress bar.
The QRect class defines a rectangle in the plane using integer precision.
The QSize class defines the size of a two-dimensional object using integer point precision.
The QSlider widget provides a vertical or horizontal slider.
The QString class provides a Unicode character string.
virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w=nullptr) const =0
virtual int layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
The QStyleOption class stores the parameters used by QStyle functions.
void initFrom(const QWidget *w)
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
#define QTEST_MAIN(TestObject)
#define QFETCH(Type, name)
#define QEXPECT_FAIL(dataIndex, comment, mode)
#define QVERIFY(statement)
QSizePolicy::ControlType ControlType
Q_DECLARE_METATYPE(QStyleHelper::WidgetSizePolicy)