summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qsizef/tst_qsizef.cpp')
-rw-r--r--tests/auto/corelib/tools/qsizef/tst_qsizef.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp
index af45c3c91f..3a65506dee 100644
--- a/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp
+++ b/tests/auto/corelib/tools/qsizef/tst_qsizef.cpp
@@ -51,6 +51,8 @@ private slots:
void transpose_data();
void transpose();
+
+ void structuredBinding();
};
void tst_QSizeF::isNull_data()
@@ -214,5 +216,26 @@ void tst_QSizeF::transpose() {
QCOMPARE(input1 , expected);
}
+void tst_QSizeF::structuredBinding()
+{
+ {
+ QSizeF size(10.0, 20.0);
+ auto [width, height] = size;
+ QCOMPARE(width, 10.0);
+ QCOMPARE(height, 20.0);
+ }
+ {
+ QSizeF size(30.0, 40.0);
+ auto &[width, height] = size;
+ QCOMPARE(width, 30.0);
+ QCOMPARE(height, 40.0);
+
+ width = 100.0;
+ height = 200.0;
+ QCOMPARE(size.width(), 100.0);
+ QCOMPARE(size.height(), 200.0);
+ }
+}
+
QTEST_APPLESS_MAIN(tst_QSizeF)
#include "tst_qsizef.moc"