summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/gui.pro3
-rw-r--r--tests/auto/qcolor/tst_qcolor.cpp2
-rw-r--r--tests/auto/qcomplextext/tst_qcomplextext.cpp2
-rw-r--r--tests/auto/qglyphrun/qglyphrun.pro (renamed from tests/auto/qglyphs/qglyphs.pro)4
-rw-r--r--tests/auto/qglyphrun/test.ttf (renamed from tests/auto/qglyphs/test.ttf)bin3712 -> 3712 bytes
-rw-r--r--tests/auto/qglyphrun/tst_qglyphrun.cpp (renamed from tests/auto/qglyphs/tst_qglyphs.cpp)154
-rw-r--r--tests/auto/qlineedit/tst_qlineedit.cpp4
-rw-r--r--tests/auto/qrawfont/tst_qrawfont.cpp52
-rw-r--r--tests/auto/qscroller/qscroller.pro3
-rw-r--r--tests/auto/qscroller/tst_qscroller.cpp537
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp15
-rw-r--r--tests/auto/qtcpsocket/tst_qtcpsocket.cpp36
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp26
-rw-r--r--tests/auto/qtextedit/tst_qtextedit.cpp4
-rw-r--r--tests/auto/qvariant/tst_qvariant.cpp1
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp45
16 files changed, 231 insertions, 657 deletions
diff --git a/tests/auto/gui.pro b/tests/auto/gui.pro
index 22c5e51..17f56f2 100644
--- a/tests/auto/gui.pro
+++ b/tests/auto/gui.pro
@@ -58,7 +58,7 @@ SUBDIRS=\
qfontdialog \
qfontmetrics \
qformlayout \
- qglyphs \
+ qglyphrun \
qgraphicsanchorlayout \
qgraphicsanchorlayout1 \
qgraphicseffect \
@@ -142,7 +142,6 @@ SUBDIRS=\
qregion \
qscrollarea \
qscrollbar \
- qscroller \
qsharedpointer_and_qwidget \
qshortcut \
qsidebar \
diff --git a/tests/auto/qcolor/tst_qcolor.cpp b/tests/auto/qcolor/tst_qcolor.cpp
index d42c26c..b02537e 100644
--- a/tests/auto/qcolor/tst_qcolor.cpp
+++ b/tests/auto/qcolor/tst_qcolor.cpp
@@ -1506,7 +1506,6 @@ void tst_QColor::setallowX11ColorNames()
for (int i = 0; i < x11RgbTblSize; ++i) {
QString colorName = QLatin1String(x11RgbTbl[i].name);
QColor color;
- QTest::ignoreMessage(QtWarningMsg, QString("QColor::setNamedColor: Unknown color name '%1'").arg(colorName).toLatin1());
color.setNamedColor(colorName);
QVERIFY(!color.isValid());
}
@@ -1528,7 +1527,6 @@ void tst_QColor::setallowX11ColorNames()
for (int i = 0; i < x11RgbTblSize; ++i) {
QString colorName = QLatin1String(x11RgbTbl[i].name);
QColor color;
- QTest::ignoreMessage(QtWarningMsg, QString("QColor::setNamedColor: Unknown color name '%1'").arg(colorName).toLatin1());
color.setNamedColor(colorName);
QVERIFY(!color.isValid());
}
diff --git a/tests/auto/qcomplextext/tst_qcomplextext.cpp b/tests/auto/qcomplextext/tst_qcomplextext.cpp
index 58b31b4..ae63bac 100644
--- a/tests/auto/qcomplextext/tst_qcomplextext.cpp
+++ b/tests/auto/qcomplextext/tst_qcomplextext.cpp
@@ -214,7 +214,7 @@ void tst_QComplexText::bidiCursorMovement()
QTextOption option = layout.textOption();
option.setTextDirection(basicDir == QChar::DirL ? Qt::LeftToRight : Qt::RightToLeft);
layout.setTextOption(option);
- layout.setCursorMoveStyle(QTextCursor::Visual);
+ layout.setCursorMoveStyle(Qt::VisualMoveStyle);
bool moved;
int oldPos, newPos = 0;
qreal x, newX;
diff --git a/tests/auto/qglyphs/qglyphs.pro b/tests/auto/qglyphrun/qglyphrun.pro
index 5084cf9..480ad5b 100644
--- a/tests/auto/qglyphs/qglyphs.pro
+++ b/tests/auto/qglyphrun/qglyphrun.pro
@@ -2,10 +2,10 @@ load(qttest_p4)
QT = core gui
SOURCES += \
- tst_qglyphs.cpp
+ tst_qglyphrun.cpp
wince*|symbian*: {
DEFINES += SRCDIR=\\\"\\\"
} else {
DEFINES += SRCDIR=\\\"$$PWD/\\\"
-} \ No newline at end of file
+}
diff --git a/tests/auto/qglyphs/test.ttf b/tests/auto/qglyphrun/test.ttf
index 9043a57..9043a57 100644
--- a/tests/auto/qglyphs/test.ttf
+++ b/tests/auto/qglyphrun/test.ttf
Binary files differ
diff --git a/tests/auto/qglyphs/tst_qglyphs.cpp b/tests/auto/qglyphrun/tst_qglyphrun.cpp
index ffa0d00..aefc228 100644
--- a/tests/auto/qglyphs/tst_qglyphs.cpp
+++ b/tests/auto/qglyphrun/tst_qglyphrun.cpp
@@ -41,14 +41,14 @@
#include <QtTest/QtTest>
-#include <qglyphs.h>
+#include <qglyphrun.h>
#include <qpainter.h>
#include <qtextlayout.h>
#include <qfontdatabase.h>
// #define DEBUG_SAVE_IMAGE
-class tst_QGlyphs: public QObject
+class tst_QGlyphRun: public QObject
{
Q_OBJECT
@@ -82,9 +82,9 @@ private:
#if !defined(QT_NO_RAWFONT)
-Q_DECLARE_METATYPE(QGlyphs);
+Q_DECLARE_METATYPE(QGlyphRun);
-void tst_QGlyphs::initTestCase()
+void tst_QGlyphRun::initTestCase()
{
m_testFontId = QFontDatabase::addApplicationFont(SRCDIR "test.ttf");
QVERIFY(m_testFontId >= 0);
@@ -94,19 +94,19 @@ void tst_QGlyphs::initTestCase()
QCOMPARE(QFontInfo(m_testFont).family(), QString::fromLatin1("QtsSpecialTestFont"));
}
-void tst_QGlyphs::cleanupTestCase()
+void tst_QGlyphRun::cleanupTestCase()
{
QFontDatabase::removeApplicationFont(m_testFontId);
}
-void tst_QGlyphs::constructionAndDestruction()
+void tst_QGlyphRun::constructionAndDestruction()
{
- QGlyphs glyphIndexes;
+ QGlyphRun glyphIndexes;
}
-static QGlyphs make_dummy_indexes()
+static QGlyphRun make_dummy_indexes()
{
- QGlyphs glyphs;
+ QGlyphRun glyphs;
QVector<quint32> glyphIndexes;
QVector<QPointF> positions;
@@ -121,16 +121,16 @@ static QGlyphs make_dummy_indexes()
positions.append(QPointF(3, 4));
positions.append(QPointF(5, 6));
- glyphs.setFont(QRawFont::fromFont(font));
+ glyphs.setRawFont(QRawFont::fromFont(font));
glyphs.setGlyphIndexes(glyphIndexes);
glyphs.setPositions(positions);
return glyphs;
}
-void tst_QGlyphs::copyConstructor()
+void tst_QGlyphRun::copyConstructor()
{
- QGlyphs glyphs;
+ QGlyphRun glyphs;
{
QVector<quint32> glyphIndexes;
@@ -146,40 +146,40 @@ void tst_QGlyphs::copyConstructor()
positions.append(QPointF(3, 4));
positions.append(QPointF(5, 6));
- glyphs.setFont(QRawFont::fromFont(font));
+ glyphs.setRawFont(QRawFont::fromFont(font));
glyphs.setGlyphIndexes(glyphIndexes);
glyphs.setPositions(positions);
}
- QGlyphs otherGlyphs(glyphs);
- QCOMPARE(otherGlyphs.font(), glyphs.font());
+ QGlyphRun otherGlyphs(glyphs);
+ QCOMPARE(otherGlyphs.rawFont(), glyphs.rawFont());
QCOMPARE(glyphs.glyphIndexes(), otherGlyphs.glyphIndexes());
QCOMPARE(glyphs.positions(), otherGlyphs.positions());
}
-void tst_QGlyphs::assignment()
+void tst_QGlyphRun::assignment()
{
- QGlyphs glyphs(make_dummy_indexes());
+ QGlyphRun glyphs(make_dummy_indexes());
- QGlyphs otherGlyphs = glyphs;
- QCOMPARE(otherGlyphs.font(), glyphs.font());
+ QGlyphRun otherGlyphs = glyphs;
+ QCOMPARE(otherGlyphs.rawFont(), glyphs.rawFont());
QCOMPARE(glyphs.glyphIndexes(), otherGlyphs.glyphIndexes());
QCOMPARE(glyphs.positions(), otherGlyphs.positions());
}
-void tst_QGlyphs::equalsOperator_data()
+void tst_QGlyphRun::equalsOperator_data()
{
- QTest::addColumn<QGlyphs>("one");
- QTest::addColumn<QGlyphs>("two");
+ QTest::addColumn<QGlyphRun>("one");
+ QTest::addColumn<QGlyphRun>("two");
QTest::addColumn<bool>("equals");
- QGlyphs one(make_dummy_indexes());
- QGlyphs two(make_dummy_indexes());
+ QGlyphRun one(make_dummy_indexes());
+ QGlyphRun two(make_dummy_indexes());
QTest::newRow("Identical") << one << two << true;
{
- QGlyphs busted(two);
+ QGlyphRun busted(two);
QVector<QPointF> positions = busted.positions();
positions[2] += QPointF(1, 1);
@@ -190,17 +190,17 @@ void tst_QGlyphs::equalsOperator_data()
}
{
- QGlyphs busted(two);
+ QGlyphRun busted(two);
QFont font;
- font.setPixelSize(busted.font().pixelSize() * 2);
- busted.setFont(QRawFont::fromFont(font));
+ font.setPixelSize(busted.rawFont().pixelSize() * 2);
+ busted.setRawFont(QRawFont::fromFont(font));
QTest::newRow("Different fonts") << one << busted << false;
}
{
- QGlyphs busted(two);
+ QGlyphRun busted(two);
QVector<quint32> glyphIndexes = busted.glyphIndexes();
glyphIndexes[2] += 1;
@@ -211,10 +211,10 @@ void tst_QGlyphs::equalsOperator_data()
}
-void tst_QGlyphs::equalsOperator()
+void tst_QGlyphRun::equalsOperator()
{
- QFETCH(QGlyphs, one);
- QFETCH(QGlyphs, two);
+ QFETCH(QGlyphRun, one);
+ QFETCH(QGlyphRun, two);
QFETCH(bool, equals);
QCOMPARE(one == two, equals);
@@ -222,7 +222,7 @@ void tst_QGlyphs::equalsOperator()
}
-void tst_QGlyphs::textLayoutGlyphIndexes()
+void tst_QGlyphRun::textLayoutGlyphIndexes()
{
QString s;
s.append(QLatin1Char('A'));
@@ -234,17 +234,17 @@ void tst_QGlyphs::textLayoutGlyphIndexes()
layout.createLine();
layout.endLayout();
- QList<QGlyphs> listOfGlyphs = layout.glyphs();
+ QList<QGlyphRun> listOfGlyphs = layout.glyphRuns();
QCOMPARE(listOfGlyphs.size(), 1);
- QGlyphs glyphs = listOfGlyphs.at(0);
+ QGlyphRun glyphs = listOfGlyphs.at(0);
QCOMPARE(glyphs.glyphIndexes().size(), 2);
QCOMPARE(glyphs.glyphIndexes().at(0), quint32(2));
QCOMPARE(glyphs.glyphIndexes().at(1), quint32(1));
}
-void tst_QGlyphs::drawExistingGlyphs()
+void tst_QGlyphRun::drawExistingGlyphs()
{
QPixmap textLayoutDraw(1000, 1000);
QPixmap drawGlyphs(1000, 1000);
@@ -267,13 +267,13 @@ void tst_QGlyphs::drawExistingGlyphs()
layout.draw(&p, QPointF(50, 50));
}
- QGlyphs glyphs = layout.glyphs().size() > 0
- ? layout.glyphs().at(0)
- : QGlyphs();
+ QGlyphRun glyphs = layout.glyphRuns().size() > 0
+ ? layout.glyphRuns().at(0)
+ : QGlyphRun();
{
QPainter p(&drawGlyphs);
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -284,7 +284,7 @@ void tst_QGlyphs::drawExistingGlyphs()
QCOMPARE(textLayoutDraw, drawGlyphs);
}
-void tst_QGlyphs::drawNonExistentGlyphs()
+void tst_QGlyphRun::drawNonExistentGlyphs()
{
QVector<quint32> glyphIndexes;
glyphIndexes.append(3);
@@ -292,10 +292,10 @@ void tst_QGlyphs::drawNonExistentGlyphs()
QVector<QPointF> glyphPositions;
glyphPositions.append(QPointF(0, 0));
- QGlyphs glyphs;
+ QGlyphRun glyphs;
glyphs.setGlyphIndexes(glyphIndexes);
glyphs.setPositions(glyphPositions);
- glyphs.setFont(QRawFont::fromFont(m_testFont));
+ glyphs.setRawFont(QRawFont::fromFont(m_testFont));
QPixmap image(1000, 1000);
image.fill(Qt::white);
@@ -303,7 +303,7 @@ void tst_QGlyphs::drawNonExistentGlyphs()
QPixmap imageBefore = image;
{
QPainter p(&image);
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -313,7 +313,7 @@ void tst_QGlyphs::drawNonExistentGlyphs()
QCOMPARE(image, imageBefore); // Should be unchanged
}
-void tst_QGlyphs::drawMultiScriptText1()
+void tst_QGlyphRun::drawMultiScriptText1()
{
QString text;
text += QChar(0x03D0); // Greek, beta
@@ -329,7 +329,7 @@ void tst_QGlyphs::drawMultiScriptText1()
QPixmap drawGlyphs(1000, 1000);
drawGlyphs.fill(Qt::white);
- QList<QGlyphs> glyphsList = textLayout.glyphs();
+ QList<QGlyphRun> glyphsList = textLayout.glyphRuns();
QCOMPARE(glyphsList.size(), 1);
{
@@ -339,8 +339,8 @@ void tst_QGlyphs::drawMultiScriptText1()
{
QPainter p(&drawGlyphs);
- foreach (QGlyphs glyphs, glyphsList)
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ foreach (QGlyphRun glyphs, glyphsList)
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -352,7 +352,7 @@ void tst_QGlyphs::drawMultiScriptText1()
}
-void tst_QGlyphs::drawMultiScriptText2()
+void tst_QGlyphRun::drawMultiScriptText2()
{
QString text;
text += QChar(0x0621); // Arabic, Hamza
@@ -369,7 +369,7 @@ void tst_QGlyphs::drawMultiScriptText2()
QPixmap drawGlyphs(1000, 1000);
drawGlyphs.fill(Qt::white);
- QList<QGlyphs> glyphsList = textLayout.glyphs();
+ QList<QGlyphRun> glyphsList = textLayout.glyphRuns();
QCOMPARE(glyphsList.size(), 2);
{
@@ -379,8 +379,8 @@ void tst_QGlyphs::drawMultiScriptText2()
{
QPainter p(&drawGlyphs);
- foreach (QGlyphs glyphs, glyphsList)
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ foreach (QGlyphRun glyphs, glyphsList)
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -391,13 +391,13 @@ void tst_QGlyphs::drawMultiScriptText2()
QCOMPARE(drawGlyphs, textLayoutDraw);
}
-void tst_QGlyphs::detach()
+void tst_QGlyphRun::detach()
{
- QGlyphs glyphs;
+ QGlyphRun glyphs;
glyphs.setGlyphIndexes(QVector<quint32>() << 1 << 2 << 3);
- QGlyphs otherGlyphs;
+ QGlyphRun otherGlyphs;
otherGlyphs = glyphs;
QCOMPARE(otherGlyphs.glyphIndexes(), glyphs.glyphIndexes());
@@ -408,7 +408,7 @@ void tst_QGlyphs::detach()
QCOMPARE(glyphs.glyphIndexes(), QVector<quint32>() << 1 << 2 << 3);
}
-void tst_QGlyphs::drawStruckOutText()
+void tst_QGlyphRun::drawStruckOutText()
{
QPixmap textLayoutDraw(1000, 1000);
QPixmap drawGlyphs(1000, 1000);
@@ -432,13 +432,13 @@ void tst_QGlyphs::drawStruckOutText()
layout.draw(&p, QPointF(50, 50));
}
- QGlyphs glyphs = layout.glyphs().size() > 0
- ? layout.glyphs().at(0)
- : QGlyphs();
+ QGlyphRun glyphs = layout.glyphRuns().size() > 0
+ ? layout.glyphRuns().at(0)
+ : QGlyphRun();
{
QPainter p(&drawGlyphs);
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -449,7 +449,7 @@ void tst_QGlyphs::drawStruckOutText()
QCOMPARE(textLayoutDraw, drawGlyphs);
}
-void tst_QGlyphs::drawOverlinedText()
+void tst_QGlyphRun::drawOverlinedText()
{
QPixmap textLayoutDraw(1000, 1000);
QPixmap drawGlyphs(1000, 1000);
@@ -473,13 +473,13 @@ void tst_QGlyphs::drawOverlinedText()
layout.draw(&p, QPointF(50, 50));
}
- QGlyphs glyphs = layout.glyphs().size() > 0
- ? layout.glyphs().at(0)
- : QGlyphs();
+ QGlyphRun glyphs = layout.glyphRuns().size() > 0
+ ? layout.glyphRuns().at(0)
+ : QGlyphRun();
{
QPainter p(&drawGlyphs);
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -490,7 +490,7 @@ void tst_QGlyphs::drawOverlinedText()
QCOMPARE(textLayoutDraw, drawGlyphs);
}
-void tst_QGlyphs::drawUnderlinedText()
+void tst_QGlyphRun::drawUnderlinedText()
{
QPixmap textLayoutDraw(1000, 1000);
QPixmap drawGlyphs(1000, 1000);
@@ -514,13 +514,13 @@ void tst_QGlyphs::drawUnderlinedText()
layout.draw(&p, QPointF(50, 50));
}
- QGlyphs glyphs = layout.glyphs().size() > 0
- ? layout.glyphs().at(0)
- : QGlyphs();
+ QGlyphRun glyphs = layout.glyphRuns().size() > 0
+ ? layout.glyphRuns().at(0)
+ : QGlyphRun();
{
QPainter p(&drawGlyphs);
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -531,7 +531,7 @@ void tst_QGlyphs::drawUnderlinedText()
QCOMPARE(textLayoutDraw, drawGlyphs);
}
-void tst_QGlyphs::drawRightToLeft()
+void tst_QGlyphRun::drawRightToLeft()
{
QString s;
s.append(QChar(1575));
@@ -557,13 +557,13 @@ void tst_QGlyphs::drawRightToLeft()
layout.draw(&p, QPointF(50, 50));
}
- QGlyphs glyphs = layout.glyphs().size() > 0
- ? layout.glyphs().at(0)
- : QGlyphs();
+ QGlyphRun glyphs = layout.glyphRuns().size() > 0
+ ? layout.glyphRuns().at(0)
+ : QGlyphRun();
{
QPainter p(&drawGlyphs);
- p.drawGlyphs(QPointF(50, 50), glyphs);
+ p.drawGlyphRun(QPointF(50, 50), glyphs);
}
#if defined(DEBUG_SAVE_IMAGE)
@@ -577,6 +577,6 @@ void tst_QGlyphs::drawRightToLeft()
#endif // QT_NO_RAWFONT
-QTEST_MAIN(tst_QGlyphs)
-#include "tst_qglyphs.moc"
+QTEST_MAIN(tst_QGlyphRun)
+#include "tst_qglyphrun.moc"
diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp
index f45481c..d5d9029 100644
--- a/tests/auto/qlineedit/tst_qlineedit.cpp
+++ b/tests/auto/qlineedit/tst_qlineedit.cpp
@@ -3815,7 +3815,7 @@ void tst_QLineEdit::bidiVisualMovement()
QLineEdit le;
le.setText(logical);
- le.setCursorMoveStyle(QTextCursor::Visual);
+ le.setCursorMoveStyle(Qt::VisualMoveStyle);
le.setCursorPosition(0);
bool moved;
@@ -3863,7 +3863,7 @@ void tst_QLineEdit::bidiLogicalMovement()
QLineEdit le;
le.setText(logical);
- le.setCursorMoveStyle(QTextCursor::Logical);
+ le.setCursorMoveStyle(Qt::LogicalMoveStyle);
le.setCursorPosition(0);
bool moved;
diff --git a/tests/auto/qrawfont/tst_qrawfont.cpp b/tests/auto/qrawfont/tst_qrawfont.cpp
index 4b42c74..8c58407 100644
--- a/tests/auto/qrawfont/tst_qrawfont.cpp
+++ b/tests/auto/qrawfont/tst_qrawfont.cpp
@@ -91,6 +91,9 @@ private slots:
void unsupportedWritingSystem_data();
void unsupportedWritingSystem();
+
+ void rawFontSetPixelSize_data();
+ void rawFontSetPixelSize();
#endif // QT_NO_RAWFONT
};
@@ -293,12 +296,12 @@ void tst_QRawFont::textLayout()
layout.createLine();
layout.endLayout();
- QList<QGlyphs> glyphss = layout.glyphs();
- QCOMPARE(glyphss.size(), 1);
+ QList<QGlyphRun> glyphRuns = layout.glyphRuns();
+ QCOMPARE(glyphRuns.size(), 1);
- QGlyphs glyphs = glyphss.at(0);
+ QGlyphRun glyphs = glyphRuns.at(0);
- QRawFont rawFont = glyphs.font();
+ QRawFont rawFont = glyphs.rawFont();
QVERIFY(rawFont.isValid());
QCOMPARE(rawFont.familyName(), familyName);
QCOMPARE(rawFont.pixelSize(), 18.0);
@@ -792,11 +795,11 @@ void tst_QRawFont::unsupportedWritingSystem()
layout.createLine();
layout.endLayout();
- QList<QGlyphs> glyphss = layout.glyphs();
- QCOMPARE(glyphss.size(), 1);
+ QList<QGlyphRun> glyphRuns = layout.glyphRuns();
+ QCOMPARE(glyphRuns.size(), 1);
- QGlyphs glyphs = glyphss.at(0);
- QRawFont layoutFont = glyphs.font();
+ QGlyphRun glyphs = glyphRuns.at(0);
+ QRawFont layoutFont = glyphs.rawFont();
QVERIFY(layoutFont.familyName() != QString::fromLatin1("QtBidiTestFont"));
QCOMPARE(layoutFont.pixelSize(), 12.0);
@@ -807,6 +810,39 @@ void tst_QRawFont::unsupportedWritingSystem()
fontDatabase.removeApplicationFont(id);
}
+void tst_QRawFont::rawFontSetPixelSize_data()
+{
+ QTest::addColumn<QFont::HintingPreference>("hintingPreference");
+
+ QTest::newRow("Default hinting preference") << QFont::PreferDefaultHinting;
+ QTest::newRow("No hinting preference") << QFont::PreferNoHinting;
+ QTest::newRow("Vertical hinting preference") << QFont::PreferVerticalHinting;
+ QTest::newRow("Full hinting preference") << QFont::PreferFullHinting;
+}
+
+void tst_QRawFont::rawFontSetPixelSize()
+{
+ QFETCH(QFont::HintingPreference, hintingPreference);
+
+ QTextLayout layout("Foobar");
+
+ QFont font = layout.font();
+ font.setHintingPreference(hintingPreference);
+ font.setPixelSize(12);
+ layout.setFont(font);
+
+ layout.beginLayout();
+ layout.createLine();
+ layout.endLayout();
+
+ QGlyphRun glyphs = layout.glyphRuns().at(0);
+ QRawFont rawFont = glyphs.rawFont();
+ QCOMPARE(rawFont.pixelSize(), 12.0);
+
+ rawFont.setPixelSize(24);
+ QCOMPARE(rawFont.pixelSize(), 24.0);
+}
+
#endif // QT_NO_RAWFONT
QTEST_MAIN(tst_QRawFont)
diff --git a/tests/auto/qscroller/qscroller.pro b/tests/auto/qscroller/qscroller.pro
deleted file mode 100644
index 845dcb9..0000000
--- a/tests/auto/qscroller/qscroller.pro
+++ /dev/null
@@ -1,3 +0,0 @@
-load(qttest_p4)
-
-SOURCES += tst_qscroller.cpp
diff --git a/tests/auto/qscroller/tst_qscroller.cpp b/tests/auto/qscroller/tst_qscroller.cpp
deleted file mode 100644
index a9b3d9f..0000000
--- a/tests/auto/qscroller/tst_qscroller.cpp
+++ /dev/null
@@ -1,537 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the $MODULE$ 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 Technology Preview License Agreement accompanying
-** this package.
-**
-** 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.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtGui>
-#include <QtTest>
-// #include <QDebug>
-
-class tst_QScrollerWidget : public QWidget
-{
-public:
- tst_QScrollerWidget()
- : QWidget()
- {
- reset();
- }
-
- void reset()
- {
- receivedPrepare = false;
- receivedScroll = false;
- receivedFirst = false;
- receivedLast = false;
- receivedOvershoot = false;
- }
-
- bool event(QEvent *e)
- {
- switch (e->type()) {
- case QEvent::Gesture:
- e->setAccepted(false); // better reject the event or QGestureManager will make trouble
- return false;
-
- case QEvent::ScrollPrepare:
- {
- receivedPrepare = true;
- QScrollPrepareEvent *se = static_cast<QScrollPrepareEvent *>(e);
- se->setViewportSize(QSizeF(100,100));
- se->setContentPosRange(scrollArea);
- se->setContentPos(scrollPosition);
- se->accept();
- return true;
- }
-
- case QEvent::Scroll:
- {
- receivedScroll = true;
- QScrollEvent *se = static_cast<QScrollEvent *>(e);
- // qDebug() << "Scroll for"<<this<<"pos"<<se->scrollPos()<<"ov"<<se->overshoot()<<"first"<<se->isFirst()<<"last"<<se->isLast();
-
- if (se->scrollState() == QScrollEvent::ScrollStarted)
- receivedFirst = true;
- if (se->scrollState() == QScrollEvent::ScrollFinished)
- receivedLast = true;
-
- currentPos = se->contentPos();
- overshoot = se->overshootDistance();
- if (!qFuzzyCompare( overshoot.x() + 1.0, 1.0 ) ||
- !qFuzzyCompare( overshoot.y() + 1.0, 1.0 ))
- receivedOvershoot = true;
- return true;
- }
-
- default:
- return QObject::event(e);
- }
- }
-
-
- QRectF scrollArea;
- QPointF scrollPosition;
-
- bool receivedPrepare;
- bool receivedScroll;
- bool receivedFirst;
- bool receivedLast;
- bool receivedOvershoot;
-
- QPointF currentPos;
- QPointF overshoot;
-};
-
-
-class tst_QScroller : public QObject
-{
- Q_OBJECT
-public:
- tst_QScroller() { }
- ~tst_QScroller() { }
-
-private:
- void kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint touchStart, QPoint touchUpdate, QPoint touchEnd);
- void kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from, QPoint touchStart, QPoint touchUpdate, QPoint touchEnd);
-
-private slots:
- void staticScrollers();
- void scrollerProperties();
- void scrollTo();
- void scroll();
- void overshoot();
-};
-
-/*! \internal
- Generates touchBegin, touchUpdate and touchEnd events to trigger scrolling.
- Tests some in between states but does not wait until scrolling is finished.
-*/
-void tst_QScroller::kineticScroll( tst_QScrollerWidget *sw, QPointF from, QPoint touchStart, QPoint touchUpdate, QPoint touchEnd)
-{
- sw->scrollPosition = from;
- sw->currentPos= from;
-
- QScroller *s1 = QScroller::scroller(sw);
- QCOMPARE( s1->state(), QScroller::Inactive );
-
- QScrollerProperties sp1 = QScroller::scroller(sw)->scrollerProperties();
- int fps = 60;
-
- QTouchEvent::TouchPoint rawTouchPoint;
- rawTouchPoint.setId(0);
-
- // send the touch begin event
- QTouchEvent::TouchPoint touchPoint(0);
- touchPoint.setState(Qt::TouchPointPressed);
- touchPoint.setPos(touchStart);
- touchPoint.setScenePos(touchStart);
- touchPoint.setScreenPos(touchStart);
- QTouchEvent touchEvent1(QEvent::TouchBegin,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointPressed,
- (QList<QTouchEvent::TouchPoint>() << touchPoint));
- QApplication::sendEvent(sw, &touchEvent1);
-
- QCOMPARE( s1->state(), QScroller::Pressed );
-
- // send the touch update far enough to trigger a scroll
- QTest::qWait(200); // we need to wait a little or else the speed would be infinite. now we have around 500 pixel per second.
- touchPoint.setPos(touchUpdate);
- touchPoint.setScenePos(touchUpdate);
- touchPoint.setScreenPos(touchUpdate);
- QTouchEvent touchEvent2(QEvent::TouchUpdate,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointMoved,
- (QList<QTouchEvent::TouchPoint>() << touchPoint));
- QApplication::sendEvent(sw, &touchEvent2);
-
- QCOMPARE( s1->state(), QScroller::Dragging );
- QCOMPARE( sw->receivedPrepare, true );
-
-
- QTest::qWait(1000 / fps * 2); // wait until the first scroll move
- QCOMPARE( sw->receivedFirst, true );
- QCOMPARE( sw->receivedScroll, true );
- QCOMPARE( sw->receivedOvershoot, false );
-
- // note that the scrolling goes in a different direction than the mouse move
- QPoint calculatedPos = from.toPoint() - touchUpdate - touchStart;
- QVERIFY(qAbs(sw->currentPos.x() - calculatedPos.x()) < 1.0);
- QVERIFY(qAbs(sw->currentPos.y() - calculatedPos.y()) < 1.0);
-
- // send the touch end
- touchPoint.setPos(touchEnd);
- touchPoint.setScenePos(touchEnd);
- touchPoint.setScreenPos(touchEnd);
- QTouchEvent touchEvent5(QEvent::TouchEnd,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointReleased,
- (QList<QTouchEvent::TouchPoint>() << touchPoint));
- QApplication::sendEvent(sw, &touchEvent5);
-}
-
-/*! \internal
- Generates touchBegin, touchUpdate and touchEnd events to trigger scrolling.
- This function does not have any in between tests, it does not expect the scroller to actually scroll.
-*/
-void tst_QScroller::kineticScrollNoTest( tst_QScrollerWidget *sw, QPointF from, QPoint touchStart, QPoint touchUpdate, QPoint touchEnd)
-{
- sw->scrollPosition = from;
- sw->currentPos = from;
-
- QScroller *s1 = QScroller::scroller(sw);
- QCOMPARE( s1->state(), QScroller::Inactive );
-
- QScrollerProperties sp1 = s1->scrollerProperties();
- int fps = 60;
-
- QTouchEvent::TouchPoint rawTouchPoint;
- rawTouchPoint.setId(0);
-
- // send the touch begin event
- QTouchEvent::TouchPoint touchPoint(0);
- touchPoint.setState(Qt::TouchPointPressed);
- touchPoint.setPos(touchStart);
- touchPoint.setScenePos(touchStart);
- touchPoint.setScreenPos(touchStart);
- QTouchEvent touchEvent1(QEvent::TouchBegin,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointPressed,
- (QList<QTouchEvent::TouchPoint>() << touchPoint));
- QApplication::sendEvent(sw, &touchEvent1);
-
- // send the touch update far enough to trigger a scroll
- QTest::qWait(200); // we need to wait a little or else the speed would be infinite. now we have around 500 pixel per second.
- touchPoint.setPos(touchUpdate);
- touchPoint.setScenePos(touchUpdate);
- touchPoint.setScreenPos(touchUpdate);
- QTouchEvent touchEvent2(QEvent::TouchUpdate,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointMoved,
- (QList<QTouchEvent::TouchPoint>() << touchPoint));
- QApplication::sendEvent(sw, &touchEvent2);
-
- QTest::qWait(1000 / fps * 2); // wait until the first scroll move
-
- // send the touch end
- touchPoint.setPos(touchEnd);
- touchPoint.setScenePos(touchEnd);
- touchPoint.setScreenPos(touchEnd);
- QTouchEvent touchEvent5(QEvent::TouchEnd,
- QTouchEvent::TouchScreen,
- Qt::NoModifier,
- Qt::TouchPointReleased,
- (QList<QTouchEvent::TouchPoint>() << touchPoint));
- QApplication::sendEvent(sw, &touchEvent5);
-}
-
-
-void tst_QScroller::staticScrollers()
-{
- // scrollers
- {
- QObject *o1 = new QObject(this);
- QObject *o2 = new QObject(this);
-
- // get scroller for object
- QScroller *s1 = QScroller::scroller(o1);
- QScroller *s2 = QScroller::scroller(o2);
-
- QVERIFY(s1);
- QVERIFY(s2);
- QVERIFY(s1 != s2);
-
- QVERIFY(!QScroller::scroller(static_cast<const QObject*>(0)));
- QCOMPARE(QScroller::scroller(o1), s1);
-
- delete o1;
- delete o2;
- }
-
- // the same for properties
- {
- QObject *o1 = new QObject(this);
- QObject *o2 = new QObject(this);
-
- // get scroller for object
- QScrollerProperties sp1 = QScroller::scroller(o1)->scrollerProperties();
- QScrollerProperties sp2 = QScroller::scroller(o2)->scrollerProperties();
-
- // default properties should be the same
- QVERIFY(sp1 == sp2);
-
- QCOMPARE(QScroller::scroller(o1)->scrollerProperties(), sp1);
-
- delete o1;
- delete o2;
- }
-}
-
-void tst_QScroller::scrollerProperties()
-{
- QObject *o1 = new QObject(this);
- QScrollerProperties sp1 = QScroller::scroller(o1)->scrollerProperties();
-
- QScrollerProperties::ScrollMetric metrics[] =
- {
- QScrollerProperties::MousePressEventDelay, // qreal [s]
- QScrollerProperties::DragStartDistance, // qreal [m]
- QScrollerProperties::DragVelocitySmoothingFactor, // qreal [0..1/s] (complex calculation involving time) v = v_new* DASF + v_old * (1-DASF)
- QScrollerProperties::AxisLockThreshold, // qreal [0..1] atan(|min(dx,dy)|/|max(dx,dy)|)
-
- QScrollerProperties::DecelerationFactor, // slope of the curve
-
- QScrollerProperties::MinimumVelocity, // qreal [m/s]
- QScrollerProperties::MaximumVelocity, // qreal [m/s]
- QScrollerProperties::MaximumClickThroughVelocity, // qreal [m/s]
-
- QScrollerProperties::AcceleratingFlickMaximumTime, // qreal [s]
- QScrollerProperties::AcceleratingFlickSpeedupFactor, // qreal [1..]
-
- QScrollerProperties::SnapPositionRatio, // qreal [0..1]
- QScrollerProperties::SnapTime, // qreal [s]
-
- QScrollerProperties::OvershootDragResistanceFactor, // qreal [0..1]
- QScrollerProperties::OvershootDragDistanceFactor, // qreal [0..1]
- QScrollerProperties::OvershootScrollDistanceFactor, // qreal [0..1]
- QScrollerProperties::OvershootScrollTime, // qreal [s]
- };
-
- for (unsigned int i = 0; i < sizeof(metrics) / sizeof(metrics[0]); i++) {
- sp1.setScrollMetric(metrics[i], 0.9);
- QCOMPARE(sp1.scrollMetric(metrics[i]).toDouble(), 0.9);
- }
- sp1.setScrollMetric(QScrollerProperties::ScrollingCurve, QEasingCurve(QEasingCurve::OutQuart));
- QCOMPARE(sp1.scrollMetric(QScrollerProperties::ScrollingCurve).toEasingCurve().type(), QEasingCurve::OutQuart);
-
- sp1.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootAlwaysOff));
- QCOMPARE(sp1.scrollMetric(QScrollerProperties::HorizontalOvershootPolicy).value<QScrollerProperties::OvershootPolicy>(), QScrollerProperties::OvershootAlwaysOff);
-
- sp1.setScrollMetric(QScrollerProperties::VerticalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootAlwaysOn));
- QCOMPARE(sp1.scrollMetric(QScrollerProperties::VerticalOvershootPolicy).value<QScrollerProperties::OvershootPolicy>(), QScrollerProperties::OvershootAlwaysOn);
-
- sp1.setScrollMetric(QScrollerProperties::FrameRate, QVariant::fromValue(QScrollerProperties::Fps20));
- QCOMPARE(sp1.scrollMetric(QScrollerProperties::FrameRate).value<QScrollerProperties::FrameRates>(), QScrollerProperties::Fps20);
-}
-
-void tst_QScroller::scrollTo()
-{
- {
- tst_QScrollerWidget *sw = new tst_QScrollerWidget();
- sw->scrollArea = QRectF( 0, 0, 1000, 1000 );
- sw->scrollPosition = QPointF( 500, 500 );
-
- QScroller *s1 = QScroller::scroller(sw);
- QCOMPARE( s1->state(), QScroller::Inactive );
-
- // a normal scroll
- s1->scrollTo(QPointF(100,100), 100);
- QTest::qWait(200);
-
- QCOMPARE( sw->receivedPrepare, true );
- QCOMPARE( sw->receivedScroll, true );
- QCOMPARE( sw->receivedFirst, true );
- QCOMPARE( sw->receivedLast, true );
- QCOMPARE( sw->receivedOvershoot, false );
- QVERIFY(qFuzzyCompare( sw->currentPos.x(), 100 ));
- QVERIFY(qFuzzyCompare( sw->currentPos.y(), 100 ));
-
- delete sw;
- }
-}
-
-void tst_QScroller::scroll()
-{
-#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
- QSKIP("Mac OS X < 10.6 does not support QTouchEvents", SkipAll);
- return;
-#endif
-
-#ifndef QT_NO_GESTURES
- // -- good case. normal scroll
- tst_QScrollerWidget *sw = new tst_QScrollerWidget();
- sw->scrollArea = QRectF(0, 0, 1000, 1000);
- QScroller::grabGesture(sw, QScroller::TouchGesture);
- sw->setGeometry(100, 100, 400, 300);
-
- QScroller *s1 = QScroller::scroller(sw);
- kineticScroll(sw, QPointF(500, 500), QPoint(0, 0), QPoint(100, 100), QPoint(200, 200));
- // now we should be scrolling
- QCOMPARE( s1->state(), QScroller::Scrolling );
-
- // wait until finished, check that no further first scroll is send
- sw->receivedFirst = false;
- sw->receivedScroll = false;
- while (s1->state() == QScroller::Scrolling)
- QTest::qWait(100);
-
- QCOMPARE( sw->receivedFirst, false );
- QCOMPARE( sw->receivedScroll, true );
- QCOMPARE( sw->receivedLast, true );
- QVERIFY(sw->currentPos.x() < 400);
- QVERIFY(sw->currentPos.y() < 400);
-
- // -- try to scroll when nothing to scroll
-
- sw->reset();
- sw->scrollArea = QRectF(0, 0, 0, 1000);
- kineticScrollNoTest(sw, QPointF(0, 500), QPoint(0, 0), QPoint(100, 0), QPoint(200, 0));
-
- while (s1->state() != QScroller::Inactive)
- QTest::qWait(20);
-
- QCOMPARE(sw->currentPos.x(), 0.0);
- QCOMPARE(sw->currentPos.y(), 500.0);
-
- delete sw;
-#endif
-}
-
-void tst_QScroller::overshoot()
-{
-#if defined(Q_OS_MACX) && (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6)
- QSKIP("Mac OS X < 10.6 does not support QTouchEvents", SkipAll);
- return;
-#endif
-
-#ifndef QT_NO_GESTURES
- tst_QScrollerWidget *sw = new tst_QScrollerWidget();
- sw->scrollArea = QRectF(0, 0, 1000, 1000);
- QScroller::grabGesture(sw, QScroller::TouchGesture);
- sw->setGeometry(100, 100, 400, 300);
-
- QScroller *s1 = QScroller::scroller(sw);
- QScrollerProperties sp1 = s1->scrollerProperties();
-
- sp1.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, 0.5);
- sp1.setScrollMetric(QScrollerProperties::OvershootDragDistanceFactor, 0.2);
- sp1.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0.2);
-
- // -- try to scroll with overshoot (when scrollable good case)
-
- sp1.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootWhenScrollable));
- s1->setScrollerProperties(sp1);
- kineticScrollNoTest(sw, QPointF(500, 500), QPoint(0, 0), QPoint(400, 0), QPoint(490, 0));
-
- while (s1->state() != QScroller::Inactive)
- QTest::qWait(20);
-
- //qDebug() << "Overshoot fuzzy: "<<sw->currentPos;
- QVERIFY(qFuzzyCompare( sw->currentPos.x(), 0 ));
- QVERIFY(qFuzzyCompare( sw->currentPos.y(), 500 ));
- QCOMPARE( sw->receivedOvershoot, true );
-
- // -- try to scroll with overshoot (when scrollable bad case)
- sw->reset();
- sw->scrollArea = QRectF(0, 0, 0, 1000);
-
- sp1.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootWhenScrollable));
- s1->setScrollerProperties(sp1);
- kineticScrollNoTest(sw, QPointF(0, 500), QPoint(0, 0), QPoint(400, 0), QPoint(490, 0));
-
- while (s1->state() != QScroller::Inactive)
- QTest::qWait(20);
-
- //qDebug() << "Overshoot fuzzy: "<<sw->currentPos;
- QVERIFY(qFuzzyCompare( sw->currentPos.x(), 0 ));
- QVERIFY(qFuzzyCompare( sw->currentPos.y(), 500 ));
- QCOMPARE( sw->receivedOvershoot, false );
-
- // -- try to scroll with overshoot (always on)
- sw->reset();
- sw->scrollArea = QRectF(0, 0, 0, 1000);
-
- sp1.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootAlwaysOn));
- s1->setScrollerProperties(sp1);
- kineticScrollNoTest(sw, QPointF(0, 500), QPoint(0, 0), QPoint(400, 0), QPoint(490, 0));
-
- while (s1->state() != QScroller::Inactive)
- QTest::qWait(20);
-
- //qDebug() << "Overshoot fuzzy: "<<sw->currentPos;
-
- QVERIFY(qFuzzyCompare( sw->currentPos.x(), 0 ));
- QVERIFY(qFuzzyCompare( sw->currentPos.y(), 500 ));
- QCOMPARE( sw->receivedOvershoot, true );
-
- // -- try to scroll with overshoot (always off)
- sw->reset();
- sw->scrollArea = QRectF(0, 0, 1000, 1000);
-
- sp1.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootAlwaysOff));
- s1->setScrollerProperties(sp1);
- kineticScrollNoTest(sw, QPointF(500, 500), QPoint(0, 0), QPoint(400, 0), QPoint(490, 0));
-
- while (s1->state() != QScroller::Inactive)
- QTest::qWait(20);
-
- QVERIFY(qFuzzyCompare( sw->currentPos.x(), 0 ));
- QVERIFY(qFuzzyCompare( sw->currentPos.y(), 500 ));
- QCOMPARE( sw->receivedOvershoot, false );
-
- // -- try to scroll with overshoot (always on but max overshoot = 0)
- sp1.setScrollMetric(QScrollerProperties::OvershootDragDistanceFactor, 0.0);
- sp1.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, 0.0);
- sw->reset();
- sw->scrollArea = QRectF(0, 0, 1000, 1000);
-
- sp1.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootAlwaysOn));
- s1->setScrollerProperties(sp1);
- kineticScrollNoTest(sw, QPointF(500, 500), QPoint(0, 0), QPoint(400, 0), QPoint(490, 0));
-
- while (s1->state() != QScroller::Inactive)
- QTest::qWait(20);
-
- QVERIFY(qFuzzyCompare( sw->currentPos.x(), 0 ));
- QVERIFY(qFuzzyCompare( sw->currentPos.y(), 500 ));
- QCOMPARE( sw->receivedOvershoot, false );
-
-
- delete sw;
-#endif
-}
-
-
-QTEST_MAIN(tst_QScroller)
-
-#include "tst_qscroller.moc"
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 507af5e..9badd0b 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -156,6 +156,7 @@ private slots:
void setSslConfiguration_data();
void setSslConfiguration();
void waitForEncrypted();
+ void waitForEncryptedMinusOne();
void waitForConnectedEncryptedReadyRead();
void startClientEncryption();
void startServerEncryption();
@@ -1098,6 +1099,20 @@ void tst_QSslSocket::waitForEncrypted()
QVERIFY(socket->waitForEncrypted(10000));
}
+void tst_QSslSocket::waitForEncryptedMinusOne()
+{
+ if (!QSslSocket::supportsSsl())
+ return;
+
+ QSslSocketPtr socket = newSocket();
+ this->socket = socket;
+
+ connect(socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(ignoreErrorSlot()));
+ socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443);
+
+ QVERIFY(socket->waitForEncrypted(-1));
+}
+
void tst_QSslSocket::waitForConnectedEncryptedReadyRead()
{
if (!QSslSocket::supportsSsl())
diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
index f83c4cf..d19475f 100644
--- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
+++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp
@@ -166,7 +166,9 @@ private slots:
void readLineString();
void readChunks();
void waitForBytesWritten();
+ void waitForBytesWrittenMinusOne();
void waitForReadyRead();
+ void waitForReadyReadMinusOne();
void flush();
void synchronousApi();
void dontCloseOnTimeout();
@@ -1417,10 +1419,10 @@ void tst_QTcpSocket::readChunks()
void tst_QTcpSocket::waitForBytesWritten()
{
QTcpSocket *socket = newSocket();
- socket->connectToHost(QtNetworkSettings::serverName(), 22);
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
QVERIFY(socket->waitForConnected(10000));
- socket->write(QByteArray(10000, '@'));
+ socket->write("GET / HTTP/1.0\r\n\r\n");
qint64 toWrite = socket->bytesToWrite();
QVERIFY(socket->waitForBytesWritten(5000));
QVERIFY(toWrite > socket->bytesToWrite());
@@ -1429,11 +1431,37 @@ void tst_QTcpSocket::waitForBytesWritten()
}
//----------------------------------------------------------------------------------
+void tst_QTcpSocket::waitForBytesWrittenMinusOne()
+{
+ QTcpSocket *socket = newSocket();
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
+ QVERIFY(socket->waitForConnected(10000));
+
+ socket->write("GET / HTTP/1.0\r\n\r\n");
+ qint64 toWrite = socket->bytesToWrite();
+ QVERIFY(socket->waitForBytesWritten(-1));
+ QVERIFY(toWrite > socket->bytesToWrite());
+
+ delete socket;
+}
+
+//----------------------------------------------------------------------------------
void tst_QTcpSocket::waitForReadyRead()
{
QTcpSocket *socket = newSocket();
- socket->connectToHost(QtNetworkSettings::serverName(), 22);
- socket->waitForReadyRead(0);
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
+ socket->write("GET / HTTP/1.0\r\n\r\n");
+ QVERIFY(socket->waitForReadyRead(5000));
+ delete socket;
+}
+
+//----------------------------------------------------------------------------------
+void tst_QTcpSocket::waitForReadyReadMinusOne()
+{
+ QTcpSocket *socket = newSocket();
+ socket->connectToHost(QtNetworkSettings::serverName(), 80);
+ socket->write("GET / HTTP/1.0\r\n\r\n");
+ QVERIFY(socket->waitForReadyRead(-1));
delete socket;
}
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 6675c99..7aa6578 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -180,6 +180,8 @@ private slots:
void escape_data();
void escape();
+ void copiedFontSize();
+
private:
void backgroundImage_checkExpectedHtml(const QTextDocument &doc);
@@ -2734,5 +2736,29 @@ void tst_QTextDocument::escape()
QCOMPARE(Qt::escape(original), expected);
}
+void tst_QTextDocument::copiedFontSize()
+{
+ QTextDocument documentInput;
+ QTextDocument documentOutput;
+
+ QFont fontInput;
+ fontInput.setPixelSize(24);
+
+ QTextCursor cursorInput(&documentInput);
+ QTextCharFormat formatInput = cursorInput.charFormat();
+ formatInput.setFont(fontInput);
+ cursorInput.insertText("Should be the same font", formatInput);
+ cursorInput.select(QTextCursor::Document);
+
+ QTextDocumentFragment fragmentInput(cursorInput);
+ QString html = fragmentInput.toHtml();
+
+ QTextCursor cursorOutput(&documentOutput);
+ QTextDocumentFragment fragmentOutput = QTextDocumentFragment::fromHtml(html);
+ cursorOutput.insertFragment(fragmentOutput);
+
+ QCOMPARE(cursorOutput.charFormat().font().pixelSize(), 24);
+}
+
QTEST_MAIN(tst_QTextDocument)
#include "tst_qtextdocument.moc"
diff --git a/tests/auto/qtextedit/tst_qtextedit.cpp b/tests/auto/qtextedit/tst_qtextedit.cpp
index 41af7bf..6b9a541 100644
--- a/tests/auto/qtextedit/tst_qtextedit.cpp
+++ b/tests/auto/qtextedit/tst_qtextedit.cpp
@@ -2292,7 +2292,7 @@ void tst_QTextEdit::bidiVisualMovement()
option.setTextDirection(basicDir == QChar::DirL ? Qt::LeftToRight : Qt::RightToLeft);
ed->document()->setDefaultTextOption(option);
- ed->document()->setDefaultCursorMoveStyle(QTextCursor::Visual);
+ ed->document()->setDefaultCursorMoveStyle(Qt::VisualMoveStyle);
ed->moveCursor(QTextCursor::Start);
ed->show();
@@ -2346,7 +2346,7 @@ void tst_QTextEdit::bidiLogicalMovement()
option.setTextDirection(basicDir == QChar::DirL ? Qt::LeftToRight : Qt::RightToLeft);
ed->document()->setDefaultTextOption(option);
- ed->document()->setDefaultCursorMoveStyle(QTextCursor::Logical);
+ ed->document()->setDefaultCursorMoveStyle(Qt::LogicalMoveStyle);
ed->moveCursor(QTextCursor::Start);
ed->show();
diff --git a/tests/auto/qvariant/tst_qvariant.cpp b/tests/auto/qvariant/tst_qvariant.cpp
index af70c9e..492d0df 100644
--- a/tests/auto/qvariant/tst_qvariant.cpp
+++ b/tests/auto/qvariant/tst_qvariant.cpp
@@ -2650,7 +2650,6 @@ void tst_QVariant::invalidAsByteArray()
void tst_QVariant::invalidQColor() const
{
QVariant va("An invalid QColor::name() value.");
- QTest::ignoreMessage(QtWarningMsg, "QColor::setNamedColor: Unknown color name 'An invalid QColor::name() value.'");
QVERIFY(va.canConvert(QVariant::Color));
QVERIFY(!va.convert(QVariant::Color));
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index e8d9719..f33bdbb 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -4738,7 +4738,8 @@ void tst_QWidget::update()
QCOMPARE(w.visibleRegion(), expectedVisible);
QCOMPARE(w.paintedRegion, expectedVisible);
#ifdef QT_MAC_USE_COCOA
- QEXPECT_FAIL(0, "Cocoa compositor says to paint this.", Continue);
+ if (QApplicationPrivate::graphics_system_name != QLatin1String("raster"))
+ QEXPECT_FAIL(0, "Cocoa compositor says to paint this.", Continue);
#endif
QCOMPARE(child.numPaintEvents, 0);
@@ -6336,11 +6337,15 @@ void tst_QWidget::compatibilityChildInsertedEvents()
expected =
EventRecorder::EventList()
<< qMakePair(&widget, QEvent::PolishRequest)
- << qMakePair(&widget, QEvent::Type(QEvent::User + 1))
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA)
- << qMakePair(&widget, QEvent::UpdateRequest)
-#endif
- ;
+ << qMakePair(&widget, QEvent::Type(QEvent::User + 1));
+
+#ifndef QT_MAC_USE_CARBON
+#ifdef QT_MAC_USE_COCOA
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
+#endif // QT_MAC_USE_COCOA
+ expected << qMakePair(&widget, QEvent::UpdateRequest);
+#endif // !QT_MAC_USE_CARBON
+
QCOMPARE(spy.eventList(), expected);
}
@@ -6432,11 +6437,15 @@ void tst_QWidget::compatibilityChildInsertedEvents()
#endif
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
- << qMakePair(&widget, QEvent::Type(QEvent::User + 2))
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA)
- << qMakePair(&widget, QEvent::UpdateRequest)
-#endif
- ;
+ << qMakePair(&widget, QEvent::Type(QEvent::User + 2));
+
+#ifndef QT_MAC_USE_CARBON
+#ifdef QT_MAC_USE_COCOA
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
+#endif // QT_MAC_USE_COCOA
+ expected << qMakePair(&widget, QEvent::UpdateRequest);
+#endif // !QT_MAC_USE_CARBON
+
QCOMPARE(spy.eventList(), expected);
}
@@ -6528,11 +6537,15 @@ void tst_QWidget::compatibilityChildInsertedEvents()
#endif
<< qMakePair(&widget, QEvent::PolishRequest)
<< qMakePair(&widget, QEvent::Type(QEvent::User + 1))
- << qMakePair(&widget, QEvent::Type(QEvent::User + 2))
-#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_WS_QWS) || defined(Q_WS_S60) || defined(Q_WS_QPA)
- << qMakePair(&widget, QEvent::UpdateRequest)
-#endif
- ;
+ << qMakePair(&widget, QEvent::Type(QEvent::User + 2));
+
+#ifndef QT_MAC_USE_CARBON
+#ifdef QT_MAC_USE_COCOA
+ if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
+#endif // QT_MAC_USE_COCOA
+ expected << qMakePair(&widget, QEvent::UpdateRequest);
+#endif // !QT_MAC_USE_CARBON
+
QCOMPARE(spy.eventList(), expected);
}
}