summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-12 19:21:35 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-12 19:21:35 (GMT)
commit7a45927166ae9d29e7f440b255f3463d5350c220 (patch)
tree1a4d1e4a0405280af999f59c15ba8e8cc9f87ab0 /tests/auto
parente9a0067ef4b272f1893522959dc15561970590ea (diff)
parent8576aa104528f9a2863fd097abc8bac5c956fdb8 (diff)
downloadQt-7a45927166ae9d29e7f440b255f3463d5350c220.zip
Qt-7a45927166ae9d29e7f440b255f3463d5350c220.tar.gz
Qt-7a45927166ae9d29e7f440b255f3463d5350c220.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (44 commits) QSlider and StyleSheet: fix one pixel error while drawing the SliderAddPage accelerate QWindowsPipeWriter for bigger chunks of data Fix antialiasing with transformed text in OpenGL2 paint engine Fix flattening of largely scaled, thin, dashed beziers. Increased the precision used to flatten beziers Fix QT_NO_MOVIE Fix compile error with QT_NO_ACTION in QtGui Fix QT_NO_COMPLETER Fix QT_NO_FSCOMPLETER Fix QT_NO_FILESYSTEMMODEL Build fix Safeguard ourselves against corrupt registry values for cleartype gamma fix cetest build properly qdrawhelper: optimize the fetch transformed bilinear functions Compile fix for WinCE Make sure the selectionChanged signal is not called too much Implement heightForWidth support for QTabWidget and QStackedLayout. Fix the doc for QFrame::frameStyle Don't use texture-from-pixmap if the target isn't GL_TEXTURE_2D Add runtime check for GLX >= 1.3 before using glXCreatePixmap ...
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp12
-rw-r--r--tests/auto/qpathclipper/tst_qpathclipper.cpp29
-rw-r--r--tests/auto/qtabwidget/tst_qtabwidget.cpp47
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp32
4 files changed, 120 insertions, 0 deletions
diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
index bf4ea5f..195f8b6 100644
--- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
+++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp
@@ -721,11 +721,13 @@ void tst_QDialogButtonBox::testDefaultButton_data()
static int softKeyCount(QWidget *widget)
{
int softkeyCount = 0;
+#ifndef QT_NO_ACTION
QList<QAction *> actions = widget->actions();
foreach (QAction *action, actions) {
if (action->softKeyRole() != QAction::NoSoftKey)
softkeyCount++;
}
+#endif
return softkeyCount;
}
@@ -737,14 +739,18 @@ void tst_QDialogButtonBox::testS60SoftKeys()
buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
dialog.show();
+#ifndef QT_NO_ACTION
QCOMPARE( softKeyCount(&dialog), 2);
+#endif
QDialog dialog2(0);
QDialogButtonBox buttonBox2(&dialog2);
buttonBox2.setStandardButtons(QDialogButtonBox::Cancel);
dialog2.show();
+#ifndef QT_NO_ACTION
QCOMPARE( softKeyCount(&dialog2), 1);
+#endif
#else
QSKIP("S60-specific test", SkipAll );
@@ -759,21 +765,27 @@ void tst_QDialogButtonBox::testSoftKeyReparenting()
buttonBox->addButton(QDialogButtonBox::Ok);
buttonBox->addButton(QDialogButtonBox::Cancel);
+#ifndef QT_NO_ACTION
QCOMPARE(softKeyCount(&dialog), 0);
QCOMPARE(softKeyCount(buttonBox), 2);
+#endif
// Were the softkeys re-parented correctly?
dialog.setLayout(new QVBoxLayout);
dialog.layout()->addWidget(buttonBox);
+#ifndef QT_NO_ACTION
QCOMPARE(softKeyCount(&dialog), 2);
QCOMPARE(softKeyCount(buttonBox), 0);
+#endif
// Softkeys are only added to QDialog, not QWidget
QWidget *nested = new QWidget;
nested->setLayout(new QVBoxLayout);
nested->layout()->addWidget(buttonBox);
+#ifndef QT_NO_ACTION
QCOMPARE(softKeyCount(nested), 0);
QCOMPARE(softKeyCount(buttonBox), 2);
+#endif
}
#endif
diff --git a/tests/auto/qpathclipper/tst_qpathclipper.cpp b/tests/auto/qpathclipper/tst_qpathclipper.cpp
index 38d253a..db5a13e 100644
--- a/tests/auto/qpathclipper/tst_qpathclipper.cpp
+++ b/tests/auto/qpathclipper/tst_qpathclipper.cpp
@@ -95,6 +95,8 @@ private slots:
void task209056();
void task251909();
+
+ void qtbug3778();
};
Q_DECLARE_METATYPE(QPainterPath)
@@ -1346,6 +1348,33 @@ void tst_QPathClipper::task251909()
QVERIFY(result.elementCount() <= 5);
}
+void tst_QPathClipper::qtbug3778()
+{
+ QPainterPath path1;
+ path1.moveTo(200, 3.22409e-5);
+ // e-5 and higher leads to a bug
+ // Using 3.22409e-4 starts to work correctly
+ path1.lineTo(0, 0);
+ path1.lineTo(1.07025e-13, 1450);
+ path1.lineTo(750, 950);
+ path1.lineTo(950, 750);
+ path1.lineTo(200, 3.22409e-13);
+
+ QPainterPath path2;
+ path2.moveTo(0, 0);
+ path2.lineTo(200, 800);
+ path2.lineTo(600, 1500);
+ path2.lineTo(1500, 1400);
+ path2.lineTo(1900, 1200);
+ path2.lineTo(2000, 1000);
+ path2.lineTo(1400, 0);
+ path2.lineTo(0, 0);
+
+ QPainterPath p12 = path1.intersected(path2);
+
+ QVERIFY(p12.contains(QPointF(100, 100)));
+}
+
QTEST_APPLESS_MAIN(tst_QPathClipper)
diff --git a/tests/auto/qtabwidget/tst_qtabwidget.cpp b/tests/auto/qtabwidget/tst_qtabwidget.cpp
index 4491fb3..204c27a 100644
--- a/tests/auto/qtabwidget/tst_qtabwidget.cpp
+++ b/tests/auto/qtabwidget/tst_qtabwidget.cpp
@@ -45,6 +45,7 @@
#include <qdebug.h>
#include <qapplication.h>
#include <qlabel.h>
+#include <qboxlayout.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -120,6 +121,8 @@ class tst_QTabWidget:public QObject {
void clear();
void keyboardNavigation();
void paintEventCount();
+ void heightForWidth();
+ void heightForWidth_data();
private:
int addPage();
@@ -621,6 +624,50 @@ void tst_QTabWidget::paintEventCount()
QCOMPARE(tab2->count, 1);
}
+void tst_QTabWidget::heightForWidth_data()
+{
+ QTest::addColumn<int>("tabPosition");
+ QTest::newRow("West") << int(QTabWidget::West);
+ QTest::newRow("North") << int(QTabWidget::North);
+ QTest::newRow("East") << int(QTabWidget::East);
+ QTest::newRow("South") << int(QTabWidget::South);
+}
+
+void tst_QTabWidget::heightForWidth()
+{
+ QFETCH(int, tabPosition);
+
+ QWidget *window = new QWidget;
+ QVBoxLayout *lay = new QVBoxLayout(window);
+ lay->setMargin(0);
+ lay->setSpacing(0);
+ QTabWidget *tabWid = new QTabWidget(window);
+ QWidget *w = new QWidget;
+ tabWid->addTab(w, QLatin1String("HFW page"));
+ tabWid->setTabPosition(QTabWidget::TabPosition(tabPosition));
+ QVBoxLayout *lay2 = new QVBoxLayout(w);
+ QLabel *label = new QLabel("Label with wordwrap turned on makes it trade height for width."
+ " Make it a really long text so that it spans on several lines"
+ " when the label is on its narrowest."
+ " I don't like to repeat myself."
+ " I don't like to repeat myself."
+ " I don't like to repeat myself."
+ " I don't like to repeat myself."
+ );
+ label->setWordWrap(true);
+ lay2->addWidget(label);
+ lay2->setMargin(0);
+
+ lay->addWidget(tabWid);
+ int h = window->heightForWidth(160);
+ window->resize(160, h);
+ window->show();
+
+ QTest::qWaitForWindowShown(window);
+ QVERIFY(label->height() >= label->heightForWidth(label->width()));
+
+ delete window;
+}
QTEST_MAIN(tst_QTabWidget)
#include "tst_qtabwidget.moc"
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index 2de189d..75a4c62 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -215,6 +215,7 @@ private slots:
void addRowsWhileSectionsAreHidden();
void filterProxyModelCrash();
void styleOptionViewItem();
+ void keyboardNavigationWithDisabled();
// task-specific tests:
void task174627_moveLeftToRoot();
@@ -3753,5 +3754,36 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint()
QTRY_VERIFY(view.painted > 0);
}
+void tst_QTreeView::keyboardNavigationWithDisabled()
+{
+ QTreeView view;
+ QStandardItemModel model(90, 0);
+ for (int i = 0; i < 90; i ++) {
+ model.setItem(i, new QStandardItem(QString::number(i)));
+ model.item(i)->setEnabled(i%6 == 0);
+ }
+ view.setModel(&model);
+
+ view.resize(200, view.visualRect(model.index(0,0)).height()*10);
+ view.show();
+ QApplication::setActiveWindow(&view);
+ QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(view.isActiveWindow());
+
+ view.setCurrentIndex(model.index(1, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Up);
+ QCOMPARE(view.currentIndex(), model.index(0, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Down);
+ QCOMPARE(view.currentIndex(), model.index(6, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_PageDown);
+ QCOMPARE(view.currentIndex(), model.index(18, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Down);
+ QCOMPARE(view.currentIndex(), model.index(24, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_PageUp);
+ QCOMPARE(view.currentIndex(), model.index(12, 0));
+ QTest::keyClick(view.viewport(), Qt::Key_Up);
+ QCOMPARE(view.currentIndex(), model.index(6, 0));
+}
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"