summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-30 07:56:19 +0200
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-30 07:56:19 +0200
commit3fe98c88473712e1c486f4b93f2ac41b7b07331b (patch)
tree986ae00ba9b286ac412f56c9707a948e3815a54e /tests
parentd6eb899ee2c937a871dd945a995e2fd4a3eb7821 (diff)
parent02aecce59cb76ceb88f63520355381c3b5c5a513 (diff)
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: QTextCodec: Fix valgrind warning when using QTextCodec in destructions functions Fix double painting when adding an item into a linear layout Fixed antialiased rasterization bug in raster engine. Fixed potential crash when loading corrupt GIFs. Work around an ATI driver problem with mutli-sampled pbuffers. tst_qstatemachine.cpp: fix compilation with Sun Studio Fixed regression in clipping.qps autotest on 64-bit. Fixed crash when using Qt::WA_DeleteOnClose on a QPrintDialog on Mac. Fixed performance regression in curve stroking. Don't disable texture_from_pixmap on GLX/X11 by default. Avoid creating copy of an image in memory when storing as png Doc update for the support of MSVC 2010 64-bit fix documentation of drawText(int, int, int, int, ... Optimization of pixel conversion when storing jpeg Don't pretend to support single buffered EGL surfaces. Named anonymous struct in the OpenGL paint engine. Fixes gray_raster incorrectly reporting out of memory error.
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp40
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp43
-rw-r--r--tests/auto/qstatemachine/tst_qstatemachine.cpp2
-rw-r--r--tests/auto/qtextcodec/tst_qtextcodec.cpp9
4 files changed, 93 insertions, 1 deletions
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index ddc4f7309f..7f24ddc4a9 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -184,6 +184,7 @@ private slots:
void task250119_shortcutContext();
void QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems();
void QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems();
+ void QT_BUG_13865_doublePaintWhenAddingASubItem();
};
@@ -3321,6 +3322,45 @@ void tst_QGraphicsWidget::QT_BUG_12056_tabFocusFirstUnsetWhenRemovingItems()
//This should not crash
}
+
+struct GreenWidget : public QGraphicsWidget
+{
+ GreenWidget() : count(0)
+ {
+ }
+
+ void paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * )
+ {
+ count++;
+ painter->setPen(Qt::green);
+ painter->drawRect(option->rect.adjusted(0,0,-1,-1));
+ }
+
+ int count;
+};
+
+void tst_QGraphicsWidget::QT_BUG_13865_doublePaintWhenAddingASubItem()
+{
+ QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ widget->resize(100, 100);
+ scene.addItem(widget);
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget);
+
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+
+
+ GreenWidget *sub = new GreenWidget;
+ layout->addItem(sub);
+
+ QTest::qWait(100);
+ QCOMPARE(sub->count, 1); //it should only be painted once
+
+}
+
+
QTEST_MAIN(tst_QGraphicsWidget)
#include "tst_qgraphicswidget.moc"
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index 3bee5d98aa..4b4bdd6a3b 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -178,6 +178,8 @@ private slots:
void testIgnoresFormatAndExtension_data();
void testIgnoresFormatAndExtension();
+ void saveFormat_data();
+ void saveFormat();
};
static const QLatin1String prefix(SRCDIR "/images/");
@@ -1905,5 +1907,46 @@ void tst_QImageReader::testIgnoresFormatAndExtension()
}
}
+
+void tst_QImageReader::saveFormat_data()
+{
+ QTest::addColumn<QImage::Format>("format");
+
+ QTest::newRow("Format_Mono") << QImage::Format_Mono;
+ QTest::newRow("Format_MonoLSB") << QImage::Format_MonoLSB;
+ QTest::newRow("Format_Indexed8") << QImage::Format_Indexed8;
+ QTest::newRow("Format_RGB32") << QImage::Format_RGB32;
+ QTest::newRow("Format_ARGB32") << QImage::Format_ARGB32;
+ QTest::newRow("Format_ARGB32_Premultiplied") << QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("Format_RGB16") << QImage::Format_RGB16;
+ QTest::newRow("Format_ARGB8565_Premultiplied") << QImage::Format_ARGB8565_Premultiplied;
+ QTest::newRow("Format_RGB666") << QImage::Format_RGB666;
+ QTest::newRow("Format_ARGB6666_Premultiplied") << QImage::Format_ARGB6666_Premultiplied;
+ QTest::newRow("Format_RGB555") << QImage::Format_RGB555;
+ QTest::newRow("Format_ARGB8555_Premultiplied") << QImage::Format_ARGB8555_Premultiplied;
+ QTest::newRow("Format_RGB888") << QImage::Format_RGB888;
+ QTest::newRow("Format_RGB444") << QImage::Format_RGB444;
+ QTest::newRow("Format_ARGB4444_Premultiplied") << QImage::Format_ARGB4444_Premultiplied;
+}
+
+void tst_QImageReader::saveFormat()
+{
+ QFETCH(QImage::Format, format);
+
+ QImage orig(":/images/kollada.png");
+
+ QImage converted = orig.convertToFormat(format);
+ QBuffer buf;
+ buf.open(QIODevice::WriteOnly);
+ QVERIFY(converted.save(&buf, "png"));
+ buf.close();
+ QImage stored = QImage::fromData(buf.buffer(), "png");
+
+ stored = stored.convertToFormat(QImage::Format_ARGB32);
+ converted = converted.convertToFormat(QImage::Format_ARGB32);
+ QCOMPARE(stored, converted);
+}
+
+
QTEST_MAIN(tst_QImageReader)
#include "tst_qimagereader.moc"
diff --git a/tests/auto/qstatemachine/tst_qstatemachine.cpp b/tests/auto/qstatemachine/tst_qstatemachine.cpp
index 2bf76e7307..f6aee88dab 100644
--- a/tests/auto/qstatemachine/tst_qstatemachine.cpp
+++ b/tests/auto/qstatemachine/tst_qstatemachine.cpp
@@ -1112,7 +1112,7 @@ void tst_QStateMachine::machineWithParent()
QObject object;
QStateMachine *machine = new QStateMachine(&object);
QCOMPARE(machine->parent(), &object);
- QCOMPARE(machine->parentState(), (QObject*)0);
+ QCOMPARE(machine->parentState(), static_cast<QState*>(0));
}
void tst_QStateMachine::addAndRemoveState()
diff --git a/tests/auto/qtextcodec/tst_qtextcodec.cpp b/tests/auto/qtextcodec/tst_qtextcodec.cpp
index cc41591756..3d8f1a305d 100644
--- a/tests/auto/qtextcodec/tst_qtextcodec.cpp
+++ b/tests/auto/qtextcodec/tst_qtextcodec.cpp
@@ -2236,6 +2236,15 @@ void tst_QTextCodec::moreToFromUnicode()
QCOMPARE(testData, cStr);
}
+struct DontCrashAtExit {
+ ~DontCrashAtExit() {
+ QTextCodec *c = QTextCodec::codecForName("utf8");
+ if (c)
+ c->toUnicode("azerty");
+
+ }
+} dontCrashAtExit;
+
QTEST_MAIN(tst_QTextCodec)
#include "tst_qtextcodec.moc"