summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcombobox
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2009-08-27 17:17:12 +0200
committerThiago Macieira <thiago.macieira@nokia.com>2009-08-27 17:17:12 +0200
commit8c755acd7549a1de53acb9d93e9a44e333be2b5b (patch)
tree7a1e1f5af9b7796ec0719bf0b5e3baf81b393bab /tests/auto/qcombobox
parentd0cdddb61c46a5d27fe0e4fae176964c2009e971 (diff)
parentebf69d862ad816bf9b00e27adc2b6f0d74331338 (diff)
Merge branch '4.5' into 4.6
Conflicts: tests/auto/linguist/lupdate/testdata/good/backslashes/project.ts.result tests/auto/linguist/lupdate/testdata/good/lacksqobject/expectedoutput.txt tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/finddialog.cpp tests/auto/linguist/lupdate/testdata/good/mergecpp_noobsolete/project.ts.result tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/finddialog.cpp tests/auto/linguist/lupdate/testdata/good/mergecpp_obsolete/project.ts.result tests/auto/linguist/lupdate/testdata/good/parsecpp/finddialog.cpp tests/auto/qcombobox/tst_qcombobox.cpp tests/auto/xmlpatternsview/view/FunctionSignaturesView.cpp tests/auto/xmlpatternsview/view/MainWindow.cpp tests/auto/xmlpatternsview/view/TestCaseView.cpp tests/auto/xmlpatternsview/view/TestResultView.cpp tests/auto/xmlpatternsview/view/TreeSortFilter.cpp tests/auto/xmlpatternsview/view/UserTestCase.cpp tests/auto/xmlpatternsview/view/XDTItemItem.cpp tests/auto/xmlpatternsview/view/main.cpp tests/auto/xmlpatternsxqts/lib/ASTItem.h tests/auto/xmlpatternsxqts/lib/DebugExpressionFactory.h tests/auto/xmlpatternsxqts/lib/ExpressionNamer.h tests/auto/xmlpatternsxqts/lib/ExternalSourceLoader.h tests/auto/xmlpatternsxqts/lib/Global.h tests/auto/xmlpatternsxqts/lib/ResultThreader.h tests/auto/xmlpatternsxqts/lib/TestBaseLine.h tests/auto/xmlpatternsxqts/lib/TestCase.h tests/auto/xmlpatternsxqts/lib/TestResult.h tests/auto/xmlpatternsxqts/lib/TestResultHandler.h tests/auto/xmlpatternsxqts/lib/TestSuiteHandler.h tests/auto/xmlpatternsxqts/lib/Worker.h tests/auto/xmlpatternsxqts/lib/XMLWriter.h tests/auto/xmlpatternsxqts/lib/XQTSTestCase.h
Diffstat (limited to 'tests/auto/qcombobox')
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index b568c602c9..dac32bb103 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -145,6 +145,8 @@ private slots:
void noScrollbar();
void setItemDelegate();
void task253944_itemDelegateIsReset();
+ void subControlRectsWithOffset_data();
+ void subControlRectsWithOffset();
protected slots:
void onEditTextChanged( const QString &newString );
@@ -2289,5 +2291,53 @@ void tst_QComboBox::task253944_itemDelegateIsReset()
}
+void tst_QComboBox::subControlRectsWithOffset_data()
+{
+ QTest::addColumn<bool>("editable");
+
+ QTest::newRow("editable = true") << true;
+ QTest::newRow("editable = false") << false;
+}
+
+void tst_QComboBox::subControlRectsWithOffset()
+{
+ // The sub control rect relative position should not depends
+ // on the position of the combobox
+
+ class FriendlyCombo : public QComboBox {
+ public:
+ void styleOption(QStyleOptionComboBox *optCombo) {
+ initStyleOption(optCombo);
+ }
+ } combo;
+ QStyleOptionComboBox optCombo;
+ combo.styleOption(&optCombo);
+
+
+ const QRect rectAtOrigin(0, 0, 80, 30);
+ const QPoint offset(25, 50);
+ const QRect rectWithOffset = rectAtOrigin.translated(offset);
+
+ QStyle *style = combo.style();
+
+ QFETCH(bool, editable);
+ optCombo.editable = editable;
+
+ optCombo.rect = rectAtOrigin;
+ QRect editFieldRect = style->subControlRect(QStyle::CC_ComboBox, &optCombo, QStyle::SC_ComboBoxEditField, 0);
+ QRect arrowRect = style->subControlRect(QStyle::CC_ComboBox, &optCombo, QStyle::SC_ComboBoxArrow, 0);
+ QRect listboxRect = style->subControlRect(QStyle::CC_ComboBox, &optCombo, QStyle::SC_ComboBoxListBoxPopup, 0);
+
+ optCombo.rect = rectWithOffset;
+ QRect editFieldRectWithOffset = style->subControlRect(QStyle::CC_ComboBox, &optCombo, QStyle::SC_ComboBoxEditField, 0);
+ QRect arrowRectWithOffset = style->subControlRect(QStyle::CC_ComboBox, &optCombo, QStyle::SC_ComboBoxArrow, 0);
+ QRect listboxRectWithOffset = style->subControlRect(QStyle::CC_ComboBox, &optCombo, QStyle::SC_ComboBoxListBoxPopup, 0);
+
+ QCOMPARE(editFieldRect, editFieldRectWithOffset.translated(-offset));
+ QCOMPARE(arrowRect, arrowRectWithOffset.translated(-offset));
+ QCOMPARE(listboxRect, listboxRectWithOffset.translated(-offset));
+
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"