summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-04-23 09:02:14 (GMT)
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-04-23 09:02:14 (GMT)
commit429f29a305559313f92866ac19cf224ad1497b33 (patch)
tree8f8cc1dd5f6485d3282eec52c83a9fbeb71dd29e /tests
parent33afa6c1fbe230dec4eea435f9ad5d4141c128a8 (diff)
parentbe3916b7e4e8007394cbed40484ef6b696e90f2b (diff)
downloadQt-429f29a305559313f92866ac19cf224ad1497b33.zip
Qt-429f29a305559313f92866ac19cf224ad1497b33.tar.gz
Qt-429f29a305559313f92866ac19cf224ad1497b33.tar.bz2
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/qt into windows-7-multitouch
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qaction/tst_qaction.cpp33
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp116
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp41
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp77
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp64
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp79
-rw-r--r--tests/auto/qimagereader/baseline/35floppy.icobin0 -> 4286 bytes
-rw-r--r--tests/auto/qimagereader/baseline/kde_favicon.icobin0 -> 1150 bytes
-rw-r--r--tests/auto/qimagereader/baseline/semitransparent.icobin0 -> 9662 bytes
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp30
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp3
-rw-r--r--tests/auto/qprocess/testProcessEnvironment/main.cpp34
-rw-r--r--tests/auto/qshortcut/tst_qshortcut.cpp7
-rw-r--r--tests/auto/qsidebar/tst_qsidebar.cpp26
-rw-r--r--tests/auto/qtransform/tst_qtransform.cpp10
-rw-r--r--tests/auto/selftests/xunit/tst_xunit.cpp34
16 files changed, 550 insertions, 4 deletions
diff --git a/tests/auto/qaction/tst_qaction.cpp b/tests/auto/qaction/tst_qaction.cpp
index 1ec21f2..1b73f06 100644
--- a/tests/auto/qaction/tst_qaction.cpp
+++ b/tests/auto/qaction/tst_qaction.cpp
@@ -46,6 +46,7 @@
#include <qevent.h>
#include <qaction.h>
#include <qmenu.h>
+#include <qlineedit.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -74,6 +75,7 @@ private slots:
void setStandardKeys();
void alternateShortcuts();
void enabledVisibleInteraction();
+ void invisibleActionWithComplexShortcut();
void task200823_tooltip();
void task229128TriggeredSignalWithoutActiongroup();
void task229128TriggeredSignalWhenInActiongroup();
@@ -365,5 +367,36 @@ void tst_QAction::task229128TriggeredSignalWhenInActiongroup()
QCOMPARE(actionSpy.count(), 1);
}
+void tst_QAction::invisibleActionWithComplexShortcut()
+{
+ QAction action(0);
+ action.setShortcut(QKeySequence(Qt::CTRL + Qt::Key_E, Qt::Key_1));
+
+ QLineEdit edit;
+ edit.addAction(&action);
+ edit.show();
+ QTest::qWait(100);
+
+ QSignalSpy spy(&action, SIGNAL(triggered()));
+
+ action.setVisible(true);
+ QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier);
+ QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier);
+ QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier);
+ QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier);
+ QCOMPARE(spy.count(), 1);
+ QCOMPARE(edit.text(), QLatin1String(""));
+
+ edit.clear();
+ spy.clear();
+ action.setVisible(false);
+ QTest::keyPress(&edit, Qt::Key_E, Qt::ControlModifier);
+ QTest::keyRelease(&edit, Qt::Key_E, Qt::ControlModifier);
+ QTest::keyPress(&edit, Qt::Key_1, Qt::NoModifier);
+ QTest::keyRelease(&edit, Qt::Key_1, Qt::NoModifier);
+ QCOMPARE(spy.count(), 0);
+ QCOMPARE(edit.text(), QLatin1String("1"));
+}
+
QTEST_MAIN(tst_QAction)
#include "tst_qaction.moc"
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index 695bfe7..13b13d6 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -157,6 +157,8 @@ private slots:
void task228844_ensurePreviousSorting();
void task239706_editableFilterCombo();
void task218353_relativePaths();
+ void task251321_sideBarHiddenEntries();
+ void task251341_sideBarRemoveEntries();
private:
QByteArray userSettings;
@@ -1852,5 +1854,119 @@ void tst_QFiledialog::task218353_relativePaths()
appDir.rmdir("test");
}
+void tst_QFiledialog::task251321_sideBarHiddenEntries()
+{
+ QNonNativeFileDialog fd;
+
+ QDir current = QDir::currentPath();
+ current.mkdir(".hidden");
+ QDir hiddenDir = QDir(".hidden");
+ hiddenDir.mkdir("subdir");
+ QDir hiddenSubDir = QDir(".hidden/subdir");
+ hiddenSubDir.mkdir("happy");
+ hiddenSubDir.mkdir("happy2");
+
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile(hiddenSubDir.absolutePath());
+ fd.setSidebarUrls(urls);
+ fd.show();
+ QTest::qWait(250);
+
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ sidebar->setFocus();
+ sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
+ QTest::qWait(250);
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2);
+
+ hiddenSubDir.rmdir("happy2");
+ hiddenSubDir.rmdir("happy");
+ hiddenDir.rmdir("subdir");
+ current.rmdir(".hidden");
+}
+
+class MyQSideBar : public QSidebar
+{
+public :
+ MyQSideBar(QWidget *parent = 0) : QSidebar(parent)
+ {}
+
+ void removeSelection() {
+ QList<QModelIndex> idxs = selectionModel()->selectedIndexes();
+ QList<QPersistentModelIndex> indexes;
+ for (int i = 0; i < idxs.count(); i++)
+ indexes.append(idxs.at(i));
+
+ for (int i = 0; i < indexes.count(); ++i)
+ if (!indexes.at(i).data(Qt::UserRole + 1).toUrl().path().isEmpty())
+ model()->removeRow(indexes.at(i).row());
+ }
+};
+
+void tst_QFiledialog::task251341_sideBarRemoveEntries()
+{
+ QNonNativeFileDialog fd;
+
+ QDir current = QDir::currentPath();
+ current.mkdir("testDir");
+ QDir testSubDir = QDir("testDir");
+
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile(testSubDir.absolutePath());
+ urls << QUrl::fromLocalFile("NotFound");
+ fd.setSidebarUrls(urls);
+ fd.show();
+ QTest::qWait(250);
+
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ sidebar->setFocus();
+ //We enter in the first bookmark
+ sidebar->selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
+ QTest::qWait(250);
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ //There is no file
+ QCOMPARE(model->rowCount(model->index(testSubDir.absolutePath())), 0);
+ //Icon is not enabled QUrlModel::EnabledRole
+ QVariant value = sidebar->model()->index(0, 0).data(Qt::UserRole + 2);
+ QCOMPARE(qvariant_cast<bool>(value), true);
+
+ sidebar->setFocus();
+ //We enter in the second bookmark which is invalid
+ sidebar->selectUrl(QUrl::fromLocalFile("NotFound"));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
+ QTest::qWait(250);
+
+ //We fallback to root because the entry in the bookmark is invalid
+ QCOMPARE(model->rowCount(model->index("NotFound")), model->rowCount(model->index(model->rootPath())));
+ //Icon is not enabled QUrlModel::EnabledRole
+ value = sidebar->model()->index(1, 0).data(Qt::UserRole + 2);
+ QCOMPARE(qvariant_cast<bool>(value), false);
+
+ MyQSideBar mySideBar;
+ mySideBar.init(model, urls);
+ mySideBar.show();
+ mySideBar.selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
+ QTest::qWait(1000);
+ mySideBar.removeSelection();
+
+ //We remove the first entry
+ QList<QUrl> expected;
+ expected << QUrl::fromLocalFile("NotFound");
+ QCOMPARE(mySideBar.urls(), expected);
+
+ mySideBar.selectUrl(QUrl::fromLocalFile("NotFound"));
+ mySideBar.removeSelection();
+
+ //We remove the second entry
+ expected.clear();
+ QCOMPARE(mySideBar.urls(), expected);
+
+ current.rmdir("testDir");
+}
+
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 826d278..59d57ce 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -45,6 +45,7 @@
#include <QFileIconProvider>
#include "../../shared/util.h"
#include <QTime>
+#include <QStyle>
#include <QtGlobal>
//TESTED_CLASS=
@@ -284,6 +285,33 @@ void tst_QFileSystemModel::readOnly()
QVERIFY(model->flags(model->index(file.fileName())) & Qt::ItemIsEditable);
}
+class CustomFileIconProvider : public QFileIconProvider
+{
+public:
+ CustomFileIconProvider() : QFileIconProvider() {
+ mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical);
+ dvd = qApp->style()->standardIcon(QStyle::SP_DriveDVDIcon);
+ }
+
+ virtual QIcon icon(const QFileInfo &info) const
+ {
+ if (info.isDir())
+ return mb;
+
+ return QFileIconProvider::icon(info);
+ }
+ virtual QIcon icon(IconType type) const
+ {
+ if (type == QFileIconProvider::Folder)
+ return dvd;
+
+ return QFileIconProvider::icon(type);
+ }
+private:
+ QIcon mb;
+ QIcon dvd;
+};
+
void tst_QFileSystemModel::iconProvider()
{
QVERIFY(model->iconProvider());
@@ -292,6 +320,19 @@ void tst_QFileSystemModel::iconProvider()
QCOMPARE(model->iconProvider(), p);
model->setIconProvider(0);
delete p;
+
+ QFileSystemModel *myModel = new QFileSystemModel();
+ myModel->setRootPath(QDir::homePath());
+ //Let's wait to populate the model
+ QTest::qWait(250);
+ //We change the provider, icons must me updated
+ CustomFileIconProvider *custom = new CustomFileIconProvider();
+ myModel->setIconProvider(custom);
+
+ QPixmap mb = qApp->style()->standardIcon(QStyle::SP_MessageBoxCritical).pixmap(50, 50);
+ QCOMPARE(myModel->fileIcon(myModel->index(QDir::homePath())).pixmap(50, 50), mb);
+ delete myModel;
+ delete custom;
}
bool tst_QFileSystemModel::createFiles(const QString &test_path, const QStringList &initial_files, int existingFileCount, const QStringList &initial_dirs, const QString &dir)
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index e501bc4..57e441b 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -215,6 +215,7 @@ private slots:
void tabChangesFocus();
void tabChangesFocus_data();
void cacheMode();
+ void updateCachedItemAfterMove();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -3662,6 +3663,8 @@ void tst_QGraphicsItem::defaultItemTest_QGraphicsEllipseItem()
class ItemChangeTester : public QGraphicsRectItem
{
public:
+ ItemChangeTester(){}
+ ItemChangeTester(QGraphicsItem *parent) : QGraphicsRectItem(parent) {}
QVariant itemChangeReturnValue;
QGraphicsScene *itemSceneChangeTargetScene;
@@ -3950,6 +3953,39 @@ void tst_QGraphicsItem::itemChange()
QCOMPARE(tester.changes.size(), ++changeCount);
QCOMPARE(tester.changes.last(), QGraphicsItem::ItemChildRemovedChange);
QCOMPARE(qVariantValue<QGraphicsItem *>(tester.values.last()), (QGraphicsItem *)&testerHelper);
+
+ // ItemChildRemovedChange 1
+ ItemChangeTester *test = new ItemChangeTester;
+ test->itemSceneChangeTargetScene = 0;
+ int count = 0;
+ QGraphicsScene *scene = new QGraphicsScene;
+ scene->addItem(test);
+ count = test->changes.size();
+ //We test here the fact that when a child is deleted the parent receive only one ItemChildRemovedChange
+ QGraphicsRectItem *child = new QGraphicsRectItem(test);
+ //We received ItemChildAddedChange
+ QCOMPARE(test->changes.size(), ++count);
+ QCOMPARE(test->changes.last(), QGraphicsItem::ItemChildAddedChange);
+ delete child;
+ child = 0;
+ QCOMPARE(test->changes.size(), ++count);
+ QCOMPARE(test->changes.last(), QGraphicsItem::ItemChildRemovedChange);
+
+ ItemChangeTester *childTester = new ItemChangeTester(test);
+ //Changes contains all sceneHasChanged and so on, we don't want to test that
+ int childCount = childTester->changes.size();
+ //We received ItemChildAddedChange
+ QCOMPARE(test->changes.size(), ++count);
+ child = new QGraphicsRectItem(childTester);
+ //We received ItemChildAddedChange
+ QCOMPARE(childTester->changes.size(), ++childCount);
+ QCOMPARE(childTester->changes.last(), QGraphicsItem::ItemChildAddedChange);
+ //Delete the child of the top level with all its children
+ delete childTester;
+ //Only one removal
+ QCOMPARE(test->changes.size(), ++count);
+ QCOMPARE(test->changes.last(), QGraphicsItem::ItemChildRemovedChange);
+ delete scene;
}
{
// ItemChildRemovedChange 2
@@ -6060,5 +6096,46 @@ void tst_QGraphicsItem::cacheMode()
QCOMPARE(testerChild2->repaints, 6);
}
+void tst_QGraphicsItem::updateCachedItemAfterMove()
+{
+ // A simple item that uses ItemCoordinateCache
+ EventTester *tester = new EventTester;
+ tester->setCacheMode(QGraphicsItem::ItemCoordinateCache);
+
+ // Add to a scene, show in a view, ensure it's painted and reset its
+ // repaint counter.
+ QGraphicsScene scene;
+ scene.addItem(tester);
+ QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(125);
+ tester->repaints = 0;
+
+ // Move the item, should not cause repaints
+ tester->setPos(10, 0);
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 0);
+
+ // Move then update, should cause one repaint
+ tester->setPos(20, 0);
+ tester->update();
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 1);
+
+ // Hiding the item doesn't cause a repaint
+ tester->hide();
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 1);
+
+ // Moving a hidden item doesn't cause a repaint
+ tester->setPos(30, 0);
+ tester->update();
+ QTest::qWait(125);
+ QCOMPARE(tester->repaints, 1);
+}
+
QTEST_MAIN(tst_QGraphicsItem)
#include "tst_qgraphicsitem.moc"
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index b99f111..d856024 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -175,6 +175,9 @@ private slots:
void bypassGraphicsProxyWidget_data();
void bypassGraphicsProxyWidget();
void dragDrop();
+ void windowFlags_data();
+ void windowFlags();
+ void comboboxWindowFlags();
};
// Subclass that exposes the protected functions.
@@ -3153,6 +3156,67 @@ void tst_QGraphicsProxyWidget::dragDrop()
QCOMPARE(edit->text(), QString("hei"));
}
+void tst_QGraphicsProxyWidget::windowFlags_data()
+{
+ QTest::addColumn<int>("proxyFlags");
+ QTest::addColumn<int>("widgetFlags");
+ QTest::addColumn<int>("resultingProxyFlags");
+ QTest::addColumn<int>("resultingWidgetFlags");
+
+ QTest::newRow("proxy(0) widget(0)") << 0 << 0 << 0 << int(Qt::Window);
+ QTest::newRow("proxy(window)") << int(Qt::Window) << 0 << int(Qt::Window) << int(Qt::Window);
+ QTest::newRow("proxy(window) widget(window)") << int(Qt::Window) << int(Qt::Window) << int(Qt::Window) << int(Qt::Window);
+ QTest::newRow("proxy(0) widget(window)") << int(0) << int(Qt::Window) << int(0) << int(Qt::Window);
+}
+
+void tst_QGraphicsProxyWidget::windowFlags()
+{
+ QFETCH(int, proxyFlags);
+ QFETCH(int, widgetFlags);
+ QFETCH(int, resultingProxyFlags);
+ QFETCH(int, resultingWidgetFlags);
+ Qt::WindowFlags proxyWFlags = Qt::WindowFlags(proxyFlags);
+ Qt::WindowFlags widgetWFlags = Qt::WindowFlags(widgetFlags);
+ Qt::WindowFlags resultingProxyWFlags = Qt::WindowFlags(resultingProxyFlags);
+ Qt::WindowFlags resultingWidgetWFlags = Qt::WindowFlags(resultingWidgetFlags);
+
+ QGraphicsProxyWidget proxy(0, proxyWFlags);
+ QVERIFY((proxy.windowFlags() & proxyWFlags) == proxyWFlags);
+
+ QWidget *widget = new QWidget(0, widgetWFlags);
+ QVERIFY((widget->windowFlags() & widgetWFlags) == widgetWFlags);
+
+ proxy.setWidget(widget);
+
+ if (resultingProxyFlags == 0)
+ QVERIFY(!proxy.windowFlags());
+ else
+ QVERIFY((proxy.windowFlags() & resultingProxyWFlags) == resultingProxyWFlags);
+ QVERIFY((widget->windowFlags() & resultingWidgetWFlags) == resultingWidgetWFlags);
+}
+
+void tst_QGraphicsProxyWidget::comboboxWindowFlags()
+{
+ QComboBox *comboBox = new QComboBox;
+ comboBox->addItem("Item 1");
+ comboBox->addItem("Item 2");
+ comboBox->addItem("Item 3");
+ QWidget *embedWidget = comboBox;
+
+ QGraphicsScene scene;
+ QGraphicsProxyWidget *proxy = scene.addWidget(embedWidget);
+ proxy->setWindowFlags(Qt::Window);
+ QVERIFY(embedWidget->isWindow());
+ QVERIFY(proxy->isWindow());
+
+ comboBox->showPopup();
+
+ QCOMPARE(proxy->childItems().size(), 1);
+ QGraphicsItem *popupProxy = proxy->childItems().first();
+ QVERIFY(popupProxy->isWindow());
+ QVERIFY((static_cast<QGraphicsWidget *>(popupProxy)->windowFlags() & Qt::Popup) == Qt::Popup);
+}
+
QTEST_MAIN(tst_QGraphicsProxyWidget)
#include "tst_qgraphicsproxywidget.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index a737a37..56737c3 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -149,6 +149,8 @@ private slots:
void explicitMouseGrabber();
void implicitMouseGrabber();
void popupMouseGrabber();
+ void windowFlags_data();
+ void windowFlags();
// Task fixes
void task236127_bspTreeIndexFails();
@@ -2086,6 +2088,83 @@ void tst_QGraphicsWidget::popupMouseGrabber()
QCOMPARE(scene.mouseGrabberItem(), (QGraphicsItem *)widget3);
}
+void tst_QGraphicsWidget::windowFlags_data()
+{
+ QTest::addColumn<int>("inputFlags");
+ QTest::addColumn<int>("outputFlags");
+
+ QTest::newRow("nil") << 0 << 0;
+
+ // Window types
+ QTest::newRow("Qt::Window") << int(Qt::Window)
+ << int(Qt::Window | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
+ | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
+ QTest::newRow("Qt::SubWindow") << int(Qt::SubWindow)
+ << int(Qt::SubWindow | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
+ | Qt::WindowMinimizeButtonHint | Qt::WindowMaximizeButtonHint);
+ QTest::newRow("Qt::Dialog") << int(Qt::Dialog)
+ << int(Qt::Dialog | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
+ | Qt::WindowContextHelpButtonHint);
+ QTest::newRow("Qt::Sheet") << int(Qt::Sheet)
+ << int(Qt::Sheet | Qt::WindowTitleHint | Qt::WindowSystemMenuHint
+ | Qt::WindowContextHelpButtonHint);
+ QTest::newRow("Qt::Tool") << int(Qt::Tool)
+ << int(Qt::Tool | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
+
+ // Custom window flags
+ QTest::newRow("Qt::FramelessWindowHint") << int(Qt::FramelessWindowHint)
+ << int(Qt::FramelessWindowHint);
+ QTest::newRow("Qt::CustomizeWindowHint") << int(Qt::CustomizeWindowHint)
+ << int(Qt::CustomizeWindowHint);
+}
+
+void tst_QGraphicsWidget::windowFlags()
+{
+ QFETCH(int, inputFlags);
+ QFETCH(int, outputFlags);
+
+ // Construct with flags set already
+ QGraphicsWidget widget(0, Qt::WindowFlags(inputFlags));
+ QCOMPARE(widget.windowFlags(), Qt::WindowFlags(outputFlags));
+
+ // Set flags after construction
+ QGraphicsWidget widget2;
+ widget2.setWindowFlags(Qt::WindowFlags(inputFlags));
+ QCOMPARE(widget2.windowFlags(), Qt::WindowFlags(outputFlags));
+
+ // Reset flags
+ widget2.setWindowFlags(0);
+ QVERIFY(!widget2.windowFlags());
+
+ // Set flags back again
+ widget2.setWindowFlags(Qt::WindowFlags(inputFlags));
+ QCOMPARE(widget2.windowFlags(), Qt::WindowFlags(outputFlags));
+
+ // Construct with custom flags set already
+ QGraphicsWidget widget3(0, Qt::WindowFlags(inputFlags | Qt::FramelessWindowHint));
+ QCOMPARE(widget3.windowFlags(), Qt::WindowFlags(inputFlags | Qt::FramelessWindowHint));
+
+ // Set custom flags after construction
+ QGraphicsWidget widget4;
+ widget4.setWindowFlags(Qt::WindowFlags(inputFlags | Qt::FramelessWindowHint));
+ QCOMPARE(widget4.windowFlags(), Qt::WindowFlags(inputFlags | Qt::FramelessWindowHint));
+
+ // Reset flags
+ widget4.setWindowFlags(0);
+ QVERIFY(!widget4.windowFlags());
+
+ // Set custom flags back again
+ widget4.setWindowFlags(Qt::WindowFlags(inputFlags | Qt::FramelessWindowHint));
+ QCOMPARE(widget4.windowFlags(), Qt::WindowFlags(inputFlags | Qt::FramelessWindowHint));
+
+ QGraphicsWidget *widget5 = new QGraphicsWidget;
+ widget5->setWindowFlags(Qt::WindowFlags(inputFlags));
+ QCOMPARE(widget5->windowFlags(), Qt::WindowFlags(outputFlags));
+ QGraphicsWidget window(0, Qt::Window);
+ widget5->setParentItem(&window);
+ QCOMPARE(widget5->windowFlags(), Qt::WindowFlags(outputFlags));
+}
+
class ProxyStyle : public QCommonStyle
{
public:
diff --git a/tests/auto/qimagereader/baseline/35floppy.ico b/tests/auto/qimagereader/baseline/35floppy.ico
new file mode 100644
index 0000000..59fd37e
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/35floppy.ico
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/kde_favicon.ico b/tests/auto/qimagereader/baseline/kde_favicon.ico
new file mode 100644
index 0000000..15bcdbb
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/kde_favicon.ico
Binary files differ
diff --git a/tests/auto/qimagereader/baseline/semitransparent.ico b/tests/auto/qimagereader/baseline/semitransparent.ico
new file mode 100644
index 0000000..dd23de9
--- /dev/null
+++ b/tests/auto/qimagereader/baseline/semitransparent.ico
Binary files differ
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 3841111..8f7094c 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -153,6 +153,9 @@ private slots:
void autoDetectImageFormat();
void fileNameProbing();
+
+ void pixelCompareWithBaseline_data();
+ void pixelCompareWithBaseline();
};
// Testing get/set functions
@@ -1368,5 +1371,32 @@ void tst_QImageReader::fileNameProbing()
QCOMPARE(r.fileName(), name);
}
+void tst_QImageReader::pixelCompareWithBaseline_data()
+{
+ QTest::addColumn<QString>("fileName");
+
+ QTest::newRow("floppy (16px,32px - 16 colors)") << "35floppy.ico";
+ QTest::newRow("semitransparent") << "semitransparent.ico";
+ QTest::newRow("slightlybroken") << "kde_favicon.ico";
+}
+
+void tst_QImageReader::pixelCompareWithBaseline()
+{
+ QFETCH(QString, fileName);
+
+ QImage icoImg;
+ // might fail if the plugin does not exist, which is ok.
+ if (icoImg.load(QString::fromAscii("images/%1").arg(fileName))) {
+ QString baselineFileName = QString::fromAscii("baseline/%1").arg(fileName);
+#if 0
+ icoImg.save(baselineFileName);
+#else
+ QImage baseImg;
+ QVERIFY(baseImg.load(baselineFileName));
+ QCOMPARE(baseImg, icoImg);
+#endif
+ }
+}
+
QTEST_MAIN(tst_QImageReader)
#include "tst_qimagereader.moc"
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 8b43f9b..c81bf67 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -3792,8 +3792,11 @@ void tst_QPainter::imageBlending()
void tst_QPainter::paintOnNullPixmap()
{
+ QPixmap pix(16, 16);
+
QPixmap textPixmap;
QPainter p(&textPixmap);
+ p.drawPixmap(10, 10, pix);
p.end();
QPixmap textPixmap2(16,16);
diff --git a/tests/auto/qprocess/testProcessEnvironment/main.cpp b/tests/auto/qprocess/testProcessEnvironment/main.cpp
index 098d13e..b5e75bc 100644
--- a/tests/auto/qprocess/testProcessEnvironment/main.cpp
+++ b/tests/auto/qprocess/testProcessEnvironment/main.cpp
@@ -3,6 +3,40 @@
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
****************************************************************************/
#include <stdio.h>
diff --git a/tests/auto/qshortcut/tst_qshortcut.cpp b/tests/auto/qshortcut/tst_qshortcut.cpp
index 69ebf74..cd80204 100644
--- a/tests/auto/qshortcut/tst_qshortcut.cpp
+++ b/tests/auto/qshortcut/tst_qshortcut.cpp
@@ -987,17 +987,16 @@ void tst_QShortcut::keypressConsumption()
cut1->setEnabled(false);
cut2->setEnabled(false);
- // Make sure keypresses is passed on, since all multiple keysequences
- // with Ctrl+I are disabled
+ edit->clear();
sendKeyEvents(edit, Qt::CTRL + Qt::Key_I, 0); // Send key to edit
QCOMPARE( currentResult, NoResult );
QCOMPARE( ambigResult, NoResult );
- QVERIFY(edit->toPlainText().endsWith("<Ctrl+I>"));
+ QVERIFY(edit->toPlainText().isEmpty());
sendKeyEvents(edit, Qt::Key_A, 'a'); // Send key to edit
QCOMPARE( currentResult, NoResult );
QCOMPARE( ambigResult, NoResult );
- QVERIFY(edit->toPlainText().endsWith("<Ctrl+I>a"));
+ QVERIFY(edit->toPlainText().isEmpty());
clearAllShortcuts();
}
diff --git a/tests/auto/qsidebar/tst_qsidebar.cpp b/tests/auto/qsidebar/tst_qsidebar.cpp
index 7a262e6..705e222 100644
--- a/tests/auto/qsidebar/tst_qsidebar.cpp
+++ b/tests/auto/qsidebar/tst_qsidebar.cpp
@@ -176,6 +176,32 @@ void tst_QSidebar::addUrls()
qsidebar.addUrls(urls, -1);
qsidebar.addUrls(moreUrls, -1);
QCOMPARE(qsidebar.urls()[0], urls[0]);
+
+ QList<QUrl> doubleUrls;
+ //tow exact same paths, we have only one entry
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 1);
+
+#if defined(Q_OS_WIN)
+ //Windows is case insensitive so no duplicate entries in that case
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 1);
+#else
+ //Two different paths we should have two entries
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath());
+ doubleUrls << QUrl::fromLocalFile(QDir::home().absolutePath().toUpper());
+ qsidebar.setUrls(emptyUrls);
+ qsidebar.addUrls(doubleUrls, 1);
+ QCOMPARE(qsidebar.urls().size(), 2);
+#endif
+
+
}
void tst_QSidebar::goToUrl()
diff --git a/tests/auto/qtransform/tst_qtransform.cpp b/tests/auto/qtransform/tst_qtransform.cpp
index 8516ddb..74c405e 100644
--- a/tests/auto/qtransform/tst_qtransform.cpp
+++ b/tests/auto/qtransform/tst_qtransform.cpp
@@ -593,6 +593,16 @@ void tst_QTransform::types()
m3.translate(5.0f, 5.0f);
QCOMPARE(m3.type(), QTransform::TxScale);
QCOMPARE(m3.inverted().type(), QTransform::TxScale);
+
+ m3.setMatrix(1.0f, 0.0f, 0.0f,
+ 0.0f, 1.0f, 0.0f,
+ 0.0f, 0.0f, 2.0f);
+ QCOMPARE(m3.type(), QTransform::TxProject);
+
+ m3.setMatrix(0.0f, 2.0f, 0.0f,
+ 1.0f, 0.0f, 0.0f,
+ 0.0f, 0.0f, 2.0f);
+ QCOMPARE(m3.type(), QTransform::TxProject);
}
diff --git a/tests/auto/selftests/xunit/tst_xunit.cpp b/tests/auto/selftests/xunit/tst_xunit.cpp
index b42582e..d0b585f 100644
--- a/tests/auto/selftests/xunit/tst_xunit.cpp
+++ b/tests/auto/selftests/xunit/tst_xunit.cpp
@@ -3,6 +3,40 @@
** Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Qt Software Information (qt-info@nokia.com)
**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
****************************************************************************/
#include <QtTest/QtTest>