summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Merila <sami.merila@nokia.com>2011-06-01 13:15:13 (GMT)
committerSami Merila <sami.merila@nokia.com>2011-06-01 13:15:13 (GMT)
commit887b19ce9313d09eb996e765c18fa19a09a5cf95 (patch)
tree94ca81f0f643851ab7e10b00fa7c0b8df053b005
parent5019387992e132049b38bee047eb7bc7ff163e15 (diff)
downloadQt-887b19ce9313d09eb996e765c18fa19a09a5cf95.zip
Qt-887b19ce9313d09eb996e765c18fa19a09a5cf95.tar.gz
Qt-887b19ce9313d09eb996e765c18fa19a09a5cf95.tar.bz2
Fix QTreeWidget autotest cases on Symbian/VGA
Make two autotest cases pass on Symbian/VGA devices. Task-number: QT-5057 Reviewed-by: Miikka Heikkinen
-rw-r--r--tests/auto/qtreewidget/tst_qtreewidget.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp
index dc878c4..7d2cdfb 100644
--- a/tests/auto/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp
@@ -50,6 +50,8 @@
#include <qlineedit.h>
#include <QScrollBar>
#include <QStyledItemDelegate>
+#include <QDesktopWidget>
+#include <QApplication>
#include "../../shared/util.h"
@@ -3102,10 +3104,21 @@ void tst_QTreeWidget::task206367_duplication()
QWidget topLevel;
QTreeWidget treeWidget(&topLevel);
topLevel.show();
+#ifndef Q_WS_S60
treeWidget.resize(200, 200);
+#endif
treeWidget.setSortingEnabled(true);
QTreeWidgetItem* rootItem = new QTreeWidgetItem( &treeWidget, QStringList("root") );
+#ifdef Q_WS_S60
+ // Ensure that eight items fit into tree widget. In Symbian VGA devices 8 rows of
+ // data will take more than 200 pixels.
+ int calculatedHeight = treeWidget.visualItemRect(treeWidget.topLevelItem(0)).height() +
+ 2 * QApplication::style()->pixelMetric(QStyle::PM_DefaultFrameWidth, 0, 0);
+ calculatedHeight *= 8; // eight 'rows': header, root and 2 items with 2 children
+ treeWidget.resize(200, qMax(200, calculatedHeight));
+#endif
+
for (int nFile = 0; nFile < 2; nFile++ ) {
QTreeWidgetItem* itemFile = new QTreeWidgetItem(rootItem, QStringList(QString::number(nFile)));
for (int nRecord = 0; nRecord < 2; nRecord++)
@@ -3211,6 +3224,13 @@ void tst_QTreeWidget::task239150_editorWidth()
{
//we check that an item with no text will get an editor with a correct size
QTreeWidget tree;
+#ifdef Q_OS_SYMBIAN
+ //By default widgets are 640*360 in Symbian. Call to create_sys() sets the real size of the widget.
+ //Therefore, with VGA Symbian devices, we need to update the widget width to match screen width.
+ //As VGA devices have larger font, longer texts wouldn't otherwise fit into tree widget.
+ if (QApplication::desktop() && QApplication::desktop()->availableGeometry().width() > tree.width())
+ tree.resize(QApplication::desktop()->availableGeometry().size());
+#endif
QStyleOptionFrameV2 opt;
opt.init(&tree);