tests/auto/gui: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).
- Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Change-Id: I624deb320c378c18a29b3707f48583d53bfd5186 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
This commit is contained in:
parent
7b6be75796
commit
3859b304e8
@ -348,10 +348,10 @@ void tst_QIcon::cacheKey()
|
||||
qint64 icon1_key = icon1.cacheKey();
|
||||
QIcon icon2 = icon1;
|
||||
|
||||
QVERIFY(icon2.cacheKey() == icon1.cacheKey());
|
||||
QCOMPARE(icon2.cacheKey(), icon1.cacheKey());
|
||||
icon2.detach();
|
||||
QVERIFY(icon2.cacheKey() != icon1.cacheKey());
|
||||
QVERIFY(icon1.cacheKey() == icon1_key);
|
||||
QCOMPARE(icon1.cacheKey(), icon1_key);
|
||||
}
|
||||
|
||||
void tst_QIcon::detach()
|
||||
@ -368,7 +368,7 @@ void tst_QIcon::detach()
|
||||
|
||||
img1 = icon1.pixmap(32, 32).toImage();
|
||||
img2 = icon2.pixmap(32, 32).toImage();
|
||||
QVERIFY(img1 == img2);
|
||||
QCOMPARE(img1, img2);
|
||||
}
|
||||
|
||||
void tst_QIcon::addFile()
|
||||
@ -556,7 +556,7 @@ void tst_QIcon::fromTheme()
|
||||
QString firstSearchPath = QLatin1String(":/icons");
|
||||
QString secondSearchPath = QLatin1String(":/second_icons");
|
||||
QIcon::setThemeSearchPaths(QStringList() << firstSearchPath << secondSearchPath);
|
||||
QVERIFY(QIcon::themeSearchPaths().size() == 2);
|
||||
QCOMPARE(QIcon::themeSearchPaths().size(), 2);
|
||||
QCOMPARE(firstSearchPath, QIcon::themeSearchPaths()[0]);
|
||||
QCOMPARE(secondSearchPath, QIcon::themeSearchPaths()[1]);
|
||||
|
||||
@ -593,7 +593,7 @@ void tst_QIcon::fromTheme()
|
||||
|
||||
// Test non existing icon with fallback
|
||||
noIcon = QIcon::fromTheme("broken-icon", abIcon);
|
||||
QVERIFY(noIcon.cacheKey() == abIcon.cacheKey());
|
||||
QCOMPARE(noIcon.cacheKey(), abIcon.cacheKey());
|
||||
|
||||
// Test svg-only icon
|
||||
noIcon = QIcon::fromTheme("svg-icon", abIcon);
|
||||
|
@ -477,7 +477,7 @@ void tst_QImage::setAlphaChannel()
|
||||
|
||||
image.setAlphaChannel(alphaChannel);
|
||||
image = image.convertToFormat(QImage::Format_ARGB32);
|
||||
QVERIFY(image.format() == QImage::Format_ARGB32);
|
||||
QCOMPARE(image.format(), QImage::Format_ARGB32);
|
||||
|
||||
// alpha of 0 becomes black at a=0 due to premultiplication
|
||||
QRgb pixel = alpha == 0 ? 0 : qRgba(red, green, blue, alpha);
|
||||
@ -1564,12 +1564,12 @@ void tst_QImage::createHeuristicMask()
|
||||
|
||||
// line 2
|
||||
QVERIFY(newMask.pixel(0,1) != newMask.pixel(1,1));
|
||||
QVERIFY(newMask.pixel(1,1) == newMask.pixel(2,1));
|
||||
QCOMPARE(newMask.pixel(1,1), newMask.pixel(2,1));
|
||||
QVERIFY(newMask.pixel(2,1) != newMask.pixel(3,1));
|
||||
|
||||
// line 3
|
||||
QVERIFY(newMask.pixel(0,2) != newMask.pixel(1,2));
|
||||
QVERIFY(newMask.pixel(1,2) == newMask.pixel(2,2));
|
||||
QCOMPARE(newMask.pixel(1,2), newMask.pixel(2,2));
|
||||
QVERIFY(newMask.pixel(2,2) != newMask.pixel(3,2));
|
||||
}
|
||||
#endif
|
||||
@ -1580,10 +1580,10 @@ void tst_QImage::cacheKey()
|
||||
qint64 image1_key = image1.cacheKey();
|
||||
QImage image2 = image1;
|
||||
|
||||
QVERIFY(image2.cacheKey() == image1.cacheKey());
|
||||
QCOMPARE(image2.cacheKey(), image1.cacheKey());
|
||||
image2.detach();
|
||||
QVERIFY(image2.cacheKey() != image1.cacheKey());
|
||||
QVERIFY(image1.cacheKey() == image1_key);
|
||||
QCOMPARE(image1.cacheKey(), image1_key);
|
||||
}
|
||||
|
||||
void tst_QImage::smoothScale()
|
||||
|
@ -733,7 +733,7 @@ void tst_QImageReader::gifHandlerBugs()
|
||||
QVERIFY(io.loopCount() != 1);
|
||||
int count=0;
|
||||
for (; io.canRead(); io.read(), ++count) ;
|
||||
QVERIFY(count == 34);
|
||||
QCOMPARE(count, 34);
|
||||
}
|
||||
|
||||
// Task 95166
|
||||
@ -810,7 +810,7 @@ void tst_QImageReader::gifImageCount()
|
||||
QVERIFY(io.canRead());
|
||||
QImage greenFrame = io.read();
|
||||
|
||||
QVERIFY(io.imageCount() == 4);
|
||||
QCOMPARE(io.imageCount(), 4);
|
||||
|
||||
QVERIFY(io.canRead());
|
||||
QImage blueFrame = io.read();
|
||||
@ -925,8 +925,8 @@ void tst_QImageReader::gifImageCount()
|
||||
}
|
||||
{
|
||||
QImageReader io(":images/trolltech.gif");
|
||||
QVERIFY(io.imageCount() == 34);
|
||||
QVERIFY(io.size() == QSize(128,64));
|
||||
QCOMPARE(io.imageCount(), 34);
|
||||
QCOMPARE(io.size(), QSize(128,64));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ void tst_QMovie::jumpToFrame()
|
||||
movie.start();
|
||||
movie.stop();
|
||||
QVERIFY(!movie.jumpToFrame(-1));
|
||||
QVERIFY(movie.currentFrameNumber() == 0);
|
||||
QCOMPARE(movie.currentFrameNumber(), 0);
|
||||
}
|
||||
|
||||
void tst_QMovie::changeMovieFile()
|
||||
@ -198,7 +198,7 @@ void tst_QMovie::changeMovieFile()
|
||||
movie.start();
|
||||
movie.stop();
|
||||
movie.setFileName(QFINDTESTDATA("animations/trolltech.gif"));
|
||||
QVERIFY(movie.currentFrameNumber() == -1);
|
||||
QCOMPARE(movie.currentFrameNumber(), -1);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_WIDGETS
|
||||
|
@ -447,7 +447,7 @@ void tst_QPixmap::scroll()
|
||||
|
||||
QString fileName = QString(":/images/%1.png").arg(QTest::currentDataTag());
|
||||
QPixmap output(fileName);
|
||||
QVERIFY(input.isNull() == output.isNull());
|
||||
QCOMPARE(input.isNull(), output.isNull());
|
||||
QVERIFY(lenientCompare(pixmap, output));
|
||||
QCOMPARE(exp, exposed);
|
||||
}
|
||||
@ -713,11 +713,11 @@ void tst_QPixmap::cacheKey()
|
||||
QVERIFY(pixmap1.cacheKey() != pixmap2.cacheKey());
|
||||
|
||||
pixmap2 = pixmap1;
|
||||
QVERIFY(pixmap2.cacheKey() == pixmap1.cacheKey());
|
||||
QCOMPARE(pixmap2.cacheKey(), pixmap1.cacheKey());
|
||||
|
||||
pixmap2.detach();
|
||||
QVERIFY(pixmap2.cacheKey() != pixmap1.cacheKey());
|
||||
QVERIFY(pixmap1.cacheKey() == pixmap1_key);
|
||||
QCOMPARE(pixmap1.cacheKey(), pixmap1_key);
|
||||
}
|
||||
|
||||
// Test drawing a bitmap on a pixmap.
|
||||
@ -783,11 +783,11 @@ void tst_QPixmap::convertFromImageNoDetach()
|
||||
QPixmap pix = QPixmap::fromImage(orig);
|
||||
QImage copy = pix.toImage();
|
||||
|
||||
QVERIFY(copy.format() == screenFormat);
|
||||
QCOMPARE(copy.format(), screenFormat);
|
||||
|
||||
const QImage constOrig = orig;
|
||||
const QImage constCopy = copy;
|
||||
QVERIFY(constOrig.bits() == constCopy.bits());
|
||||
QCOMPARE(constOrig.bits(), constCopy.bits());
|
||||
}
|
||||
|
||||
void tst_QPixmap::convertFromImageDetach()
|
||||
@ -821,7 +821,7 @@ void tst_QPixmap::convertFromImageCacheKey()
|
||||
QPixmap pix = QPixmap::fromImage(orig);
|
||||
QImage copy = pix.toImage();
|
||||
|
||||
QVERIFY(copy.format() == screenFormat);
|
||||
QCOMPARE(copy.format(), screenFormat);
|
||||
|
||||
QCOMPARE(orig.cacheKey(), pix.cacheKey());
|
||||
QCOMPARE(copy.cacheKey(), pix.cacheKey());
|
||||
@ -1135,9 +1135,9 @@ void tst_QPixmap::copy()
|
||||
void tst_QPixmap::depthOfNullObjects()
|
||||
{
|
||||
QBitmap b1;
|
||||
QVERIFY(b1.depth() == 0);
|
||||
QCOMPARE(b1.depth(), 0);
|
||||
QPixmap p4;
|
||||
QVERIFY(p4.depth() == 0);
|
||||
QCOMPARE(p4.depth(), 0);
|
||||
}
|
||||
|
||||
void tst_QPixmap::transformed()
|
||||
@ -1437,7 +1437,7 @@ void tst_QPixmap::task_246446()
|
||||
{
|
||||
QPixmap pm2(pm);
|
||||
}
|
||||
QVERIFY(pm.width() == 10);
|
||||
QCOMPARE(pm.width(), 10);
|
||||
QVERIFY(pm.mask().isNull());
|
||||
}
|
||||
|
||||
@ -1490,14 +1490,14 @@ void tst_QPixmap::loadAsBitmapOrPixmap()
|
||||
// The do the same check for bitmaps..
|
||||
QBitmap bitmap("temp_image.png");
|
||||
QVERIFY(!bitmap.isNull());
|
||||
QVERIFY(bitmap.depth() == 1);
|
||||
QCOMPARE(bitmap.depth(), 1);
|
||||
QVERIFY(bitmap.isQBitmap());
|
||||
|
||||
bitmap = QBitmap();
|
||||
ok = bitmap.load("temp_image.png");
|
||||
QVERIFY(ok);
|
||||
QVERIFY(!bitmap.isNull());
|
||||
QVERIFY(bitmap.depth() == 1);
|
||||
QCOMPARE(bitmap.depth(), 1);
|
||||
QVERIFY(bitmap.isQBitmap());
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ void tst_QPixmapCache::setCacheLimit()
|
||||
delete p1;
|
||||
|
||||
QPixmapCache::setCacheLimit(0);
|
||||
QVERIFY(QPixmapCache::find("P1") == 0);
|
||||
QVERIFY(!QPixmapCache::find("P1"));
|
||||
|
||||
p1 = new QPixmap(2, 3);
|
||||
QPixmapCache::setCacheLimit(1000);
|
||||
@ -346,12 +346,12 @@ void tst_QPixmapCache::remove()
|
||||
QVERIFY(p1.toImage() == p1.toImage()); // sanity check
|
||||
|
||||
QPixmapCache::remove("red");
|
||||
QVERIFY(QPixmapCache::find("red") == 0);
|
||||
QVERIFY(!QPixmapCache::find("red"));
|
||||
QPixmapCache::remove("red");
|
||||
QVERIFY(QPixmapCache::find("red") == 0);
|
||||
QVERIFY(!QPixmapCache::find("red"));
|
||||
|
||||
QPixmapCache::remove("green");
|
||||
QVERIFY(QPixmapCache::find("green") == 0);
|
||||
QVERIFY(!QPixmapCache::find("green"));
|
||||
|
||||
//The int part of the API
|
||||
QPixmapCache::clear();
|
||||
@ -424,7 +424,7 @@ void tst_QPixmapCache::clear()
|
||||
QPixmapCache::clear();
|
||||
|
||||
for (int k = 0; k < numberOfKeys; ++k)
|
||||
QVERIFY(QPixmapCache::find(QString::number(k)) == 0);
|
||||
QVERIFY(!QPixmapCache::find(QString::number(k)));
|
||||
|
||||
//The int part of the API
|
||||
QPixmap p2(10, 10);
|
||||
|
@ -912,7 +912,7 @@ void tst_QGuiApplication::genericPluginsAndWindowSystemEvents()
|
||||
QGuiApplication app(argc, argv);
|
||||
|
||||
QVERIFY(QGuiApplication::primaryScreen());
|
||||
QVERIFY(QGuiApplication::primaryScreen()->orientation() == testOrientationToSend);
|
||||
QCOMPARE(QGuiApplication::primaryScreen()->orientation(), testOrientationToSend);
|
||||
|
||||
QCOMPARE(testReceiver.customEvents, 0);
|
||||
QCoreApplication::sendPostedEvents(&testReceiver);
|
||||
|
@ -56,7 +56,7 @@ void tst_QGuiVariantNoApplication::variantWithoutApplication()
|
||||
{
|
||||
QVariant v = QString("red");
|
||||
|
||||
QVERIFY(qvariant_cast<QColor>(v) == QColor(Qt::red));
|
||||
QCOMPARE(qvariant_cast<QColor>(v), QColor(Qt::red));
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,13 +140,13 @@ void tst_QGuiVariant::constructor_invalid()
|
||||
QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:"));
|
||||
QVariant variant(static_cast<QVariant::Type>(typeId));
|
||||
QVERIFY(!variant.isValid());
|
||||
QVERIFY(variant.userType() == QMetaType::UnknownType);
|
||||
QCOMPARE(variant.userType(), int(QMetaType::UnknownType));
|
||||
}
|
||||
{
|
||||
QTest::ignoreMessage(QtWarningMsg, QRegularExpression("^Trying to construct an instance of an invalid type, type id:"));
|
||||
QVariant variant(typeId, /* copy */ 0);
|
||||
QVERIFY(!variant.isValid());
|
||||
QVERIFY(variant.userType() == QMetaType::UnknownType);
|
||||
QCOMPARE(variant.userType(), int(QMetaType::UnknownType));
|
||||
}
|
||||
}
|
||||
|
||||
@ -611,9 +611,9 @@ void tst_QGuiVariant::writeToReadFromDataStream()
|
||||
// the uninitialized float can be NaN (observed on Windows Mobile 5 ARMv4i)
|
||||
float readFloat = qvariant_cast<float>(readVariant);
|
||||
float writtenFloat = qvariant_cast<float>(writeVariant);
|
||||
QVERIFY(qIsNaN(readFloat) == qIsNaN(writtenFloat));
|
||||
QCOMPARE(qIsNaN(readFloat), qIsNaN(writtenFloat));
|
||||
if (!qIsNaN(readFloat))
|
||||
QVERIFY(readFloat == writtenFloat);
|
||||
QCOMPARE(readFloat, writtenFloat);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -632,7 +632,7 @@ void tst_QGuiVariant::writeToReadFromOldDataStream()
|
||||
dataFileStream.setVersion(QDataStream::Qt_4_9);
|
||||
QVariant readVariant;
|
||||
dataFileStream >> readVariant;
|
||||
QVERIFY(readVariant.userType() == QMetaType::QPolygonF);
|
||||
QCOMPARE(readVariant.userType(), int(QMetaType::QPolygonF));
|
||||
QCOMPARE(testVariant, readVariant);
|
||||
file.close();
|
||||
}
|
||||
@ -656,7 +656,7 @@ void tst_QGuiVariant::writeToReadFromOldDataStream()
|
||||
QDataStream readVarData(variantData);
|
||||
readVarData >> dummy;
|
||||
readVarData >> polyData50;
|
||||
QVERIFY(polyData49 == polyData50);
|
||||
QCOMPARE(polyData49, polyData50);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ public:
|
||||
|
||||
GLuint fbo = 0xFFFF;
|
||||
QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *) &fbo);
|
||||
QVERIFY(fbo == 0);
|
||||
QCOMPARE(fbo, GLuint(0));
|
||||
}
|
||||
|
||||
void paintGL() Q_DECL_OVERRIDE {
|
||||
@ -272,7 +272,7 @@ public:
|
||||
|
||||
GLuint fbo = 0xFFFF;
|
||||
QOpenGLContext::currentContext()->functions()->glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint *) &fbo);
|
||||
QVERIFY(fbo == 0);
|
||||
QCOMPARE(fbo, GLuint(0));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -53,7 +53,7 @@ void tst_QPixelFormat::testOperators()
|
||||
{
|
||||
QPixelFormat first = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QPixelFormat second = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtBeginning, QPixelFormat::Premultiplied);
|
||||
QVERIFY(first == second);
|
||||
QCOMPARE(first, second);
|
||||
|
||||
QPixelFormat third = qPixelFormatRgba(8,8,8,8,QPixelFormat::UsesAlpha, QPixelFormat::AtEnd, QPixelFormat::NotPremultiplied);
|
||||
QVERIFY(first != third);
|
||||
|
@ -437,14 +437,14 @@ void tst_QWindow::platformSurface()
|
||||
QCOMPARE(window.geometry(), geometry);
|
||||
window.create();
|
||||
|
||||
QTRY_VERIFY(window.received(QEvent::PlatformSurface) == 1);
|
||||
QTRY_VERIFY(window.surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated);
|
||||
QTRY_COMPARE(window.received(QEvent::PlatformSurface), 1);
|
||||
QTRY_COMPARE(window.surfaceEventType(), QPlatformSurfaceEvent::SurfaceCreated);
|
||||
QTRY_VERIFY(window.handle() != Q_NULLPTR);
|
||||
|
||||
window.destroy();
|
||||
QTRY_VERIFY(window.received(QEvent::PlatformSurface) == 2);
|
||||
QTRY_VERIFY(window.surfaceEventType() == QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
|
||||
QTRY_VERIFY(window.handle() == Q_NULLPTR);
|
||||
QTRY_COMPARE(window.received(QEvent::PlatformSurface), 2);
|
||||
QTRY_COMPARE(window.surfaceEventType(), QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed);
|
||||
QTRY_VERIFY(!window.handle());
|
||||
|
||||
// Check for synchronous delivery of platform surface events and that the platform
|
||||
// surface always existed upon event delivery
|
||||
@ -506,7 +506,7 @@ void tst_QWindow::isActive()
|
||||
context.swapBuffers(&window);
|
||||
#endif
|
||||
QTRY_COMPARE(window.received(QEvent::Resize), 1);
|
||||
QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
|
||||
QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
|
||||
QVERIFY(window.isActive());
|
||||
|
||||
Window child;
|
||||
@ -518,7 +518,7 @@ void tst_QWindow::isActive()
|
||||
|
||||
child.requestActivate();
|
||||
|
||||
QTRY_VERIFY(QGuiApplication::focusWindow() == &child);
|
||||
QTRY_COMPARE(QGuiApplication::focusWindow(), &child);
|
||||
QVERIFY(child.isActive());
|
||||
|
||||
// parent shouldn't receive new resize events from child being shown
|
||||
@ -541,7 +541,7 @@ void tst_QWindow::isActive()
|
||||
QTRY_VERIFY(dialog.isExposed());
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_COMPARE(dialog.received(QEvent::Resize), 1);
|
||||
QTRY_VERIFY(QGuiApplication::focusWindow() == &dialog);
|
||||
QTRY_COMPARE(QGuiApplication::focusWindow(), &dialog);
|
||||
QVERIFY(dialog.isActive());
|
||||
|
||||
// transient child has focus
|
||||
@ -552,7 +552,7 @@ void tst_QWindow::isActive()
|
||||
|
||||
window.requestActivate();
|
||||
|
||||
QTRY_VERIFY(QGuiApplication::focusWindow() == &window);
|
||||
QTRY_COMPARE(QGuiApplication::focusWindow(), &window);
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_COMPARE(dialog.received(QEvent::FocusOut), 1);
|
||||
QTRY_COMPARE(window.received(QEvent::FocusIn), 2);
|
||||
@ -1331,14 +1331,14 @@ void tst_QWindow::inputReentrancy()
|
||||
class TabletTestWindow : public QWindow
|
||||
{
|
||||
public:
|
||||
TabletTestWindow() : eventType(0) { }
|
||||
TabletTestWindow() : eventType(QEvent::None) { }
|
||||
void tabletEvent(QTabletEvent *ev) {
|
||||
eventType = ev->type();
|
||||
eventGlobal = ev->globalPosF();
|
||||
eventLocal = ev->posF();
|
||||
eventDevice = ev->device();
|
||||
}
|
||||
int eventType;
|
||||
QEvent::Type eventType;
|
||||
QPointF eventGlobal, eventLocal;
|
||||
int eventDevice;
|
||||
bool eventFilter(QObject *obj, QEvent *ev) {
|
||||
@ -1371,16 +1371,16 @@ void tst_QWindow::tabletEvents()
|
||||
QTRY_COMPARE(window.eventLocal.toPoint(), local);
|
||||
QWindowSystemInterface::handleTabletEvent(&window, false, deviceLocal, deviceGlobal, 1, 2, 0.5, 1, 2, 0.1, 0, 0, 0);
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_VERIFY(window.eventType == QEvent::TabletRelease);
|
||||
QTRY_COMPARE(window.eventType, QEvent::TabletRelease);
|
||||
|
||||
QWindowSystemInterface::handleTabletEnterProximityEvent(1, 2, 3);
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_VERIFY(window.eventType == QEvent::TabletEnterProximity);
|
||||
QTRY_COMPARE(window.eventType, QEvent::TabletEnterProximity);
|
||||
QTRY_COMPARE(window.eventDevice, 1);
|
||||
|
||||
QWindowSystemInterface::handleTabletLeaveProximityEvent(1, 2, 3);
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_VERIFY(window.eventType == QEvent::TabletLeaveProximity);
|
||||
QTRY_COMPARE(window.eventType, QEvent::TabletLeaveProximity);
|
||||
QTRY_COMPARE(window.eventDevice, 1);
|
||||
|
||||
#endif
|
||||
@ -1728,13 +1728,13 @@ void tst_QWindow::requestUpdate()
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_VERIFY(window.isExposed());
|
||||
|
||||
QVERIFY(window.received(QEvent::UpdateRequest) == 0);
|
||||
QCOMPARE(window.received(QEvent::UpdateRequest), 0);
|
||||
|
||||
window.requestUpdate();
|
||||
QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 1);
|
||||
QTRY_COMPARE(window.received(QEvent::UpdateRequest), 1);
|
||||
|
||||
window.requestUpdate();
|
||||
QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 2);
|
||||
QTRY_COMPARE(window.received(QEvent::UpdateRequest), 2);
|
||||
}
|
||||
|
||||
#include <tst_qwindow.moc>
|
||||
|
@ -673,7 +673,7 @@ void tst_QMatrixNxN::compare2x2()
|
||||
QMatrix2x2 m2(uniqueValues2);
|
||||
QMatrix2x2 m3(transposedValues2);
|
||||
|
||||
QVERIFY(m1 == m2);
|
||||
QCOMPARE(m1, m2);
|
||||
QVERIFY(!(m1 != m2));
|
||||
QVERIFY(m1 != m3);
|
||||
QVERIFY(!(m1 == m3));
|
||||
@ -686,7 +686,7 @@ void tst_QMatrixNxN::compare3x3()
|
||||
QMatrix3x3 m2(uniqueValues3);
|
||||
QMatrix3x3 m3(transposedValues3);
|
||||
|
||||
QVERIFY(m1 == m2);
|
||||
QCOMPARE(m1, m2);
|
||||
QVERIFY(!(m1 != m2));
|
||||
QVERIFY(m1 != m3);
|
||||
QVERIFY(!(m1 == m3));
|
||||
@ -699,7 +699,7 @@ void tst_QMatrixNxN::compare4x4()
|
||||
QMatrix4x4 m2(uniqueValues4);
|
||||
QMatrix4x4 m3(transposedValues4);
|
||||
|
||||
QVERIFY(m1 == m2);
|
||||
QCOMPARE(m1, m2);
|
||||
QVERIFY(!(m1 != m2));
|
||||
QVERIFY(m1 != m3);
|
||||
QVERIFY(!(m1 == m3));
|
||||
@ -712,7 +712,7 @@ void tst_QMatrixNxN::compare4x3()
|
||||
QMatrix4x3 m2(uniqueValues4x3);
|
||||
QMatrix4x3 m3(transposedValues3x4);
|
||||
|
||||
QVERIFY(m1 == m2);
|
||||
QCOMPARE(m1, m2);
|
||||
QVERIFY(!(m1 != m2));
|
||||
QVERIFY(m1 != m3);
|
||||
QVERIFY(!(m1 == m3));
|
||||
@ -1858,7 +1858,7 @@ void tst_QMatrixNxN::inverted4x4()
|
||||
if (invertible)
|
||||
QVERIFY(m1.determinant() != 0.0f);
|
||||
else
|
||||
QVERIFY(m1.determinant() == 0.0f);
|
||||
QCOMPARE(m1.determinant(), 0.0f);
|
||||
|
||||
Matrix4 m1alt;
|
||||
memcpy(m1alt.v, (const float *)m1Values, sizeof(m1alt.v));
|
||||
@ -1992,7 +1992,7 @@ void tst_QMatrixNxN::scale4x4()
|
||||
if (z == 1.0f) {
|
||||
QMatrix4x4 m2b;
|
||||
m2b.scale(x, y);
|
||||
QVERIFY(m2b == m2);
|
||||
QCOMPARE(m2b, m2);
|
||||
}
|
||||
|
||||
QVector3D v1(2.0f, 3.0f, -4.0f);
|
||||
@ -2051,7 +2051,7 @@ void tst_QMatrixNxN::scale4x4()
|
||||
if (z == 1.0f) {
|
||||
QMatrix4x4 m4b(m3);
|
||||
m4b.scale(x, y);
|
||||
QVERIFY(m4b == m4);
|
||||
QCOMPARE(m4b, m4);
|
||||
}
|
||||
|
||||
// Test coverage when the special matrix type is unknown.
|
||||
@ -2138,7 +2138,7 @@ void tst_QMatrixNxN::translate4x4()
|
||||
if (z == 0.0f) {
|
||||
QMatrix4x4 m2b;
|
||||
m2b.translate(x, y);
|
||||
QVERIFY(m2b == m2);
|
||||
QCOMPARE(m2b, m2);
|
||||
}
|
||||
|
||||
QVector3D v1(2.0f, 3.0f, -4.0f);
|
||||
@ -2179,7 +2179,7 @@ void tst_QMatrixNxN::translate4x4()
|
||||
if (z == 0.0f) {
|
||||
QMatrix4x4 m4b(m3);
|
||||
m4b.translate(x, y);
|
||||
QVERIFY(m4b == m4);
|
||||
QCOMPARE(m4b, m4);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3073,7 +3073,7 @@ void tst_QMatrixNxN::convertQMatrix()
|
||||
QPointF p2 = m2 * QPointF(100.0, 150.0);
|
||||
QCOMPARE((double)p2.x(), 100.0 - 3.5);
|
||||
QCOMPARE((double)p2.y(), 150.0 + 2.0);
|
||||
QVERIFY(m1 == m2.toAffine());
|
||||
QCOMPARE(m1, m2.toAffine());
|
||||
|
||||
QMatrix m3;
|
||||
m3.scale(1.5, -2.0);
|
||||
@ -3085,7 +3085,7 @@ void tst_QMatrixNxN::convertQMatrix()
|
||||
QPointF p4 = m4 * QPointF(100.0, 150.0);
|
||||
QCOMPARE((double)p4.x(), 1.5 * 100.0);
|
||||
QCOMPARE((double)p4.y(), -2.0 * 150.0);
|
||||
QVERIFY(m3 == m4.toAffine());
|
||||
QCOMPARE(m3, m4.toAffine());
|
||||
|
||||
QMatrix m5;
|
||||
m5.rotate(45.0);
|
||||
@ -3120,7 +3120,7 @@ void tst_QMatrixNxN::convertQTransform()
|
||||
QPointF p2 = m2 * QPointF(100.0, 150.0);
|
||||
QCOMPARE((double)p2.x(), 100.0 - 3.5);
|
||||
QCOMPARE((double)p2.y(), 150.0 + 2.0);
|
||||
QVERIFY(m1 == m2.toTransform());
|
||||
QCOMPARE(m1, m2.toTransform());
|
||||
|
||||
QTransform m3;
|
||||
m3.scale(1.5, -2.0);
|
||||
@ -3132,7 +3132,7 @@ void tst_QMatrixNxN::convertQTransform()
|
||||
QPointF p4 = m4 * QPointF(100.0, 150.0);
|
||||
QCOMPARE((double)p4.x(), 1.5 * 100.0);
|
||||
QCOMPARE((double)p4.y(), -2.0 * 150.0);
|
||||
QVERIFY(m3 == m4.toTransform());
|
||||
QCOMPARE(m3, m4.toTransform());
|
||||
|
||||
QTransform m5;
|
||||
m5.rotate(45.0);
|
||||
@ -3206,16 +3206,16 @@ void tst_QMatrixNxN::mapRect()
|
||||
QRect recti(qRound(x), qRound(y), qRound(width), qRound(height));
|
||||
|
||||
QMatrix4x4 m1;
|
||||
QVERIFY(m1.mapRect(rect) == rect);
|
||||
QVERIFY(m1.mapRect(recti) == recti);
|
||||
QCOMPARE(m1.mapRect(rect), rect);
|
||||
QCOMPARE(m1.mapRect(recti), recti);
|
||||
|
||||
QMatrix4x4 m2;
|
||||
m2.translate(-100.5f, 64.0f);
|
||||
QRectF translated = rect.translated(-100.5f, 64.0f);
|
||||
QRect translatedi = QRect(qRound(recti.x() - 100.5f), recti.y() + 64,
|
||||
recti.width(), recti.height());
|
||||
QVERIFY(m2.mapRect(rect) == translated);
|
||||
QVERIFY(m2.mapRect(recti) == translatedi);
|
||||
QCOMPARE(m2.mapRect(rect), translated);
|
||||
QCOMPARE(m2.mapRect(recti), translatedi);
|
||||
|
||||
QMatrix4x4 m3;
|
||||
m3.scale(-100.5f, 64.0f);
|
||||
@ -3232,7 +3232,7 @@ void tst_QMatrixNxN::mapRect()
|
||||
scaley -= scaleht;
|
||||
}
|
||||
QRectF scaled(scalex, scaley, scalewid, scaleht);
|
||||
QVERIFY(m3.mapRect(rect) == scaled);
|
||||
QCOMPARE(m3.mapRect(rect), scaled);
|
||||
scalex = recti.x() * -100.5f;
|
||||
scaley = recti.y() * 64.0f;
|
||||
scalewid = recti.width() * -100.5f;
|
||||
@ -3247,7 +3247,7 @@ void tst_QMatrixNxN::mapRect()
|
||||
}
|
||||
QRect scaledi(qRound(scalex), qRound(scaley),
|
||||
qRound(scalewid), qRound(scaleht));
|
||||
QVERIFY(m3.mapRect(recti) == scaledi);
|
||||
QCOMPARE(m3.mapRect(recti), scaledi);
|
||||
|
||||
QMatrix4x4 m4;
|
||||
m4.translate(-100.5f, 64.0f);
|
||||
@ -3261,7 +3261,7 @@ void tst_QMatrixNxN::mapRect()
|
||||
if (transy1 > transy2)
|
||||
qSwap(transy1, transy2);
|
||||
QRectF trans(transx1, transy1, transx2 - transx1, transy2 - transy1);
|
||||
QVERIFY(m4.mapRect(rect) == trans);
|
||||
QCOMPARE(m4.mapRect(rect), trans);
|
||||
transx1 = recti.x() * -2.5f - 100.5f;
|
||||
transy1 = recti.y() * 4.0f + 64.0f;
|
||||
transx2 = (recti.x() + recti.width()) * -2.5f - 100.5f;
|
||||
@ -3273,7 +3273,7 @@ void tst_QMatrixNxN::mapRect()
|
||||
QRect transi(qRound(transx1), qRound(transy1),
|
||||
qRound(transx2) - qRound(transx1),
|
||||
qRound(transy2) - qRound(transy1));
|
||||
QVERIFY(m4.mapRect(recti) == transi);
|
||||
QCOMPARE(m4.mapRect(recti), transi);
|
||||
|
||||
m4.rotate(45.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
@ -3290,7 +3290,7 @@ void tst_QMatrixNxN::mapRect()
|
||||
|
||||
QRect mri = m4.mapRect(recti);
|
||||
QRect tri = t4.mapRect(recti);
|
||||
QVERIFY(mri == tri);
|
||||
QCOMPARE(mri, tri);
|
||||
}
|
||||
|
||||
void tst_QMatrixNxN::mapVector_data()
|
||||
@ -3389,14 +3389,14 @@ void tst_QMatrixNxN::properties()
|
||||
|
||||
void tst_QMatrixNxN::metaTypes()
|
||||
{
|
||||
QVERIFY(QMetaType::type("QMatrix4x4") == QMetaType::QMatrix4x4);
|
||||
QCOMPARE(QMetaType::type("QMatrix4x4"), int(QMetaType::QMatrix4x4));
|
||||
|
||||
QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QMatrix4x4)),
|
||||
QByteArray("QMatrix4x4"));
|
||||
|
||||
QVERIFY(QMetaType::isRegistered(QMetaType::QMatrix4x4));
|
||||
|
||||
QVERIFY(qMetaTypeId<QMatrix4x4>() == QMetaType::QMatrix4x4);
|
||||
QCOMPARE(qMetaTypeId<QMatrix4x4>(), int(QMetaType::QMatrix4x4));
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QMatrixNxN)
|
||||
|
@ -446,7 +446,7 @@ void tst_QQuaternion::compare()
|
||||
QQuaternion v5(8, 1, 2, 3);
|
||||
QQuaternion v6(3, 1, 2, 4);
|
||||
|
||||
QVERIFY(v1 == v2);
|
||||
QCOMPARE(v1, v2);
|
||||
QVERIFY(v1 != v3);
|
||||
QVERIFY(v1 != v4);
|
||||
QVERIFY(v1 != v5);
|
||||
@ -522,7 +522,7 @@ void tst_QQuaternion::add()
|
||||
|
||||
QQuaternion v4(v1);
|
||||
v4 += v2;
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
QCOMPARE(v4.x(), v1.x() + v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() + v2.y());
|
||||
@ -560,7 +560,7 @@ void tst_QQuaternion::subtract()
|
||||
|
||||
QQuaternion v4(v3);
|
||||
v4 -= v1;
|
||||
QVERIFY(v4 == v2);
|
||||
QCOMPARE(v4, v2);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() - v1.x());
|
||||
QCOMPARE(v4.y(), v3.y() - v1.y());
|
||||
@ -569,7 +569,7 @@ void tst_QQuaternion::subtract()
|
||||
|
||||
QQuaternion v5(v3);
|
||||
v5 -= v2;
|
||||
QVERIFY(v5 == v1);
|
||||
QCOMPARE(v5, v1);
|
||||
|
||||
QCOMPARE(v5.x(), v3.x() - v2.x());
|
||||
QCOMPARE(v5.y(), v3.y() - v2.y());
|
||||
@ -704,7 +704,7 @@ void tst_QQuaternion::multiplyFactor()
|
||||
|
||||
QQuaternion v3(v1);
|
||||
v3 *= factor;
|
||||
QVERIFY(v3 == v2);
|
||||
QCOMPARE(v3, v2);
|
||||
|
||||
QCOMPARE(v3.x(), v1.x() * factor);
|
||||
QCOMPARE(v3.y(), v1.y() * factor);
|
||||
@ -740,7 +740,7 @@ void tst_QQuaternion::divide()
|
||||
|
||||
QQuaternion v3(v2);
|
||||
v3 /= factor;
|
||||
QVERIFY(v3 == v1);
|
||||
QCOMPARE(v3, v1);
|
||||
|
||||
QCOMPARE(v3.x(), v2.x() / factor);
|
||||
QCOMPARE(v3.y(), v2.y() / factor);
|
||||
@ -764,7 +764,7 @@ void tst_QQuaternion::negate()
|
||||
QQuaternion v1(w1, x1, y1, z1);
|
||||
QQuaternion v2(-w1, -x1, -y1, -z1);
|
||||
|
||||
QVERIFY(-v1 == v2);
|
||||
QCOMPARE(-v1, v2);
|
||||
}
|
||||
|
||||
// Test quaternion conjugate calculations.
|
||||
@ -783,7 +783,7 @@ void tst_QQuaternion::conjugate()
|
||||
QQuaternion v1(w1, x1, y1, z1);
|
||||
QQuaternion v2(w1, -x1, -y1, -z1);
|
||||
|
||||
QVERIFY(v1.conjugate() == v2);
|
||||
QCOMPARE(v1.conjugate(), v2);
|
||||
}
|
||||
|
||||
// Test quaternion creation from an axis and an angle.
|
||||
@ -1325,14 +1325,14 @@ void tst_QQuaternion::properties()
|
||||
|
||||
void tst_QQuaternion::metaTypes()
|
||||
{
|
||||
QVERIFY(QMetaType::type("QQuaternion") == QMetaType::QQuaternion);
|
||||
QCOMPARE(QMetaType::type("QQuaternion"), int(QMetaType::QQuaternion));
|
||||
|
||||
QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QQuaternion)),
|
||||
QByteArray("QQuaternion"));
|
||||
|
||||
QVERIFY(QMetaType::isRegistered(QMetaType::QQuaternion));
|
||||
|
||||
QVERIFY(qMetaTypeId<QQuaternion>() == QMetaType::QQuaternion);
|
||||
QCOMPARE(qMetaTypeId<QQuaternion>(), int(QMetaType::QQuaternion));
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QQuaternion)
|
||||
|
@ -885,7 +885,7 @@ void tst_QVectorND::compare2()
|
||||
QVector2D v3(3, 2);
|
||||
QVector2D v4(1, 3);
|
||||
|
||||
QVERIFY(v1 == v2);
|
||||
QCOMPARE(v1, v2);
|
||||
QVERIFY(v1 != v3);
|
||||
QVERIFY(v1 != v4);
|
||||
}
|
||||
@ -899,7 +899,7 @@ void tst_QVectorND::compare3()
|
||||
QVector3D v4(1, 3, 4);
|
||||
QVector3D v5(1, 2, 3);
|
||||
|
||||
QVERIFY(v1 == v2);
|
||||
QCOMPARE(v1, v2);
|
||||
QVERIFY(v1 != v3);
|
||||
QVERIFY(v1 != v4);
|
||||
QVERIFY(v1 != v5);
|
||||
@ -915,7 +915,7 @@ void tst_QVectorND::compare4()
|
||||
QVector4D v5(1, 2, 3, 8);
|
||||
QVector4D v6(1, 2, 4, 3);
|
||||
|
||||
QVERIFY(v1 == v2);
|
||||
QCOMPARE(v1, v2);
|
||||
QVERIFY(v1 != v3);
|
||||
QVERIFY(v1 != v4);
|
||||
QVERIFY(v1 != v5);
|
||||
@ -969,7 +969,7 @@ void tst_QVectorND::add2()
|
||||
|
||||
QVector2D v4(v1);
|
||||
v4 += v2;
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
QCOMPARE(v4.x(), v1.x() + v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() + v2.y());
|
||||
@ -1033,7 +1033,7 @@ void tst_QVectorND::add3()
|
||||
|
||||
QVector3D v4(v1);
|
||||
v4 += v2;
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
QCOMPARE(v4.x(), v1.x() + v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() + v2.y());
|
||||
@ -1109,7 +1109,7 @@ void tst_QVectorND::add4()
|
||||
|
||||
QVector4D v4(v1);
|
||||
v4 += v2;
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
QCOMPARE(v4.x(), v1.x() + v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() + v2.y());
|
||||
@ -1141,14 +1141,14 @@ void tst_QVectorND::subtract2()
|
||||
|
||||
QVector2D v4(v3);
|
||||
v4 -= v1;
|
||||
QVERIFY(v4 == v2);
|
||||
QCOMPARE(v4, v2);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() - v1.x());
|
||||
QCOMPARE(v4.y(), v3.y() - v1.y());
|
||||
|
||||
QVector2D v5(v3);
|
||||
v5 -= v2;
|
||||
QVERIFY(v5 == v1);
|
||||
QCOMPARE(v5, v1);
|
||||
|
||||
QCOMPARE(v5.x(), v3.x() - v2.x());
|
||||
QCOMPARE(v5.y(), v3.y() - v2.y());
|
||||
@ -1181,7 +1181,7 @@ void tst_QVectorND::subtract3()
|
||||
|
||||
QVector3D v4(v3);
|
||||
v4 -= v1;
|
||||
QVERIFY(v4 == v2);
|
||||
QCOMPARE(v4, v2);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() - v1.x());
|
||||
QCOMPARE(v4.y(), v3.y() - v1.y());
|
||||
@ -1189,7 +1189,7 @@ void tst_QVectorND::subtract3()
|
||||
|
||||
QVector3D v5(v3);
|
||||
v5 -= v2;
|
||||
QVERIFY(v5 == v1);
|
||||
QCOMPARE(v5, v1);
|
||||
|
||||
QCOMPARE(v5.x(), v3.x() - v2.x());
|
||||
QCOMPARE(v5.y(), v3.y() - v2.y());
|
||||
@ -1226,7 +1226,7 @@ void tst_QVectorND::subtract4()
|
||||
|
||||
QVector4D v4(v3);
|
||||
v4 -= v1;
|
||||
QVERIFY(v4 == v2);
|
||||
QCOMPARE(v4, v2);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() - v1.x());
|
||||
QCOMPARE(v4.y(), v3.y() - v1.y());
|
||||
@ -1235,7 +1235,7 @@ void tst_QVectorND::subtract4()
|
||||
|
||||
QVector4D v5(v3);
|
||||
v5 -= v2;
|
||||
QVERIFY(v5 == v1);
|
||||
QCOMPARE(v5, v1);
|
||||
|
||||
QCOMPARE(v5.x(), v3.x() - v2.x());
|
||||
QCOMPARE(v5.y(), v3.y() - v2.y());
|
||||
@ -1290,7 +1290,7 @@ void tst_QVectorND::multiply2()
|
||||
|
||||
QVector2D v4(v1);
|
||||
v4 *= v2;
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
QCOMPARE(v4.x(), v1.x() * v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() * v2.y());
|
||||
@ -1354,7 +1354,7 @@ void tst_QVectorND::multiply3()
|
||||
|
||||
QVector3D v4(v1);
|
||||
v4 *= v2;
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
QCOMPARE(v4.x(), v1.x() * v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() * v2.y());
|
||||
@ -1430,7 +1430,7 @@ void tst_QVectorND::multiply4()
|
||||
|
||||
QVector4D v4(v1);
|
||||
v4 *= v2;
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
QCOMPARE(v4.x(), v1.x() * v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() * v2.y());
|
||||
@ -1488,7 +1488,7 @@ void tst_QVectorND::multiplyFactor2()
|
||||
|
||||
QVector2D v3(v1);
|
||||
v3 *= factor;
|
||||
QVERIFY(v3 == v2);
|
||||
QCOMPARE(v3, v2);
|
||||
|
||||
QCOMPARE(v3.x(), v1.x() * factor);
|
||||
QCOMPARE(v3.y(), v1.y() * factor);
|
||||
@ -1553,7 +1553,7 @@ void tst_QVectorND::multiplyFactor3()
|
||||
|
||||
QVector3D v3(v1);
|
||||
v3 *= factor;
|
||||
QVERIFY(v3 == v2);
|
||||
QCOMPARE(v3, v2);
|
||||
|
||||
QCOMPARE(v3.x(), v1.x() * factor);
|
||||
QCOMPARE(v3.y(), v1.y() * factor);
|
||||
@ -1628,7 +1628,7 @@ void tst_QVectorND::multiplyFactor4()
|
||||
|
||||
QVector4D v3(v1);
|
||||
v3 *= factor;
|
||||
QVERIFY(v3 == v2);
|
||||
QCOMPARE(v3, v2);
|
||||
|
||||
QCOMPARE(v3.x(), v1.x() * factor);
|
||||
QCOMPARE(v3.y(), v1.y() * factor);
|
||||
@ -1660,7 +1660,7 @@ void tst_QVectorND::divide2()
|
||||
|
||||
QVector2D v4(v3);
|
||||
v4 /= v2;
|
||||
QVERIFY(v4 == v1);
|
||||
QCOMPARE(v4, v1);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() / v2.x());
|
||||
QCOMPARE(v4.y(), v3.y() / v2.y());
|
||||
@ -1670,7 +1670,7 @@ void tst_QVectorND::divide2()
|
||||
|
||||
QVector2D v4(v3);
|
||||
v4 /= v1;
|
||||
QVERIFY(v4 == v2);
|
||||
QCOMPARE(v4, v2);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() / v1.x());
|
||||
QCOMPARE(v4.y(), v3.y() / v1.y());
|
||||
@ -1704,7 +1704,7 @@ void tst_QVectorND::divide3()
|
||||
|
||||
QVector3D v4(v3);
|
||||
v4 /= v2;
|
||||
QVERIFY(v4 == v1);
|
||||
QCOMPARE(v4, v1);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() / v2.x());
|
||||
QCOMPARE(v4.y(), v3.y() / v2.y());
|
||||
@ -1715,7 +1715,7 @@ void tst_QVectorND::divide3()
|
||||
|
||||
QVector3D v4(v3);
|
||||
v4 /= v1;
|
||||
QVERIFY(v4 == v2);
|
||||
QCOMPARE(v4, v2);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() / v1.x());
|
||||
QCOMPARE(v4.y(), v3.y() / v1.y());
|
||||
@ -1753,7 +1753,7 @@ void tst_QVectorND::divide4()
|
||||
|
||||
QVector4D v4(v3);
|
||||
v4 /= v2;
|
||||
QVERIFY(v4 == v1);
|
||||
QCOMPARE(v4, v1);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() / v2.x());
|
||||
QCOMPARE(v4.y(), v3.y() / v2.y());
|
||||
@ -1765,7 +1765,7 @@ void tst_QVectorND::divide4()
|
||||
|
||||
QVector4D v4(v3);
|
||||
v4 /= v1;
|
||||
QVERIFY(v4 == v2);
|
||||
QCOMPARE(v4, v2);
|
||||
|
||||
QCOMPARE(v4.x(), v3.x() / v1.x());
|
||||
QCOMPARE(v4.y(), v3.y() / v1.y());
|
||||
@ -1798,7 +1798,7 @@ void tst_QVectorND::divideFactor2()
|
||||
|
||||
QVector2D v3(v2);
|
||||
v3 /= factor;
|
||||
QVERIFY(v3 == v1);
|
||||
QCOMPARE(v3, v1);
|
||||
|
||||
QCOMPARE(v3.x(), v2.x() / factor);
|
||||
QCOMPARE(v3.y(), v2.y() / factor);
|
||||
@ -1830,7 +1830,7 @@ void tst_QVectorND::divideFactor3()
|
||||
|
||||
QVector3D v3(v2);
|
||||
v3 /= factor;
|
||||
QVERIFY(v3 == v1);
|
||||
QCOMPARE(v3, v1);
|
||||
|
||||
QCOMPARE(v3.x(), v2.x() / factor);
|
||||
QCOMPARE(v3.y(), v2.y() / factor);
|
||||
@ -1865,7 +1865,7 @@ void tst_QVectorND::divideFactor4()
|
||||
|
||||
QVector4D v3(v2);
|
||||
v3 /= factor;
|
||||
QVERIFY(v3 == v1);
|
||||
QCOMPARE(v3, v1);
|
||||
|
||||
QCOMPARE(v3.x(), v2.x() / factor);
|
||||
QCOMPARE(v3.y(), v2.y() / factor);
|
||||
@ -1887,7 +1887,7 @@ void tst_QVectorND::negate2()
|
||||
QVector2D v1(x1, y1);
|
||||
QVector2D v2(-x1, -y1);
|
||||
|
||||
QVERIFY(-v1 == v2);
|
||||
QCOMPARE(-v1, v2);
|
||||
}
|
||||
|
||||
// Test vector negation for 3D vectors.
|
||||
@ -1905,7 +1905,7 @@ void tst_QVectorND::negate3()
|
||||
QVector3D v1(x1, y1, z1);
|
||||
QVector3D v2(-x1, -y1, -z1);
|
||||
|
||||
QVERIFY(-v1 == v2);
|
||||
QCOMPARE(-v1, v2);
|
||||
}
|
||||
|
||||
// Test vector negation for 4D vectors.
|
||||
@ -1924,7 +1924,7 @@ void tst_QVectorND::negate4()
|
||||
QVector4D v1(x1, y1, z1, w1);
|
||||
QVector4D v2(-x1, -y1, -z1, -w1);
|
||||
|
||||
QVERIFY(-v1 == v2);
|
||||
QCOMPARE(-v1, v2);
|
||||
}
|
||||
|
||||
// Test the computation of vector cross-products.
|
||||
@ -1976,7 +1976,7 @@ void tst_QVectorND::crossProduct()
|
||||
QVector3D v3(x3, y3, z3);
|
||||
|
||||
QVector3D v4 = QVector3D::crossProduct(v1, v2);
|
||||
QVERIFY(v4 == v3);
|
||||
QCOMPARE(v4, v3);
|
||||
|
||||
// Compute the cross-product long-hand and check again.
|
||||
float xres = y1 * z2 - z1 * y2;
|
||||
@ -2667,9 +2667,9 @@ void tst_QVectorND::properties()
|
||||
|
||||
void tst_QVectorND::metaTypes()
|
||||
{
|
||||
QVERIFY(QMetaType::type("QVector2D") == QMetaType::QVector2D);
|
||||
QVERIFY(QMetaType::type("QVector3D") == QMetaType::QVector3D);
|
||||
QVERIFY(QMetaType::type("QVector4D") == QMetaType::QVector4D);
|
||||
QCOMPARE(QMetaType::type("QVector2D"), int(QMetaType::QVector2D));
|
||||
QCOMPARE(QMetaType::type("QVector3D"), int(QMetaType::QVector3D));
|
||||
QCOMPARE(QMetaType::type("QVector4D"), int(QMetaType::QVector4D));
|
||||
|
||||
QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QVector2D)),
|
||||
QByteArray("QVector2D"));
|
||||
@ -2682,9 +2682,9 @@ void tst_QVectorND::metaTypes()
|
||||
QVERIFY(QMetaType::isRegistered(QMetaType::QVector3D));
|
||||
QVERIFY(QMetaType::isRegistered(QMetaType::QVector4D));
|
||||
|
||||
QVERIFY(qMetaTypeId<QVector2D>() == QMetaType::QVector2D);
|
||||
QVERIFY(qMetaTypeId<QVector3D>() == QMetaType::QVector3D);
|
||||
QVERIFY(qMetaTypeId<QVector4D>() == QMetaType::QVector4D);
|
||||
QCOMPARE(qMetaTypeId<QVector2D>(), int(QMetaType::QVector2D));
|
||||
QCOMPARE(qMetaTypeId<QVector3D>(), int(QMetaType::QVector3D));
|
||||
QCOMPARE(qMetaTypeId<QVector4D>(), int(QMetaType::QVector4D));
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QVectorND)
|
||||
|
@ -461,8 +461,8 @@ void tst_QBrush::textureBrushComparison()
|
||||
imageBrush1.setTextureImage(image1);
|
||||
imageBrush2.setTextureImage(image2);
|
||||
|
||||
QVERIFY(imageBrush1 == imageBrush2);
|
||||
QVERIFY(pixmapBrush == imageBrush1);
|
||||
QCOMPARE(imageBrush1, imageBrush2);
|
||||
QCOMPARE(pixmapBrush, imageBrush1);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QBrush)
|
||||
|
@ -253,7 +253,7 @@ void tst_QColor::isValid()
|
||||
{
|
||||
QFETCH(QColor, color);
|
||||
QFETCH(bool, isValid);
|
||||
QVERIFY(color.isValid() == isValid);
|
||||
QCOMPARE(color.isValid(), isValid);
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(QColor::NameFormat);
|
||||
@ -1325,19 +1325,19 @@ void tst_QColor::convertTo()
|
||||
QColor color(Qt::black);
|
||||
|
||||
QColor rgb = color.convertTo(QColor::Rgb);
|
||||
QVERIFY(rgb.spec() == QColor::Rgb);
|
||||
QCOMPARE(rgb.spec(), QColor::Rgb);
|
||||
|
||||
QColor hsv = color.convertTo(QColor::Hsv);
|
||||
QVERIFY(hsv.spec() == QColor::Hsv);
|
||||
QCOMPARE(hsv.spec(), QColor::Hsv);
|
||||
|
||||
QColor cmyk = color.convertTo(QColor::Cmyk);
|
||||
QVERIFY(cmyk.spec() == QColor::Cmyk);
|
||||
QCOMPARE(cmyk.spec(), QColor::Cmyk);
|
||||
|
||||
QColor hsl = color.convertTo(QColor::Hsl);
|
||||
QVERIFY(hsl.spec() == QColor::Hsl);
|
||||
QCOMPARE(hsl.spec(), QColor::Hsl);
|
||||
|
||||
QColor invalid = color.convertTo(QColor::Invalid);
|
||||
QVERIFY(invalid.spec() == QColor::Invalid);
|
||||
QCOMPARE(invalid.spec(), QColor::Invalid);
|
||||
}
|
||||
|
||||
void tst_QColor::light()
|
||||
|
@ -76,7 +76,7 @@ void tst_QPageLayout::basics()
|
||||
QCOMPARE(simple.paintRectPixels(72), QRect(0, 0, 595, 842));
|
||||
|
||||
const QPageLayout a4portrait = simple;
|
||||
QVERIFY(a4portrait == simple);
|
||||
QCOMPARE(a4portrait, simple);
|
||||
|
||||
// Change orientation
|
||||
simple.setOrientation(QPageLayout::Landscape);
|
||||
|
@ -799,7 +799,7 @@ void tst_QPainter::drawPixmapFragments()
|
||||
QImage origImage = origPixmap.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
QImage resImage = resPixmap.toImage().convertToFormat(QImage::Format_ARGB32);
|
||||
|
||||
QVERIFY(resImage.size() == resPixmap.size());
|
||||
QCOMPARE(resImage.size(), resPixmap.size());
|
||||
QVERIFY(resImage.pixel(5, 5) == origImage.pixel(15, 15));
|
||||
QVERIFY(resImage.pixel(5, 15) == origImage.pixel(15, 5));
|
||||
QVERIFY(resImage.pixel(15, 5) == origImage.pixel(5, 15));
|
||||
@ -807,16 +807,16 @@ void tst_QPainter::drawPixmapFragments()
|
||||
|
||||
|
||||
QPainter::PixmapFragment fragment = QPainter::PixmapFragment::create(QPointF(20, 20), QRectF(30, 30, 2, 2));
|
||||
QVERIFY(fragment.x == 20);
|
||||
QVERIFY(fragment.y == 20);
|
||||
QVERIFY(fragment.sourceLeft == 30);
|
||||
QVERIFY(fragment.sourceTop == 30);
|
||||
QVERIFY(fragment.width == 2);
|
||||
QVERIFY(fragment.height == 2);
|
||||
QVERIFY(fragment.scaleX == 1);
|
||||
QVERIFY(fragment.scaleY == 1);
|
||||
QVERIFY(fragment.rotation == 0);
|
||||
QVERIFY(fragment.opacity == 1);
|
||||
QCOMPARE(fragment.x, qreal(20));
|
||||
QCOMPARE(fragment.y, qreal(20));
|
||||
QCOMPARE(fragment.sourceLeft, qreal(30));
|
||||
QCOMPARE(fragment.sourceTop, qreal(30));
|
||||
QCOMPARE(fragment.width, qreal(2));
|
||||
QCOMPARE(fragment.height, qreal(2));
|
||||
QCOMPARE(fragment.scaleX, qreal(1));
|
||||
QCOMPARE(fragment.scaleY, qreal(1));
|
||||
QCOMPARE(fragment.rotation, qreal(0));
|
||||
QCOMPARE(fragment.opacity, qreal(1));
|
||||
}
|
||||
|
||||
void tst_QPainter::drawPixmapNegativeScale()
|
||||
@ -1481,7 +1481,7 @@ void tst_QPainter::drawPath3()
|
||||
p.drawPath(path);
|
||||
p.end();
|
||||
|
||||
QVERIFY(imgA == imgB);
|
||||
QCOMPARE(imgA, imgB);
|
||||
|
||||
imgA.invertPixels();
|
||||
imgB.fill(0xffffff);
|
||||
@ -1495,7 +1495,7 @@ void tst_QPainter::drawPath3()
|
||||
p.drawPath(path);
|
||||
p.end();
|
||||
|
||||
QVERIFY(imgA == imgB);
|
||||
QCOMPARE(imgA, imgB);
|
||||
|
||||
path.setFillRule(Qt::WindingFill);
|
||||
imgB.fill(0xffffff);
|
||||
|
@ -602,16 +602,16 @@ void tst_QPainterPath::testOperatorEquals()
|
||||
{
|
||||
QPainterPath empty1;
|
||||
QPainterPath empty2;
|
||||
QVERIFY(empty1 == empty2);
|
||||
QCOMPARE(empty1, empty2);
|
||||
|
||||
QPainterPath rect1;
|
||||
rect1.addRect(100, 100, 100, 100);
|
||||
QVERIFY(rect1 == rect1);
|
||||
QCOMPARE(rect1, rect1);
|
||||
QVERIFY(rect1 != empty1);
|
||||
|
||||
QPainterPath rect2;
|
||||
rect2.addRect(100, 100, 100, 100);
|
||||
QVERIFY(rect1 == rect2);
|
||||
QCOMPARE(rect1, rect2);
|
||||
|
||||
rect2.setFillRule(Qt::WindingFill);
|
||||
QVERIFY(rect1 != rect2);
|
||||
@ -622,7 +622,7 @@ void tst_QPainterPath::testOperatorEquals()
|
||||
|
||||
QPainterPath ellipse2;
|
||||
ellipse2.addEllipse(50, 50, 100, 100);
|
||||
QVERIFY(ellipse1 == ellipse2);
|
||||
QCOMPARE(ellipse1, ellipse2);
|
||||
}
|
||||
|
||||
void tst_QPainterPath::testOperatorEquals_fuzzy()
|
||||
@ -638,12 +638,12 @@ void tst_QPainterPath::testOperatorEquals_fuzzy()
|
||||
QPainterPath pb;
|
||||
pb.addRect(b);
|
||||
|
||||
QVERIFY(pa == pb);
|
||||
QCOMPARE(pa, pb);
|
||||
|
||||
QTransform transform;
|
||||
transform.translate(-100, -100);
|
||||
|
||||
QVERIFY(transform.map(pa) == transform.map(pb));
|
||||
QCOMPARE(transform.map(pa), transform.map(pb));
|
||||
}
|
||||
|
||||
// higher tolerance for error when path's bounding rect is big
|
||||
@ -656,12 +656,12 @@ void tst_QPainterPath::testOperatorEquals_fuzzy()
|
||||
QPainterPath pb;
|
||||
pb.addRect(b);
|
||||
|
||||
QVERIFY(pa == pb);
|
||||
QCOMPARE(pa, pb);
|
||||
|
||||
QTransform transform;
|
||||
transform.translate(-1, -1);
|
||||
|
||||
QVERIFY(transform.map(pa) == transform.map(pb));
|
||||
QCOMPARE(transform.map(pa), transform.map(pb));
|
||||
}
|
||||
|
||||
// operator== should return true for a path that has
|
||||
@ -676,7 +676,7 @@ void tst_QPainterPath::testOperatorEquals_fuzzy()
|
||||
|
||||
QPainterPath b = transform.inverted().map(transform.map(a));
|
||||
|
||||
QVERIFY(a == b);
|
||||
QCOMPARE(a, b);
|
||||
}
|
||||
|
||||
{
|
||||
@ -720,7 +720,7 @@ void tst_QPainterPath::testOperatorDatastream()
|
||||
stream >> other;
|
||||
}
|
||||
|
||||
QVERIFY(other == path);
|
||||
QCOMPARE(other, path);
|
||||
}
|
||||
|
||||
void tst_QPainterPath::closing()
|
||||
@ -1066,19 +1066,19 @@ void tst_QPainterPath::setElementPositionAt()
|
||||
{
|
||||
QPainterPath path(QPointF(42., 42.));
|
||||
QCOMPARE(path.elementCount(), 1);
|
||||
QVERIFY(path.elementAt(0).type == QPainterPath::MoveToElement);
|
||||
QCOMPARE(path.elementAt(0).type, QPainterPath::MoveToElement);
|
||||
QCOMPARE(path.elementAt(0).x, qreal(42.));
|
||||
QCOMPARE(path.elementAt(0).y, qreal(42.));
|
||||
|
||||
QPainterPath copy = path;
|
||||
copy.setElementPositionAt(0, qreal(0), qreal(0));
|
||||
QCOMPARE(copy.elementCount(), 1);
|
||||
QVERIFY(copy.elementAt(0).type == QPainterPath::MoveToElement);
|
||||
QCOMPARE(copy.elementAt(0).type, QPainterPath::MoveToElement);
|
||||
QCOMPARE(copy.elementAt(0).x, qreal(0));
|
||||
QCOMPARE(copy.elementAt(0).y, qreal(0));
|
||||
|
||||
QCOMPARE(path.elementCount(), 1);
|
||||
QVERIFY(path.elementAt(0).type == QPainterPath::MoveToElement);
|
||||
QCOMPARE(path.elementAt(0).type, QPainterPath::MoveToElement);
|
||||
QCOMPARE(path.elementAt(0).x, qreal(42.));
|
||||
QCOMPARE(path.elementAt(0).y, qreal(42.));
|
||||
}
|
||||
@ -1253,10 +1253,10 @@ void tst_QPainterPath::connectPathMoveTo()
|
||||
|
||||
path1.connectPath(path2);
|
||||
|
||||
QVERIFY(path1.elementAt(0).type == QPainterPath::MoveToElement);
|
||||
QVERIFY(path2.elementAt(0).type == QPainterPath::MoveToElement);
|
||||
QVERIFY(path3.elementAt(0).type == QPainterPath::MoveToElement);
|
||||
QVERIFY(path4.elementAt(0).type == QPainterPath::MoveToElement);
|
||||
QCOMPARE(path1.elementAt(0).type, QPainterPath::MoveToElement);
|
||||
QCOMPARE(path2.elementAt(0).type, QPainterPath::MoveToElement);
|
||||
QCOMPARE(path3.elementAt(0).type, QPainterPath::MoveToElement);
|
||||
QCOMPARE(path4.elementAt(0).type, QPainterPath::MoveToElement);
|
||||
}
|
||||
|
||||
void tst_QPainterPath::translate()
|
||||
|
@ -173,7 +173,7 @@ void tst_QRegion::setRects()
|
||||
QRect rect;
|
||||
region.setRects(&rect, 0);
|
||||
QVERIFY(region.isEmpty());
|
||||
QVERIFY(region == QRegion());
|
||||
QCOMPARE(region, QRegion());
|
||||
QVERIFY(!region.boundingRect().isValid());
|
||||
QVERIFY(region.rects().isEmpty());
|
||||
}
|
||||
|
@ -428,14 +428,14 @@ void tst_QTransform::matrix()
|
||||
mat1.m21(), mat1.m22(), 0,
|
||||
mat1.dx(), mat1.dy(), 1);
|
||||
|
||||
QVERIFY(tran1 == dummy);
|
||||
QVERIFY(tran1.inverted() == dummy.inverted());
|
||||
QVERIFY(tran1.inverted() == QTransform(mat1.inverted()));
|
||||
QVERIFY(tran2.inverted() == QTransform(mat2.inverted()));
|
||||
QCOMPARE(tran1, dummy);
|
||||
QCOMPARE(tran1.inverted(), dummy.inverted());
|
||||
QCOMPARE(tran1.inverted(), QTransform(mat1.inverted()));
|
||||
QCOMPARE(tran2.inverted(), QTransform(mat2.inverted()));
|
||||
|
||||
QMatrix mat3 = mat1 * mat2;
|
||||
QTransform tran3 = tran1 * tran2;
|
||||
QVERIFY(QTransform(mat3) == tran3);
|
||||
QCOMPARE(QTransform(mat3), tran3);
|
||||
|
||||
/* QMatrix::operator==() doesn't use qFuzzyCompare(), which
|
||||
* on win32-g++ results in a failure. So we work around it by
|
||||
@ -447,15 +447,15 @@ void tst_QTransform::matrix()
|
||||
|
||||
QRect rect(43, 70, 200, 200);
|
||||
QPoint pt(43, 66);
|
||||
QVERIFY(tranInv.map(pt) == matInv.map(pt));
|
||||
QVERIFY(tranInv.map(pt) == matInv.map(pt));
|
||||
QCOMPARE(tranInv.map(pt), matInv.map(pt));
|
||||
QCOMPARE(tranInv.map(pt), matInv.map(pt));
|
||||
|
||||
QPainterPath path;
|
||||
path.moveTo(55, 60);
|
||||
path.lineTo(110, 110);
|
||||
path.quadTo(220, 50, 10, 20);
|
||||
path.closeSubpath();
|
||||
QVERIFY(tranInv.map(path) == matInv.map(path));
|
||||
QCOMPARE(tranInv.map(path), matInv.map(path));
|
||||
}
|
||||
|
||||
void tst_QTransform::testOffset()
|
||||
@ -741,8 +741,8 @@ void tst_QTransform::inverted()
|
||||
|
||||
const QTransform inverted = matrix.inverted();
|
||||
|
||||
QVERIFY(matrix.isIdentity() == inverted.isIdentity());
|
||||
QVERIFY(matrix.type() == inverted.type());
|
||||
QCOMPARE(matrix.isIdentity(), inverted.isIdentity());
|
||||
QCOMPARE(matrix.type(), inverted.type());
|
||||
|
||||
QVERIFY((matrix * inverted).isIdentity());
|
||||
QVERIFY((inverted * matrix).isIdentity());
|
||||
|
@ -203,8 +203,8 @@ void tst_QCssParser::scanner()
|
||||
QCss::Scanner::scan(QCss::Scanner::preprocess(QString::fromUtf8(inputFile.readAll())), &symbols);
|
||||
|
||||
QVERIFY(symbols.count() > 1);
|
||||
QVERIFY(symbols.last().token == QCss::S);
|
||||
QVERIFY(symbols.last().lexem() == QLatin1String("\n"));
|
||||
QCOMPARE(symbols.last().token, QCss::S);
|
||||
QCOMPARE(symbols.last().lexem(), QLatin1String("\n"));
|
||||
symbols.remove(symbols.count() - 1, 1);
|
||||
|
||||
QFile outputFile(output);
|
||||
@ -861,7 +861,7 @@ void tst_QCssParser::colorValue()
|
||||
QCss::Declaration decl;
|
||||
QVERIFY(parser.parseNextDeclaration(&decl));
|
||||
const QColor col = decl.colorValue();
|
||||
QVERIFY(expectedColor.isValid() == col.isValid());
|
||||
QCOMPARE(expectedColor.isValid(), col.isValid());
|
||||
QCOMPARE(col, expectedColor);
|
||||
}
|
||||
|
||||
@ -1304,7 +1304,7 @@ void tst_QCssParser::rulesForNode()
|
||||
decls += rules.at(i).declarations;
|
||||
}
|
||||
|
||||
QVERIFY(decls.count() == declCount);
|
||||
QCOMPARE(decls.count(), declCount);
|
||||
|
||||
if (declCount > 0)
|
||||
QCOMPARE(decls.at(0).d->values.at(0).variant.toString(), value0);
|
||||
@ -1364,7 +1364,7 @@ void tst_QCssParser::shorthandBackgroundProperty()
|
||||
v.extractBackground(&brush, &image, &repeat, &alignment, &origin, &attachment, &ignoredOrigin);
|
||||
|
||||
QFETCH(QBrush, expectedBrush);
|
||||
QVERIFY(expectedBrush.color() == brush.color());
|
||||
QCOMPARE(expectedBrush.color(), brush.color());
|
||||
|
||||
QTEST(image, "expectedImage");
|
||||
QTEST(int(repeat), "expectedRepeatValue");
|
||||
@ -1372,7 +1372,7 @@ void tst_QCssParser::shorthandBackgroundProperty()
|
||||
|
||||
//QTBUG-9674 : a second evaluation should give the same results
|
||||
QVERIFY(v.extractBackground(&brush, &image, &repeat, &alignment, &origin, &attachment, &ignoredOrigin));
|
||||
QVERIFY(expectedBrush.color() == brush.color());
|
||||
QCOMPARE(expectedBrush.color(), brush.color());
|
||||
QTEST(image, "expectedImage");
|
||||
QTEST(int(repeat), "expectedRepeatValue");
|
||||
QTEST(int(alignment), "expectedAlignment");
|
||||
@ -1438,7 +1438,7 @@ void tst_QCssParser::pseudoElement()
|
||||
decls += rules.at(i).declarations;
|
||||
|
||||
}
|
||||
QVERIFY(decls.count() == declCount);
|
||||
QCOMPARE(decls.count(), declCount);
|
||||
}
|
||||
|
||||
void tst_QCssParser::gradient_data()
|
||||
@ -1517,21 +1517,21 @@ void tst_QCssParser::gradient()
|
||||
QBrush sbg, abg;
|
||||
QVERIFY(ve.extractPalette(&fg, &sfg, &sbg, &abg));
|
||||
if (type == "linear") {
|
||||
QVERIFY(sbg.style() == Qt::LinearGradientPattern);
|
||||
QCOMPARE(sbg.style(), Qt::LinearGradientPattern);
|
||||
const QLinearGradient *lg = static_cast<const QLinearGradient *>(sbg.gradient());
|
||||
QCOMPARE(lg->start(), start);
|
||||
QCOMPARE(lg->finalStop(), finalStop);
|
||||
} else if (type == "conical") {
|
||||
QVERIFY(sbg.style() == Qt::ConicalGradientPattern);
|
||||
QCOMPARE(sbg.style(), Qt::ConicalGradientPattern);
|
||||
const QConicalGradient *cg = static_cast<const QConicalGradient *>(sbg.gradient());
|
||||
QCOMPARE(cg->center(), start);
|
||||
}
|
||||
const QGradient *g = sbg.gradient();
|
||||
QCOMPARE(g->spread(), QGradient::Spread(spread));
|
||||
QVERIFY(g->stops().at(0).first == stop0);
|
||||
QVERIFY(g->stops().at(0).second == color0);
|
||||
QVERIFY(g->stops().at(1).first == stop1);
|
||||
QVERIFY(g->stops().at(1).second == color1);
|
||||
QCOMPARE(g->stops().at(0).first, stop0);
|
||||
QCOMPARE(g->stops().at(0).second, color0);
|
||||
QCOMPARE(g->stops().at(1).first, stop1);
|
||||
QCOMPARE(g->stops().at(1).second, color1);
|
||||
}
|
||||
|
||||
void tst_QCssParser::extractFontFamily_data()
|
||||
@ -1637,15 +1637,15 @@ void tst_QCssParser::extractBorder()
|
||||
QSize radii[4];
|
||||
|
||||
extractor.extractBorder(widths, colors, styles, radii);
|
||||
QVERIFY(widths[QCss::TopEdge] == expectedTopWidth);
|
||||
QVERIFY(styles[QCss::TopEdge] == expectedTopStyle);
|
||||
QVERIFY(colors[QCss::TopEdge] == expectedTopColor);
|
||||
QCOMPARE(widths[QCss::TopEdge], expectedTopWidth);
|
||||
QCOMPARE(int(styles[QCss::TopEdge]), expectedTopStyle);
|
||||
QCOMPARE(colors[QCss::TopEdge].color(), expectedTopColor);
|
||||
|
||||
//QTBUG-9674 : a second evaluation should give the same results
|
||||
QVERIFY(extractor.extractBorder(widths, colors, styles, radii));
|
||||
QVERIFY(widths[QCss::TopEdge] == expectedTopWidth);
|
||||
QVERIFY(styles[QCss::TopEdge] == expectedTopStyle);
|
||||
QVERIFY(colors[QCss::TopEdge] == expectedTopColor);
|
||||
QCOMPARE(widths[QCss::TopEdge], expectedTopWidth);
|
||||
QCOMPARE(int(styles[QCss::TopEdge]), expectedTopStyle);
|
||||
QCOMPARE(colors[QCss::TopEdge].color(), expectedTopColor);
|
||||
}
|
||||
|
||||
void tst_QCssParser::noTextDecoration()
|
||||
|
@ -217,15 +217,15 @@ void tst_QFont::exactMatch()
|
||||
|| fontinfo.family().isEmpty());
|
||||
}
|
||||
if (font.pointSize() != -1) {
|
||||
QVERIFY(font.pointSize() == fontinfo.pointSize());
|
||||
QCOMPARE(font.pointSize(), fontinfo.pointSize());
|
||||
} else {
|
||||
QVERIFY(font.pixelSize() == fontinfo.pixelSize());
|
||||
QCOMPARE(font.pixelSize(), fontinfo.pixelSize());
|
||||
}
|
||||
QVERIFY(font.italic() == fontinfo.italic());
|
||||
QCOMPARE(font.italic(), fontinfo.italic());
|
||||
if (font.weight() != fontinfo.weight()) {
|
||||
qDebug("font is %s", font.toString().toLatin1().constData());
|
||||
}
|
||||
QVERIFY(font.weight() == fontinfo.weight());
|
||||
QCOMPARE(font.weight(), fontinfo.weight());
|
||||
} else {
|
||||
font.setFixedPitch(!fontinfo.fixedPitch());
|
||||
QFontInfo fontinfo1(font);
|
||||
@ -274,12 +274,12 @@ void tst_QFont::exactMatch()
|
||||
|| fontinfo.family().contains(font.family())
|
||||
|| fontinfo.family().isEmpty());
|
||||
if (font.pointSize() != -1) {
|
||||
QVERIFY(font.pointSize() == fontinfo.pointSize());
|
||||
QCOMPARE(font.pointSize(), fontinfo.pointSize());
|
||||
} else {
|
||||
QVERIFY(font.pixelSize() == fontinfo.pixelSize());
|
||||
QCOMPARE(font.pixelSize(), fontinfo.pixelSize());
|
||||
}
|
||||
QVERIFY(font.italic() == fontinfo.italic());
|
||||
QVERIFY(font.weight() == fontinfo.weight());
|
||||
QCOMPARE(font.italic(), fontinfo.italic());
|
||||
QCOMPARE(font.weight(), fontinfo.weight());
|
||||
} else {
|
||||
font.setFixedPitch(!fontinfo.fixedPitch());
|
||||
QFontInfo fontinfo1(font, (QFont::Script) script);
|
||||
@ -371,42 +371,42 @@ void tst_QFont::compare()
|
||||
QVERIFY(font != font2);
|
||||
QCOMPARE(font < font2,!(font2 < font));
|
||||
font2.setItalic(false);
|
||||
QVERIFY(font == font2);
|
||||
QCOMPARE(font, font2);
|
||||
QVERIFY(!(font < font2));
|
||||
|
||||
font2.setWeight(QFont::Bold);
|
||||
QVERIFY(font != font2);
|
||||
QCOMPARE(font < font2,!(font2 < font));
|
||||
font2.setWeight(QFont::Normal);
|
||||
QVERIFY(font == font2);
|
||||
QCOMPARE(font, font2);
|
||||
QVERIFY(!(font < font2));
|
||||
|
||||
font.setUnderline(true);
|
||||
QVERIFY(font != font2);
|
||||
QCOMPARE(font < font2,!(font2 < font));
|
||||
font.setUnderline(false);
|
||||
QVERIFY(font == font2);
|
||||
QCOMPARE(font, font2);
|
||||
QVERIFY(!(font < font2));
|
||||
|
||||
font.setStrikeOut(true);
|
||||
QVERIFY(font != font2);
|
||||
QCOMPARE(font < font2,!(font2 < font));
|
||||
font.setStrikeOut(false);
|
||||
QVERIFY(font == font2);
|
||||
QCOMPARE(font, font2);
|
||||
QVERIFY(!(font < font2));
|
||||
|
||||
font.setOverline(true);
|
||||
QVERIFY(font != font2);
|
||||
QCOMPARE(font < font2,!(font2 < font));
|
||||
font.setOverline(false);
|
||||
QVERIFY(font == font2);
|
||||
QCOMPARE(font, font2);
|
||||
QVERIFY(!(font < font2));
|
||||
|
||||
font.setCapitalization(QFont::SmallCaps);
|
||||
QVERIFY(font != font2);
|
||||
QCOMPARE(font < font2,!(font2 < font));
|
||||
font.setCapitalization(QFont::MixedCase);
|
||||
QVERIFY(font == font2);
|
||||
QCOMPARE(font, font2);
|
||||
QVERIFY(!(font < font2));
|
||||
}
|
||||
}
|
||||
@ -426,27 +426,27 @@ void tst_QFont::resolve()
|
||||
font1.setWeight(QFont::Bold);
|
||||
QFont font2 = font1.resolve(font);
|
||||
|
||||
QVERIFY(font2.weight() == font1.weight());
|
||||
QCOMPARE(font2.weight(), font1.weight());
|
||||
|
||||
QVERIFY(font2.pointSize() == font.pointSize());
|
||||
QVERIFY(font2.italic() == font.italic());
|
||||
QVERIFY(font2.underline() == font.underline());
|
||||
QVERIFY(font2.overline() == font.overline());
|
||||
QVERIFY(font2.strikeOut() == font.strikeOut());
|
||||
QVERIFY(font2.stretch() == font.stretch());
|
||||
QCOMPARE(font2.pointSize(), font.pointSize());
|
||||
QCOMPARE(font2.italic(), font.italic());
|
||||
QCOMPARE(font2.underline(), font.underline());
|
||||
QCOMPARE(font2.overline(), font.overline());
|
||||
QCOMPARE(font2.strikeOut(), font.strikeOut());
|
||||
QCOMPARE(font2.stretch(), font.stretch());
|
||||
|
||||
QFont font3;
|
||||
font3.setStretch(QFont::UltraCondensed);
|
||||
QFont font4 = font3.resolve(font1).resolve(font);
|
||||
|
||||
QVERIFY(font4.stretch() == font3.stretch());
|
||||
QCOMPARE(font4.stretch(), font3.stretch());
|
||||
|
||||
QVERIFY(font4.weight() == font.weight());
|
||||
QVERIFY(font4.pointSize() == font.pointSize());
|
||||
QVERIFY(font4.italic() == font.italic());
|
||||
QVERIFY(font4.underline() == font.underline());
|
||||
QVERIFY(font4.overline() == font.overline());
|
||||
QVERIFY(font4.strikeOut() == font.strikeOut());
|
||||
QCOMPARE(font4.weight(), font.weight());
|
||||
QCOMPARE(font4.pointSize(), font.pointSize());
|
||||
QCOMPARE(font4.italic(), font.italic());
|
||||
QCOMPARE(font4.underline(), font.underline());
|
||||
QCOMPARE(font4.overline(), font.overline());
|
||||
QCOMPARE(font4.strikeOut(), font.strikeOut());
|
||||
|
||||
|
||||
QFont f1,f2,f3;
|
||||
@ -479,8 +479,8 @@ void tst_QFont::resetFont()
|
||||
|
||||
child->setFont(QFont()); // reset font
|
||||
|
||||
QVERIFY(child->font().resolve() == 0);
|
||||
QVERIFY(child->font().pointSize() == parent.font().pointSize());
|
||||
QCOMPARE(child->font().resolve(), uint(0));
|
||||
QCOMPARE(child->font().pointSize(), parent.font().pointSize());
|
||||
QVERIFY(parent.font().resolve() != 0);
|
||||
}
|
||||
#endif
|
||||
@ -728,24 +728,24 @@ void tst_QFont::sharing()
|
||||
QCOMPARE(QFontPrivate::get(f)->engineData->ref.load(), 1 + refs_by_cache);
|
||||
|
||||
QFont f2(f);
|
||||
QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f));
|
||||
QCOMPARE(QFontPrivate::get(f2), QFontPrivate::get(f));
|
||||
QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2);
|
||||
QVERIFY(QFontPrivate::get(f2)->engineData);
|
||||
QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData);
|
||||
QCOMPARE(QFontPrivate::get(f2)->engineData, QFontPrivate::get(f)->engineData);
|
||||
QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1 + refs_by_cache);
|
||||
|
||||
f2.setKerning(!f.kerning());
|
||||
QVERIFY(QFontPrivate::get(f2) != QFontPrivate::get(f));
|
||||
QCOMPARE(QFontPrivate::get(f2)->ref.load(), 1);
|
||||
QVERIFY(QFontPrivate::get(f2)->engineData);
|
||||
QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData);
|
||||
QCOMPARE(QFontPrivate::get(f2)->engineData, QFontPrivate::get(f)->engineData);
|
||||
QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 2 + refs_by_cache);
|
||||
|
||||
f2 = f;
|
||||
QVERIFY(QFontPrivate::get(f2) == QFontPrivate::get(f));
|
||||
QCOMPARE(QFontPrivate::get(f2), QFontPrivate::get(f));
|
||||
QCOMPARE(QFontPrivate::get(f2)->ref.load(), 2);
|
||||
QVERIFY(QFontPrivate::get(f2)->engineData);
|
||||
QVERIFY(QFontPrivate::get(f2)->engineData == QFontPrivate::get(f)->engineData);
|
||||
QCOMPARE(QFontPrivate::get(f2)->engineData, QFontPrivate::get(f)->engineData);
|
||||
QCOMPARE(QFontPrivate::get(f2)->engineData->ref.load(), 1 + refs_by_cache);
|
||||
|
||||
if (f.pointSize() > 0)
|
||||
|
@ -170,7 +170,7 @@ void tst_QSyntaxHighlighter::basic()
|
||||
QVERIFY(hl->highlighted);
|
||||
QVERIFY(lout->documentChangedCalled);
|
||||
|
||||
QVERIFY(doc->begin().layout()->formats() == formats);
|
||||
QCOMPARE(doc->begin().layout()->formats(), formats);
|
||||
}
|
||||
|
||||
class CommentTestHighlighter : public QSyntaxHighlighter
|
||||
|
@ -102,7 +102,7 @@ void tst_QTextBlock::fragmentOverBlockBoundaries()
|
||||
// Block separators are always a fragment of their self. Thus:
|
||||
// |Hello|\b|World|\b|
|
||||
#if !defined(Q_OS_WIN)
|
||||
QVERIFY(doc->docHandle()->fragmentMap().numNodes() == 4);
|
||||
QCOMPARE(doc->docHandle()->fragmentMap().numNodes(), 4);
|
||||
#endif
|
||||
QCOMPARE(cursor.block().text(), QString("Hello"));
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
@ -126,7 +126,7 @@ void tst_QTextBlock::excludeParagraphSeparatorFragment()
|
||||
|
||||
++it;
|
||||
QVERIFY(it.atEnd());
|
||||
QVERIFY(it == block.end());
|
||||
QCOMPARE(it, block.end());
|
||||
}
|
||||
|
||||
void tst_QTextBlock::backwardsBlockIterator()
|
||||
|
@ -178,15 +178,15 @@ void tst_QTextCursor::navigation1()
|
||||
QVERIFY(doc->toPlainText() == "Hello World");
|
||||
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.position() == 11);
|
||||
QCOMPARE(cursor.position(), 11);
|
||||
cursor.deletePreviousChar();
|
||||
QVERIFY(cursor.position() == 10);
|
||||
QCOMPARE(cursor.position(), 10);
|
||||
cursor.deletePreviousChar();
|
||||
cursor.deletePreviousChar();
|
||||
cursor.deletePreviousChar();
|
||||
cursor.deletePreviousChar();
|
||||
cursor.deletePreviousChar();
|
||||
QVERIFY(doc->toPlainText() == "Hello");
|
||||
QCOMPARE(doc->toPlainText(), QLatin1String("Hello"));
|
||||
|
||||
QTextCursor otherCursor(doc);
|
||||
otherCursor.movePosition(QTextCursor::Start);
|
||||
@ -195,12 +195,12 @@ void tst_QTextCursor::navigation1()
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
QVERIFY(cursor != otherCursor);
|
||||
otherCursor.insertText("Hey");
|
||||
QVERIFY(cursor.position() == 5);
|
||||
QCOMPARE(cursor.position(), 5);
|
||||
|
||||
doc->undo();
|
||||
QVERIFY(cursor.position() == 2);
|
||||
QCOMPARE(cursor.position(), 2);
|
||||
doc->redo();
|
||||
QVERIFY(cursor.position() == 5);
|
||||
QCOMPARE(cursor.position(), 5);
|
||||
|
||||
doc->undo();
|
||||
|
||||
@ -209,29 +209,29 @@ void tst_QTextCursor::navigation1()
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 6);
|
||||
QVERIFY(cursor.position() == 6);
|
||||
QCOMPARE(cursor.position(), 6);
|
||||
otherCursor = cursor;
|
||||
otherCursor.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, 2);
|
||||
otherCursor.deletePreviousChar();
|
||||
otherCursor.deletePreviousChar();
|
||||
otherCursor.deletePreviousChar();
|
||||
QVERIFY(cursor.position() == 5);
|
||||
QCOMPARE(cursor.position(), 5);
|
||||
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.insertBlock();
|
||||
{
|
||||
int oldPos = cursor.position();
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.position() == oldPos);
|
||||
QCOMPARE(cursor.position(), oldPos);
|
||||
}
|
||||
QVERIFY(cursor.atBlockStart());
|
||||
QVERIFY(cursor.position() == 9);
|
||||
QCOMPARE(cursor.position(), 9);
|
||||
|
||||
QTextCharFormat fmt;
|
||||
fmt.setForeground(Qt::blue);
|
||||
cursor.insertText("Test", fmt);
|
||||
QVERIFY(fmt == cursor.charFormat());
|
||||
QVERIFY(cursor.position() == 13);
|
||||
QCOMPARE(fmt, cursor.charFormat());
|
||||
QCOMPARE(cursor.position(), 13);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::navigation2_data()
|
||||
@ -573,8 +573,8 @@ void tst_QTextCursor::insertBlock()
|
||||
QTextBlockFormat fmt;
|
||||
fmt.setTopMargin(100);
|
||||
cursor.insertBlock(fmt);
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QVERIFY(cursor.blockFormat() == fmt);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QCOMPARE(cursor.blockFormat(), fmt);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::insertWithBlockSeparator1()
|
||||
@ -584,28 +584,28 @@ void tst_QTextCursor::insertWithBlockSeparator1()
|
||||
cursor.insertText(text);
|
||||
|
||||
cursor.movePosition(QTextCursor::PreviousBlock);
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QCOMPARE(cursor.position(), 0);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 6);
|
||||
QCOMPARE(cursor.position(), 6);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::insertWithBlockSeparator2()
|
||||
{
|
||||
cursor.insertText(QString(QChar::ParagraphSeparator));
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::insertWithBlockSeparator3()
|
||||
{
|
||||
cursor.insertText(QString(QChar::ParagraphSeparator) + "Hi" + QString(QChar::ParagraphSeparator));
|
||||
QVERIFY(cursor.position() == 4);
|
||||
QCOMPARE(cursor.position(), 4);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::insertWithBlockSeparator4()
|
||||
{
|
||||
cursor.insertText(QString(QChar::ParagraphSeparator) + QString(QChar::ParagraphSeparator));
|
||||
QVERIFY(cursor.position() == 2);
|
||||
QCOMPARE(cursor.position(), 2);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::clearObjectType1()
|
||||
@ -656,7 +656,7 @@ void tst_QTextCursor::comparisonOperators1()
|
||||
midCursor.movePosition(QTextCursor::NextWord);
|
||||
|
||||
QVERIFY(midCursor <= cursor);
|
||||
QVERIFY(midCursor == cursor);
|
||||
QCOMPARE(midCursor, cursor);
|
||||
QVERIFY(midCursor >= cursor);
|
||||
|
||||
QVERIFY(midCursor > startCursor);
|
||||
@ -690,7 +690,7 @@ void tst_QTextCursor::comparisonOperators2()
|
||||
QTextCursor cursor2(&doc2);
|
||||
|
||||
QVERIFY(cursor1 != cursor2);
|
||||
QVERIFY(cursor1 == QTextCursor(&doc1));
|
||||
QCOMPARE(cursor1, QTextCursor(&doc1));
|
||||
}
|
||||
|
||||
void tst_QTextCursor::selection1()
|
||||
@ -718,97 +718,97 @@ void tst_QTextCursor::dontCopyTableAttributes()
|
||||
|
||||
void tst_QTextCursor::checkFrame1()
|
||||
{
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QCOMPARE(cursor.position(), 0);
|
||||
QPointer<QTextFrame> frame = cursor.insertFrame(QTextFrameFormat());
|
||||
QVERIFY(frame != 0);
|
||||
|
||||
QTextFrame *root = frame->parentFrame();
|
||||
QVERIFY(root != 0);
|
||||
|
||||
QVERIFY(frame->firstPosition() == 1);
|
||||
QVERIFY(frame->lastPosition() == 1);
|
||||
QCOMPARE(frame->firstPosition(), 1);
|
||||
QCOMPARE(frame->lastPosition(), 1);
|
||||
QVERIFY(frame->parentFrame() != 0);
|
||||
QVERIFY(root->childFrames().size() == 1);
|
||||
QCOMPARE(root->childFrames().size(), 1);
|
||||
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QVERIFY(cursor.selectionStart() == 1);
|
||||
QVERIFY(cursor.selectionEnd() == 1);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QCOMPARE(cursor.selectionStart(), 1);
|
||||
QCOMPARE(cursor.selectionEnd(), 1);
|
||||
|
||||
doc->undo();
|
||||
|
||||
QVERIFY(!frame);
|
||||
QVERIFY(root->childFrames().size() == 0);
|
||||
QCOMPARE(root->childFrames().size(), 0);
|
||||
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QVERIFY(cursor.selectionStart() == 0);
|
||||
QVERIFY(cursor.selectionEnd() == 0);
|
||||
QCOMPARE(cursor.position(), 0);
|
||||
QCOMPARE(cursor.selectionStart(), 0);
|
||||
QCOMPARE(cursor.selectionEnd(), 0);
|
||||
|
||||
doc->redo();
|
||||
|
||||
frame = doc->frameAt(1);
|
||||
|
||||
QVERIFY(frame);
|
||||
QVERIFY(frame->firstPosition() == 1);
|
||||
QVERIFY(frame->lastPosition() == 1);
|
||||
QCOMPARE(frame->firstPosition(), 1);
|
||||
QCOMPARE(frame->lastPosition(), 1);
|
||||
QVERIFY(frame->parentFrame() != 0);
|
||||
QVERIFY(root->childFrames().size() == 1);
|
||||
QCOMPARE(root->childFrames().size(), 1);
|
||||
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QVERIFY(cursor.selectionStart() == 1);
|
||||
QVERIFY(cursor.selectionEnd() == 1);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QCOMPARE(cursor.selectionStart(), 1);
|
||||
QCOMPARE(cursor.selectionEnd(), 1);
|
||||
|
||||
// cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
|
||||
// QVERIFY(cursor.position() == 2);
|
||||
// QVERIFY(cursor.selectionStart() == 0);
|
||||
// QVERIFY(cursor.selectionEnd() == 2);
|
||||
// QCOMPARE(cursor.position(), 2);
|
||||
// QCOMPARE(cursor.selectionStart(), 0);
|
||||
// QCOMPARE(cursor.selectionEnd(), 2);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::checkFrame2()
|
||||
{
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QCOMPARE(cursor.position(), 0);
|
||||
cursor.insertText("A");
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
cursor.movePosition(QTextCursor::Start, QTextCursor::KeepAnchor);
|
||||
|
||||
QPointer<QTextFrame> frame = cursor.insertFrame(QTextFrameFormat());
|
||||
QTextFrame *root = frame->parentFrame();
|
||||
|
||||
QVERIFY(frame->firstPosition() == 1);
|
||||
QVERIFY(frame->lastPosition() == 2);
|
||||
QCOMPARE(frame->firstPosition(), 1);
|
||||
QCOMPARE(frame->lastPosition(), 2);
|
||||
QVERIFY(frame->parentFrame() != 0);
|
||||
QVERIFY(root->childFrames().size() == 1);
|
||||
QCOMPARE(root->childFrames().size(), 1);
|
||||
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QVERIFY(cursor.selectionStart() == 1);
|
||||
QVERIFY(cursor.selectionEnd() == 2);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QCOMPARE(cursor.selectionStart(), 1);
|
||||
QCOMPARE(cursor.selectionEnd(), 2);
|
||||
|
||||
doc->undo();
|
||||
|
||||
QVERIFY(!frame);
|
||||
QVERIFY(root->childFrames().size() == 0);
|
||||
QCOMPARE(root->childFrames().size(), 0);
|
||||
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QVERIFY(cursor.selectionStart() == 0);
|
||||
QVERIFY(cursor.selectionEnd() == 1);
|
||||
QCOMPARE(cursor.position(), 0);
|
||||
QCOMPARE(cursor.selectionStart(), 0);
|
||||
QCOMPARE(cursor.selectionEnd(), 1);
|
||||
|
||||
doc->redo();
|
||||
|
||||
frame = doc->frameAt(1);
|
||||
|
||||
QVERIFY(frame);
|
||||
QVERIFY(frame->firstPosition() == 1);
|
||||
QVERIFY(frame->lastPosition() == 2);
|
||||
QCOMPARE(frame->firstPosition(), 1);
|
||||
QCOMPARE(frame->lastPosition(), 2);
|
||||
QVERIFY(frame->parentFrame() != 0);
|
||||
QVERIFY(root->childFrames().size() == 1);
|
||||
QCOMPARE(root->childFrames().size(), 1);
|
||||
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QVERIFY(cursor.selectionStart() == 1);
|
||||
QVERIFY(cursor.selectionEnd() == 2);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QCOMPARE(cursor.selectionStart(), 1);
|
||||
QCOMPARE(cursor.selectionEnd(), 2);
|
||||
|
||||
cursor.movePosition(QTextCursor::Left, QTextCursor::KeepAnchor);
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QVERIFY(cursor.selectionStart() == 0);
|
||||
QVERIFY(cursor.selectionEnd() == 3);
|
||||
QCOMPARE(cursor.position(), 0);
|
||||
QCOMPARE(cursor.selectionStart(), 0);
|
||||
QCOMPARE(cursor.selectionEnd(), 3);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::insertBlockToUseCharFormat()
|
||||
@ -833,9 +833,9 @@ void tst_QTextCursor::insertBlockToUseCharFormat()
|
||||
|
||||
void tst_QTextCursor::tableMovement()
|
||||
{
|
||||
QVERIFY(cursor.position() == 0);
|
||||
QCOMPARE(cursor.position(), 0);
|
||||
cursor.insertText("AA");
|
||||
QVERIFY(cursor.position() == 2);
|
||||
QCOMPARE(cursor.position(), 2);
|
||||
cursor.movePosition(QTextCursor::Left);
|
||||
|
||||
cursor.insertTable(3, 3);
|
||||
@ -1030,7 +1030,7 @@ void tst_QTextCursor::insertBlockShouldRemoveSelection()
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(!cursor.hasSelection());
|
||||
QVERIFY(doc->toPlainText().indexOf("Hello") == -1);
|
||||
QCOMPARE(doc->toPlainText().indexOf("Hello"), -1);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::insertBlockShouldRemoveSelection2()
|
||||
@ -1046,7 +1046,7 @@ void tst_QTextCursor::insertBlockShouldRemoveSelection2()
|
||||
cursor.insertBlock(fmt);
|
||||
|
||||
QVERIFY(!cursor.hasSelection());
|
||||
QVERIFY(doc->toPlainText().indexOf("Hello") == -1);
|
||||
QCOMPARE(doc->toPlainText().indexOf("Hello"), -1);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::mergeCellShouldUpdateSelection()
|
||||
@ -1159,7 +1159,7 @@ void tst_QTextCursor::setBlockFormatInTable()
|
||||
cursor.setBlockFormat(fmt);
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
QVERIFY(cursor.blockFormat().background().color() == Qt::blue);
|
||||
QCOMPARE(cursor.blockFormat().background().color(), QColor(Qt::blue));
|
||||
}
|
||||
|
||||
void tst_QTextCursor::blockCharFormat2()
|
||||
@ -1174,7 +1174,7 @@ void tst_QTextCursor::blockCharFormat2()
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.insertText("Red");
|
||||
cursor.movePosition(QTextCursor::PreviousCharacter);
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::red);
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), QColor(Qt::red));
|
||||
}
|
||||
|
||||
void tst_QTextCursor::blockCharFormat3()
|
||||
@ -1189,21 +1189,23 @@ void tst_QTextCursor::blockCharFormat3()
|
||||
cursor.insertText("Test");
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::green);
|
||||
const QColor red(Qt::red);
|
||||
const QColor green(Qt::green);
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), green);
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::green);
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), green);
|
||||
|
||||
fmt.setForeground(Qt::red);
|
||||
cursor.setBlockCharFormat(fmt);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::red);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), red);
|
||||
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::green);
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), green);
|
||||
|
||||
cursor.insertText("Test");
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::green);
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), green);
|
||||
|
||||
cursor.select(QTextCursor::Document);
|
||||
cursor.removeSelectedText();
|
||||
@ -1212,7 +1214,7 @@ void tst_QTextCursor::blockCharFormat3()
|
||||
QVERIFY(cursor.atStart());
|
||||
|
||||
cursor.insertText("Test");
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::red);
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), red);
|
||||
}
|
||||
|
||||
void tst_QTextCursor::blockCharFormat()
|
||||
@ -1222,12 +1224,12 @@ void tst_QTextCursor::blockCharFormat()
|
||||
cursor.insertBlock(QTextBlockFormat(), fmt);
|
||||
cursor.insertText("Hm");
|
||||
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::blue);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::blue));
|
||||
|
||||
fmt.setForeground(Qt::red);
|
||||
|
||||
cursor.setBlockCharFormat(fmt);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::red);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::red));
|
||||
}
|
||||
|
||||
void tst_QTextCursor::blockCharFormatOnSelection()
|
||||
@ -1249,11 +1251,11 @@ void tst_QTextCursor::blockCharFormatOnSelection()
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::blue);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::blue));
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::red);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::red));
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::white);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::white));
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
@ -1264,17 +1266,17 @@ void tst_QTextCursor::blockCharFormatOnSelection()
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::cyan);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::cyan));
|
||||
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
cursor.movePosition(QTextCursor::Right);
|
||||
QVERIFY(cursor.charFormat().foreground().color() == Qt::green);
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), QColor(Qt::green));
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::cyan);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::cyan));
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockCharFormat().foreground().color() == Qt::white);
|
||||
QCOMPARE(cursor.blockCharFormat().foreground().color(), QColor(Qt::white));
|
||||
}
|
||||
|
||||
void tst_QTextCursor::anchorInitialized1()
|
||||
@ -1404,7 +1406,7 @@ void tst_QTextCursor::selectBlock()
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.blockFormat().alignment() == Qt::AlignHCenter);
|
||||
QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignHCenter);
|
||||
QCOMPARE(cursor.block().text(), QString("blah"));
|
||||
}
|
||||
|
||||
@ -1449,7 +1451,7 @@ void tst_QTextCursor::insertFragmentShouldUseCurrentCharFormat()
|
||||
cursor.insertFragment(fragment);
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat() == fmt);
|
||||
QCOMPARE(cursor.charFormat(), fmt);
|
||||
}
|
||||
|
||||
int tst_QTextCursor::blockCount()
|
||||
@ -1910,15 +1912,15 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo()
|
||||
int cursorPositionAfter = cursor.position();
|
||||
cursor.endEditBlock();
|
||||
|
||||
QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD");
|
||||
QCOMPARE(doc->toPlainText(), QLatin1String("*AAAA*BBBB*CCCC*DDDD"));
|
||||
QCOMPARE(12, cursorPositionBefore);
|
||||
QCOMPARE(1, cursorPositionAfter);
|
||||
|
||||
doc->undo(&cursor);
|
||||
QVERIFY(doc->toPlainText() == "AAAABBBBCCCCDDDD");
|
||||
QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBBCCCCDDDD"));
|
||||
QCOMPARE(cursor.position(), cursorPositionBefore);
|
||||
doc->redo(&cursor);
|
||||
QVERIFY(doc->toPlainText() == "*AAAA*BBBB*CCCC*DDDD");
|
||||
QCOMPARE(doc->toPlainText(), QLatin1String("*AAAA*BBBB*CCCC*DDDD"));
|
||||
QCOMPARE(cursor.position(), cursorPositionAfter);
|
||||
}
|
||||
|
||||
@ -1932,11 +1934,11 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo2()
|
||||
cursor.insertText("AAAABBBBCCCCDDDD");
|
||||
cursor.endEditBlock();
|
||||
doc->undo(&cursor);
|
||||
QVERIFY(doc->toPlainText() == "AAAABBBB");
|
||||
QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBB"));
|
||||
QCOMPARE(cursor.position(), cursorPositionBefore);
|
||||
|
||||
cursor.insertText("CCCC");
|
||||
QVERIFY(doc->toPlainText() == "AAAABBBBCCCC");
|
||||
QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBBCCCC"));
|
||||
|
||||
cursorPositionBefore = cursor.position();
|
||||
cursor.setPosition(0, QTextCursor::KeepAnchor);
|
||||
@ -1951,7 +1953,7 @@ void tst_QTextCursor::cursorPositionWithBlockUndoAndRedo2()
|
||||
doc->undo(&cursor);
|
||||
|
||||
|
||||
QVERIFY(doc->toPlainText() == "AAAABBBBCCCC");
|
||||
QCOMPARE(doc->toPlainText(), QLatin1String("AAAABBBBCCCC"));
|
||||
QCOMPARE(cursor.position(), cursorPositionBefore);
|
||||
}
|
||||
|
||||
|
@ -744,7 +744,7 @@ void tst_QTextDocument::mightBeRichText()
|
||||
{
|
||||
QFETCH(QString, input);
|
||||
QFETCH(bool, result);
|
||||
QVERIFY(result == Qt::mightBeRichText(input));
|
||||
QCOMPARE(result, Qt::mightBeRichText(input));
|
||||
}
|
||||
|
||||
Q_DECLARE_METATYPE(QTextDocumentFragment)
|
||||
@ -2222,7 +2222,7 @@ void tst_QTextDocument::clonePreservesUserStates()
|
||||
b2 = b2.next();
|
||||
QCOMPARE(b1.userState(), b2.userState());
|
||||
}
|
||||
QVERIFY(b2 == clone->end());
|
||||
QCOMPARE(b2, clone->end());
|
||||
delete clone;
|
||||
}
|
||||
|
||||
@ -2269,7 +2269,7 @@ void tst_QTextDocument::resolvedFontInEmptyFormat()
|
||||
doc->setDefaultFont(font);
|
||||
QTextCharFormat fmt = doc->begin().charFormat();
|
||||
QVERIFY(fmt.properties().isEmpty());
|
||||
QVERIFY(fmt.font() == font);
|
||||
QCOMPARE(fmt.font(), font);
|
||||
}
|
||||
|
||||
void tst_QTextDocument::defaultRootFrameMargin()
|
||||
@ -2369,6 +2369,7 @@ void tst_QTextDocument::deleteTextObjectsOnClear()
|
||||
|
||||
void tst_QTextDocument::defaultStyleSheet()
|
||||
{
|
||||
const QColor green("green");
|
||||
const QString sheet("p { background-color: green; }");
|
||||
QVERIFY(doc->defaultStyleSheet().isEmpty());
|
||||
doc->setDefaultStyleSheet(sheet);
|
||||
@ -2376,30 +2377,30 @@ void tst_QTextDocument::defaultStyleSheet()
|
||||
|
||||
cursor.insertHtml("<p>test");
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
|
||||
doc->clear();
|
||||
cursor.insertHtml("<p>test");
|
||||
fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
|
||||
QTextDocument *clone = doc->clone();
|
||||
QCOMPARE(clone->defaultStyleSheet(), sheet);
|
||||
cursor = QTextCursor(clone);
|
||||
cursor.insertHtml("<p>test");
|
||||
fmt = clone->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
delete clone;
|
||||
|
||||
cursor = QTextCursor(doc);
|
||||
cursor.insertHtml("<p>test");
|
||||
fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
|
||||
doc->clear();
|
||||
cursor.insertHtml("<style>p { background-color: red; }</style><p>test");
|
||||
fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("red"));
|
||||
QCOMPARE(fmt.background().color(), QColor(Qt::red));
|
||||
|
||||
doc->clear();
|
||||
doc->setDefaultStyleSheet("invalid style sheet....");
|
||||
@ -2567,7 +2568,7 @@ void tst_QTextDocument::setTextPreservesUndoRedoEnabled()
|
||||
void tst_QTextDocument::firstLast()
|
||||
{
|
||||
QCOMPARE(doc->blockCount(), 1);
|
||||
QVERIFY(doc->firstBlock() == doc->lastBlock());
|
||||
QCOMPARE(doc->firstBlock(), doc->lastBlock());
|
||||
|
||||
doc->setPlainText("Hello\nTest\nWorld");
|
||||
|
||||
@ -3013,8 +3014,8 @@ void tst_QTextDocument::QTBUG27354_spaceAndSoftSpace()
|
||||
QTextBlock block = td.begin();
|
||||
while (block.isValid()) {
|
||||
QTextBlockFormat fmt = block.blockFormat();
|
||||
QVERIFY(fmt.lineHeightType() == QTextBlockFormat::SingleHeight);
|
||||
QVERIFY(fmt.lineHeight() == 0);
|
||||
QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::SingleHeight));
|
||||
QCOMPARE(fmt.lineHeight(), qreal(0));
|
||||
block = block.next();
|
||||
}
|
||||
}
|
||||
@ -3164,8 +3165,8 @@ void tst_QTextDocument::cssInheritance()
|
||||
QTextBlock block = td.begin();
|
||||
while (block.isValid()) {
|
||||
QTextBlockFormat fmt = block.blockFormat();
|
||||
QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight);
|
||||
QVERIFY(fmt.lineHeight() == 200);
|
||||
QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::ProportionalHeight));
|
||||
QCOMPARE(fmt.lineHeight(), qreal(200));
|
||||
block = block.next();
|
||||
}
|
||||
}
|
||||
@ -3175,12 +3176,12 @@ void tst_QTextDocument::cssInheritance()
|
||||
"<p style=\"line-height: 40px\">Foo</p><p>Bar</p><p>Baz</p></body></html>");
|
||||
QTextBlock block = td.begin();
|
||||
QTextBlockFormat fmt = block.blockFormat();
|
||||
QVERIFY(fmt.lineHeightType() == QTextBlockFormat::FixedHeight);
|
||||
QVERIFY(fmt.lineHeight() == 40);
|
||||
QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::FixedHeight));
|
||||
QCOMPARE(fmt.lineHeight(), qreal(40));
|
||||
block = block.next();
|
||||
fmt = block.blockFormat();
|
||||
QVERIFY(fmt.lineHeightType() == QTextBlockFormat::ProportionalHeight);
|
||||
QVERIFY(fmt.lineHeight() == 300);
|
||||
QCOMPARE(fmt.lineHeightType(), int(QTextBlockFormat::ProportionalHeight));
|
||||
QCOMPARE(fmt.lineHeight(), qreal(300));
|
||||
}
|
||||
{
|
||||
QTextDocument td;
|
||||
@ -3188,7 +3189,7 @@ void tst_QTextDocument::cssInheritance()
|
||||
"<p>Foo</p><p>Bar</p><p>Baz</p></body></html>");
|
||||
QTextBlock block = td.begin();
|
||||
while (block.isValid()) {
|
||||
QVERIFY(block.blockFormat().background() == QBrush());
|
||||
QCOMPARE(block.blockFormat().background(), QBrush());
|
||||
QVERIFY(block.charFormat().font().bold());
|
||||
block = block.next();
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ void tst_QTextDocumentFragment::html_listIndents5()
|
||||
QCOMPARE(list->format().indent(), 1);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.currentList() == list);
|
||||
QCOMPARE(cursor.currentList(), list);
|
||||
QCOMPARE(cursor.blockFormat().indent(), 0);
|
||||
}
|
||||
|
||||
@ -778,7 +778,7 @@ void tst_QTextDocumentFragment::blockCharFormatCopied()
|
||||
cleanup();
|
||||
init();
|
||||
cursor.insertFragment(frag);
|
||||
QVERIFY(cursor.blockCharFormat() == fmt);
|
||||
QCOMPARE(cursor.blockCharFormat(), fmt);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::initialBlock()
|
||||
@ -794,19 +794,19 @@ void tst_QTextDocumentFragment::clone()
|
||||
mod.setAlignment(Qt::AlignCenter);
|
||||
cursor.mergeBlockFormat(mod);
|
||||
cursor.insertText("Blah");
|
||||
QVERIFY(cursor.blockFormat().alignment() == Qt::AlignCenter);
|
||||
QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignCenter);
|
||||
QTextDocumentFragment frag(doc);
|
||||
cleanup();
|
||||
init();
|
||||
cursor.insertFragment(frag);
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
QVERIFY(cursor.blockFormat().alignment() == Qt::AlignCenter);
|
||||
QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignCenter);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::dontRemoveInitialBlockIfItHoldsObjectIndexedCharFormat()
|
||||
{
|
||||
const char html[] = "<table><tr><td>cell one<td>cell two</tr><tr><td>cell three<td>cell four</tr></table>";
|
||||
QVERIFY(doc->begin().charFormat().objectIndex() == -1);
|
||||
QCOMPARE(doc->begin().charFormat().objectIndex(), -1);
|
||||
setHtml(QString::fromLatin1(html));
|
||||
int cnt = 0;
|
||||
|
||||
@ -841,13 +841,13 @@ void tst_QTextDocumentFragment::unorderedListEnumeration()
|
||||
setHtml(QString::fromLatin1(html));
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDisc);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDisc);
|
||||
|
||||
const char html2[] = "<ul><ul><ul type=circle><li>Blah</li></ul></ul>";
|
||||
setHtml(QString::fromLatin1(html2));
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListCircle);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListCircle);
|
||||
|
||||
}
|
||||
|
||||
@ -982,7 +982,7 @@ void tst_QTextDocumentFragment::cellBlockCount()
|
||||
|
||||
int blockCount = 0;
|
||||
for (QTextFrame::iterator it = cell.begin(); !it.atEnd(); ++it) {
|
||||
QVERIFY(it.currentFrame() == 0);
|
||||
QVERIFY(!it.currentFrame());
|
||||
QVERIFY(it.currentBlock().isValid());
|
||||
++blockCount;
|
||||
}
|
||||
@ -1003,7 +1003,7 @@ void tst_QTextDocumentFragment::cellBlockCount2()
|
||||
|
||||
int blockCount = 0;
|
||||
for (QTextFrame::iterator it = cell.begin(); !it.atEnd(); ++it) {
|
||||
QVERIFY(it.currentFrame() == 0);
|
||||
QVERIFY(!it.currentFrame());
|
||||
QVERIFY(it.currentBlock().isValid());
|
||||
++blockCount;
|
||||
}
|
||||
@ -1037,7 +1037,7 @@ void tst_QTextDocumentFragment::emptyTable3()
|
||||
QCOMPARE(table->columns(), 2);
|
||||
QTextTableCell cell = table->cellAt(0, 0);
|
||||
QVERIFY(cell.isValid());
|
||||
QVERIFY(cell.firstPosition() == cell.lastPosition());
|
||||
QCOMPARE(cell.firstPosition(), cell.lastPosition());
|
||||
cell = table->cellAt(0, 1);
|
||||
QTextCursor cursor = cell.firstCursorPosition();
|
||||
cursor.setPosition(cell.lastPosition(), QTextCursor::KeepAnchor);
|
||||
@ -1065,7 +1065,7 @@ void tst_QTextDocumentFragment::inheritAlignment()
|
||||
const char html[] = "<body align=right><p>Hey";
|
||||
setHtml(QString::fromLatin1(html));
|
||||
// html alignment is absolute
|
||||
QVERIFY(doc->begin().blockFormat().alignment() == Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute));
|
||||
QCOMPARE(doc->begin().blockFormat().alignment(), Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::dontEmitEmptyNodeWhenEmptyTagIsFollowedByCloseTag()
|
||||
@ -1073,8 +1073,8 @@ void tst_QTextDocumentFragment::dontEmitEmptyNodeWhenEmptyTagIsFollowedByCloseTa
|
||||
// make sure the Hey does not end up as tag text for the img tag
|
||||
const char html[] = "<body align=right><p align=left>Blah<img></img><p>Hey";
|
||||
setHtml(QString::fromLatin1(html));
|
||||
QVERIFY(doc->begin().blockFormat().alignment() == Qt::Alignment(Qt::AlignLeft|Qt::AlignAbsolute));
|
||||
QVERIFY(doc->begin().next().blockFormat().alignment() == Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute));
|
||||
QCOMPARE(doc->begin().blockFormat().alignment(), Qt::Alignment(Qt::AlignLeft|Qt::AlignAbsolute));
|
||||
QCOMPARE(doc->begin().next().blockFormat().alignment(), Qt::Alignment(Qt::AlignRight|Qt::AlignAbsolute));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::toPlainText()
|
||||
@ -1480,19 +1480,19 @@ void tst_QTextDocumentFragment::html_subAndSuperScript()
|
||||
const char alignmentInherited[] = "<sub><font face=\"Verdana\">Subby</font></sub>";
|
||||
|
||||
setHtml(subHtml);
|
||||
QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSubScript);
|
||||
QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSubScript);
|
||||
|
||||
setHtml(subHtmlCss);
|
||||
QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSubScript);
|
||||
QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSubScript);
|
||||
|
||||
setHtml(superHtml);
|
||||
QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSuperScript);
|
||||
QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSuperScript);
|
||||
|
||||
setHtml(superHtmlCss);
|
||||
QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSuperScript);
|
||||
QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSuperScript);
|
||||
|
||||
setHtml(alignmentInherited);
|
||||
QVERIFY(cursor.charFormat().verticalAlignment() == QTextCharFormat::AlignSubScript);
|
||||
QCOMPARE(cursor.charFormat().verticalAlignment(), QTextCharFormat::AlignSubScript);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_cssColors()
|
||||
@ -1695,7 +1695,7 @@ void tst_QTextDocumentFragment::html_bodyBackground()
|
||||
const char html[] = "<body background=\"foo.png\">Foo</body>";
|
||||
doc->setHtml(html);
|
||||
|
||||
QVERIFY(doc->rootFrame()->frameFormat().background().style() == Qt::TexturePattern);
|
||||
QCOMPARE(doc->rootFrame()->frameFormat().background().style(), Qt::TexturePattern);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_tableCellBackground()
|
||||
@ -1709,7 +1709,7 @@ void tst_QTextDocumentFragment::html_tableCellBackground()
|
||||
QVERIFY(table);
|
||||
|
||||
QTextTableCell cell = table->cellAt(0, 0);
|
||||
QVERIFY(cell.format().background().style() == Qt::TexturePattern);
|
||||
QCOMPARE(cell.format().background().style(), Qt::TexturePattern);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_bodyBackground()
|
||||
@ -1717,7 +1717,7 @@ void tst_QTextDocumentFragment::css_bodyBackground()
|
||||
const char html[] = "<body style=\"background-image:url('foo.png')\">Foo</body>";
|
||||
doc->setHtml(html);
|
||||
|
||||
QVERIFY(doc->rootFrame()->frameFormat().background().style() == Qt::TexturePattern);
|
||||
QCOMPARE(doc->rootFrame()->frameFormat().background().style(), Qt::TexturePattern);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_tableCellBackground()
|
||||
@ -1731,7 +1731,7 @@ void tst_QTextDocumentFragment::css_tableCellBackground()
|
||||
QVERIFY(table);
|
||||
|
||||
QTextTableCell cell = table->cellAt(0, 0);
|
||||
QVERIFY(cell.format().background().style() == Qt::TexturePattern);
|
||||
QCOMPARE(cell.format().background().style(), Qt::TexturePattern);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_cellPaddings()
|
||||
@ -1767,7 +1767,7 @@ void tst_QTextDocumentFragment::html_blockLevelDiv()
|
||||
setHtml(html);
|
||||
|
||||
QCOMPARE(doc->begin().blockFormat().alignment(), Qt::AlignRight|Qt::AlignAbsolute);
|
||||
QVERIFY(doc->begin().next() == doc->end());
|
||||
QCOMPARE(doc->begin().next(), doc->end());
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_spanNesting()
|
||||
@ -1805,7 +1805,7 @@ void tst_QTextDocumentFragment::html_nestedLists()
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QTextList *thirdList = cursor.currentList();
|
||||
QVERIFY(thirdList);
|
||||
QVERIFY(thirdList == firstList);
|
||||
QCOMPARE(thirdList, firstList);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::noSpecialCharactersInPlainText()
|
||||
@ -2022,7 +2022,7 @@ void tst_QTextDocumentFragment::html_frameImport()
|
||||
cursor.insertFragment(frag);
|
||||
|
||||
QList<QTextFrame *> childFrames = doc->rootFrame()->childFrames();
|
||||
QVERIFY(childFrames.count() == 1);
|
||||
QCOMPARE(childFrames.count(), 1);
|
||||
QTextFrame *frame = childFrames.first();
|
||||
QCOMPARE(frame->frameFormat().margin(), ffmt.margin());
|
||||
QCOMPARE(frame->frameFormat().border(), ffmt.border());
|
||||
@ -2050,7 +2050,7 @@ void tst_QTextDocumentFragment::html_frameImport2()
|
||||
cursor.insertFragment(frag);
|
||||
|
||||
QList<QTextFrame *> childFrames = doc->rootFrame()->childFrames();
|
||||
QVERIFY(childFrames.count() == 1);
|
||||
QCOMPARE(childFrames.count(), 1);
|
||||
QTextFrame *frame = childFrames.first();
|
||||
QCOMPARE(frame->frameFormat().topMargin(), ffmt.topMargin());
|
||||
QCOMPARE(frame->frameFormat().bottomMargin(), ffmt.bottomMargin());
|
||||
@ -2065,7 +2065,7 @@ void tst_QTextDocumentFragment::html_dontAddMarginsAcrossTableCells()
|
||||
cursor.insertFragment(QTextDocumentFragment::fromHtml(QString::fromLatin1(html)));
|
||||
|
||||
QList<QTextFrame *> childFrames = doc->rootFrame()->childFrames();
|
||||
QVERIFY(childFrames.count() == 1);
|
||||
QCOMPARE(childFrames.count(), 1);
|
||||
QTextFrame *frame = childFrames.first();
|
||||
cursor = frame->firstCursorPosition();
|
||||
QCOMPARE(cursor.blockFormat().leftMargin(), qreal(50.0));
|
||||
@ -2078,7 +2078,7 @@ void tst_QTextDocumentFragment::html_dontMergeCenterBlocks()
|
||||
|
||||
QCOMPARE(doc->blockCount(), 2);
|
||||
QTextBlock blk = doc->begin();
|
||||
QVERIFY(blk.blockFormat().alignment() == Qt::AlignCenter);
|
||||
QCOMPARE(blk.blockFormat().alignment(), Qt::AlignCenter);
|
||||
blk = blk.next();
|
||||
QVERIFY(blk.blockFormat().alignment() != Qt::AlignCenter);
|
||||
}
|
||||
@ -2112,7 +2112,7 @@ void tst_QTextDocumentFragment::html_tableCellBgColor2()
|
||||
|
||||
QTextFrame::Iterator it = cell.begin();
|
||||
QVERIFY(!it.atEnd());
|
||||
QVERIFY(it.currentFrame() == 0);
|
||||
QVERIFY(!it.currentFrame());
|
||||
QVERIFY(it.currentBlock().isValid());
|
||||
|
||||
++it;
|
||||
@ -2122,9 +2122,9 @@ void tst_QTextDocumentFragment::html_tableCellBgColor2()
|
||||
|
||||
++it;
|
||||
QVERIFY(!it.atEnd());
|
||||
QVERIFY(it.currentFrame() == 0);
|
||||
QVERIFY(!it.currentFrame());
|
||||
QVERIFY(it.currentBlock().isValid());
|
||||
QVERIFY(it.currentBlock().blockFormat().background() == QBrush(Qt::NoBrush));
|
||||
QCOMPARE(it.currentBlock().blockFormat().background(), QBrush(Qt::NoBrush));
|
||||
|
||||
++it;
|
||||
QVERIFY(it.atEnd());
|
||||
@ -2245,8 +2245,8 @@ void tst_QTextDocumentFragment::html_blockVsInline()
|
||||
{
|
||||
{
|
||||
setHtml("<html><body><div><b>Foo<div>Bar");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
{
|
||||
setHtml("<html><body><p><b>Foo<p>Bar");
|
||||
@ -2255,23 +2255,23 @@ void tst_QTextDocumentFragment::html_blockVsInline()
|
||||
}
|
||||
{
|
||||
setHtml("<html><body><b><center>Foo</center></b>");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
{
|
||||
setHtml("<html><body><b><p>Foo");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
{
|
||||
setHtml("<html><body><b><p>Foo<p>Bar");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
{
|
||||
setHtml("<div><b>Foo<div>Bar");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
{
|
||||
setHtml("<p><b>Foo<p>Bar");
|
||||
@ -2280,18 +2280,18 @@ void tst_QTextDocumentFragment::html_blockVsInline()
|
||||
}
|
||||
{
|
||||
setHtml("<b><center>Foo</center></b>");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
{
|
||||
setHtml("<b><p>Foo");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
{
|
||||
setHtml("<b><p>Foo<p>Bar");
|
||||
QVERIFY(cursor.charFormat().fontWeight() == QFont::Bold);
|
||||
QVERIFY(cursor.blockCharFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(cursor.charFormat().fontWeight(), int(QFont::Bold));
|
||||
QCOMPARE(cursor.blockCharFormat().fontWeight(), int(QFont::Bold));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2338,7 +2338,7 @@ void tst_QTextDocumentFragment::html_nestedTables()
|
||||
|
||||
QTextTable *firstNestedTable = cursor.currentTable();
|
||||
QVERIFY(firstNestedTable);
|
||||
QVERIFY(firstNestedTable->parentFrame() == table);
|
||||
QCOMPARE(firstNestedTable->parentFrame(), table);
|
||||
QCOMPARE(firstNestedTable->rows(), 1);
|
||||
QCOMPARE(firstNestedTable->columns(), 1);
|
||||
QCOMPARE(firstNestedTable->cellAt(0, 0).firstCursorPosition().block().text(), QString("Hello"));
|
||||
@ -2348,13 +2348,13 @@ void tst_QTextDocumentFragment::html_nestedTables()
|
||||
;
|
||||
|
||||
QVERIFY(!cursor.isNull());
|
||||
QVERIFY(cursor.currentTable() == table);
|
||||
QCOMPARE(cursor.currentTable(), table);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
|
||||
QTextTable *secondNestedTable = cursor.currentTable();
|
||||
QVERIFY(secondNestedTable);
|
||||
QVERIFY(secondNestedTable->parentFrame() == table);
|
||||
QCOMPARE(secondNestedTable->parentFrame(), table);
|
||||
QCOMPARE(secondNestedTable->rows(), 1);
|
||||
QCOMPARE(secondNestedTable->columns(), 1);
|
||||
QCOMPARE(secondNestedTable->cellAt(0, 0).firstCursorPosition().block().text(), QString("World"));
|
||||
@ -2454,7 +2454,7 @@ void tst_QTextDocumentFragment::html_anchorColor()
|
||||
setHtml("<span style=\"color: red;\"><a href=\"http://www.kde.org/\">Blue</a></span>");
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().foreground().color() == QGuiApplication::palette().link().color());
|
||||
QCOMPARE(cursor.charFormat().foreground().color(), QGuiApplication::palette().link().color());
|
||||
|
||||
setHtml("<span style=\"color: red;\"><a href=\"http://www.kde.org/\" style=\"color: yellow;\">Green</a></span>");
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
@ -2525,17 +2525,17 @@ void tst_QTextDocumentFragment::html_columnWidths()
|
||||
|
||||
const QVector<QTextLength> columnWidths = fmt.columnWidthConstraints();
|
||||
QCOMPARE(columnWidths.count(), 2);
|
||||
QVERIFY(columnWidths.at(0).type() == QTextLength::VariableLength);
|
||||
QVERIFY(columnWidths.at(1).type() == QTextLength::PercentageLength);
|
||||
QVERIFY(columnWidths.at(1).rawValue() == 1);
|
||||
QCOMPARE(columnWidths.at(0).type(), QTextLength::VariableLength);
|
||||
QCOMPARE(columnWidths.at(1).type(), QTextLength::PercentageLength);
|
||||
QCOMPARE(columnWidths.at(1).rawValue(), qreal(1));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_fontWeight()
|
||||
{
|
||||
setHtml("<p style=\"font-weight:bold\">blah</p>");
|
||||
QVERIFY(doc->begin().charFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(doc->begin().charFormat().fontWeight(), int(QFont::Bold));
|
||||
setHtml("<p style=\"font-weight:600\">blah</p>");
|
||||
QVERIFY(doc->begin().charFormat().fontWeight() == QFont::Bold);
|
||||
QCOMPARE(doc->begin().charFormat().fontWeight(), int(QFont::Bold));
|
||||
|
||||
}
|
||||
|
||||
@ -2548,7 +2548,7 @@ void tst_QTextDocumentFragment::css_float()
|
||||
QVERIFY(o);
|
||||
QTextFormat f = o->format();
|
||||
QVERIFY(f.isFrameFormat());
|
||||
QVERIFY(f.toFrameFormat().position() == QTextFrameFormat::FloatRight);
|
||||
QCOMPARE(f.toFrameFormat().position(), QTextFrameFormat::FloatRight);
|
||||
|
||||
setHtml("<img src=\"foo\" align=right>");
|
||||
fmt = doc->begin().begin().fragment().charFormat();
|
||||
@ -2557,7 +2557,7 @@ void tst_QTextDocumentFragment::css_float()
|
||||
QVERIFY(o);
|
||||
f = o->format();
|
||||
QVERIFY(f.isFrameFormat());
|
||||
QVERIFY(f.toFrameFormat().position() == QTextFrameFormat::FloatRight);
|
||||
QCOMPARE(f.toFrameFormat().position(), QTextFrameFormat::FloatRight);
|
||||
|
||||
setHtml("<img src=\"foo\" align=left>");
|
||||
fmt = doc->begin().begin().fragment().charFormat();
|
||||
@ -2566,7 +2566,7 @@ void tst_QTextDocumentFragment::css_float()
|
||||
QVERIFY(o);
|
||||
f = o->format();
|
||||
QVERIFY(f.isFrameFormat());
|
||||
QVERIFY(f.toFrameFormat().position() == QTextFrameFormat::FloatLeft);
|
||||
QCOMPARE(f.toFrameFormat().position(), QTextFrameFormat::FloatLeft);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_textIndent()
|
||||
@ -2585,7 +2585,7 @@ void tst_QTextDocumentFragment::css_inline()
|
||||
"<p>test</p>"
|
||||
);
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), QColor("green"));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_external()
|
||||
@ -2596,11 +2596,12 @@ void tst_QTextDocumentFragment::css_external()
|
||||
"<p>test</p>"
|
||||
);
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), QColor("green"));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_import()
|
||||
{
|
||||
const QColor green("green");
|
||||
doc->addResource(QTextDocument::StyleSheetResource, QUrl("test.css"), QString("@import \"other.css\";"));
|
||||
doc->addResource(QTextDocument::StyleSheetResource, QUrl("other.css"), QString("@import url(\"other2.css\");"));
|
||||
doc->addResource(QTextDocument::StyleSheetResource, QUrl("other2.css"), QString("p { background-color: green; }"));
|
||||
@ -2609,14 +2610,14 @@ void tst_QTextDocumentFragment::css_import()
|
||||
"<p>test</p>"
|
||||
);
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
|
||||
doc->setHtml(""
|
||||
"<style>@import \"test.css\" screen;</style>"
|
||||
"<p>test</p>"
|
||||
);
|
||||
fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_selectors_data()
|
||||
@ -2662,9 +2663,9 @@ void tst_QTextDocumentFragment::css_selectors()
|
||||
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
if (match)
|
||||
QVERIFY(fmt.background().color() == QColor("red"));
|
||||
QCOMPARE(fmt.background().color(), QColor("red"));
|
||||
else
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), QColor("green"));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_nodeNameCaseInsensitivity()
|
||||
@ -2674,7 +2675,7 @@ void tst_QTextDocumentFragment::css_nodeNameCaseInsensitivity()
|
||||
"</style>"
|
||||
"<p>test</p>");
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), QColor("green"));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_textUnderlineStyle_data()
|
||||
@ -2710,14 +2711,14 @@ void tst_QTextDocumentFragment::css_textUnderlineStyleAndDecoration()
|
||||
|
||||
QTextFragment fragment = doc->begin().begin().fragment();
|
||||
QVERIFY(fragment.isValid());
|
||||
QVERIFY(fragment.charFormat().underlineStyle() == QTextCharFormat::SingleUnderline);
|
||||
QCOMPARE(fragment.charFormat().underlineStyle(), QTextCharFormat::SingleUnderline);
|
||||
QVERIFY(fragment.charFormat().fontOverline());
|
||||
|
||||
doc->setHtml("<span style=\"text-underline-style: solid; text-decoration: overline\">Test</span>");
|
||||
|
||||
fragment = doc->begin().begin().fragment();
|
||||
QVERIFY(fragment.isValid());
|
||||
QVERIFY(fragment.charFormat().underlineStyle() == QTextCharFormat::SingleUnderline);
|
||||
QCOMPARE(fragment.charFormat().underlineStyle(), QTextCharFormat::SingleUnderline);
|
||||
QVERIFY(fragment.charFormat().fontOverline());
|
||||
}
|
||||
|
||||
@ -2726,48 +2727,48 @@ void tst_QTextDocumentFragment::css_listStyleType()
|
||||
doc->setHtml("<ol style=\"list-style-type: disc\"><li>Blah</li></ol>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDisc);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDisc);
|
||||
|
||||
doc->setHtml("<ul style=\"list-style-type: square\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListSquare);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListSquare);
|
||||
|
||||
doc->setHtml("<ul style=\"list-style-type: circle\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListCircle);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListCircle);
|
||||
|
||||
doc->setHtml("<ul style=\"list-style-type: decimal\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDecimal);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDecimal);
|
||||
|
||||
doc->setHtml("<ul style=\"list-style-type: lower-alpha\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListLowerAlpha);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListLowerAlpha);
|
||||
|
||||
doc->setHtml("<ul style=\"list-style-type: upper-alpha\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperAlpha);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListUpperAlpha);
|
||||
|
||||
doc->setHtml("<ul style=\"list-style-type: upper-roman\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListUpperRoman);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListUpperRoman);
|
||||
|
||||
doc->setHtml("<ul style=\"list-style-type: lower-roman\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListLowerRoman);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListLowerRoman);
|
||||
|
||||
// ignore the unsupported list-style-position inside the list-style shorthand property
|
||||
doc->setHtml("<ul style=\"list-style: outside decimal\"><li>Blah</li></ul>");
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListDecimal);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListDecimal);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::css_linkPseudo()
|
||||
@ -2785,13 +2786,13 @@ void tst_QTextDocumentFragment::css_linkPseudo()
|
||||
void tst_QTextDocumentFragment::css_pageBreaks()
|
||||
{
|
||||
doc->setHtml("<p>Foo</p>");
|
||||
QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == QTextFormat::PageBreak_Auto);
|
||||
QCOMPARE(doc->begin().blockFormat().pageBreakPolicy(), QTextFormat::PageBreak_Auto);
|
||||
|
||||
doc->setHtml("<p style=\" page-break-before:always;\">Foo</p>");
|
||||
QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == QTextFormat::PageBreak_AlwaysBefore);
|
||||
QCOMPARE(doc->begin().blockFormat().pageBreakPolicy(), QTextFormat::PageBreak_AlwaysBefore);
|
||||
|
||||
doc->setHtml("<p style=\" page-break-after:always;\">Foo</p>");
|
||||
QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == QTextFormat::PageBreak_AlwaysAfter);
|
||||
QCOMPARE(doc->begin().blockFormat().pageBreakPolicy(), QTextFormat::PageBreak_AlwaysAfter);
|
||||
|
||||
doc->setHtml("<p style=\" page-break-before:always; page-break-after:always;\">Foo</p>");
|
||||
QVERIFY(doc->begin().blockFormat().pageBreakPolicy() == (QTextFormat::PageBreak_AlwaysAfter | QTextFormat::PageBreak_AlwaysBefore));
|
||||
@ -2832,13 +2833,14 @@ void tst_QTextDocumentFragment::universalSelectors()
|
||||
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
if (match)
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), QColor("green"));
|
||||
else
|
||||
QVERIFY(!fmt.hasProperty(QTextFormat::BackgroundBrush));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::screenMedia()
|
||||
{
|
||||
const QColor green("green");
|
||||
setHtml("<style>"
|
||||
"@media screen {"
|
||||
"p { background-color: green }"
|
||||
@ -2847,7 +2849,7 @@ void tst_QTextDocumentFragment::screenMedia()
|
||||
"<p>test</p>"
|
||||
"");
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
|
||||
setHtml("<style>"
|
||||
"@media foobar {"
|
||||
@ -2857,7 +2859,7 @@ void tst_QTextDocumentFragment::screenMedia()
|
||||
"<p>test</p>"
|
||||
"");
|
||||
fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() != QColor("green"));
|
||||
QVERIFY(fmt.background().color() != green);
|
||||
|
||||
setHtml("<style>"
|
||||
"@media sCrEeN {"
|
||||
@ -2867,7 +2869,7 @@ void tst_QTextDocumentFragment::screenMedia()
|
||||
"<p>test</p>"
|
||||
"");
|
||||
fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), green);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::htmlResourceLoading()
|
||||
@ -2881,7 +2883,7 @@ void tst_QTextDocumentFragment::htmlResourceLoading()
|
||||
doc->clear();
|
||||
QTextCursor(doc).insertFragment(frag);
|
||||
QTextBlockFormat fmt = doc->begin().blockFormat();
|
||||
QVERIFY(fmt.background().color() == QColor("green"));
|
||||
QCOMPARE(fmt.background().color(), QColor("green"));
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::someCaseInsensitiveAttributeValues()
|
||||
@ -2890,7 +2892,7 @@ void tst_QTextDocumentFragment::someCaseInsensitiveAttributeValues()
|
||||
setHtml(QString::fromLatin1(html1));
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->format().style() == QTextListFormat::ListSquare);
|
||||
QCOMPARE(cursor.currentList()->format().style(), QTextListFormat::ListSquare);
|
||||
|
||||
const char html2[] = "<div align=ceNTeR><b>Hello World";
|
||||
setHtml(html2);
|
||||
@ -2925,7 +2927,7 @@ void tst_QTextDocumentFragment::backgroundImage()
|
||||
doc.testPixmap.fill(Qt::blue);
|
||||
doc.setHtml("<p style=\"background-image: url(testPixmap)\">Hello</p>");
|
||||
QBrush bg = doc.begin().blockFormat().background();
|
||||
QVERIFY(bg.style() == Qt::TexturePattern);
|
||||
QCOMPARE(bg.style(), Qt::TexturePattern);
|
||||
QCOMPARE(bg.texture().cacheKey(), doc.testPixmap.cacheKey());
|
||||
}
|
||||
|
||||
@ -3109,7 +3111,7 @@ void tst_QTextDocumentFragment::html_tableStrangeNewline()
|
||||
QCOMPARE(table->columns(), 1);
|
||||
const QTextTableCell cell = table->cellAt(0, 0);
|
||||
QCOMPARE(cell.firstCursorPosition().block().text(), QString("Foo"));
|
||||
QVERIFY(cell.firstCursorPosition().block() == cell.lastCursorPosition().block());
|
||||
QCOMPARE(cell.firstCursorPosition().block(), cell.lastCursorPosition().block());
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_tableStrangeNewline2()
|
||||
@ -3123,7 +3125,7 @@ void tst_QTextDocumentFragment::html_tableStrangeNewline2()
|
||||
QCOMPARE(table->columns(), 1);
|
||||
const QTextTableCell cell = table->cellAt(0, 0);
|
||||
QCOMPARE(cell.firstCursorPosition().block().text(), QString("Foo"));
|
||||
QVERIFY(cell.firstCursorPosition().block() == cell.lastCursorPosition().block());
|
||||
QCOMPARE(cell.firstCursorPosition().block(), cell.lastCursorPosition().block());
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_tableStrangeNewline3()
|
||||
@ -3152,11 +3154,11 @@ void tst_QTextDocumentFragment::html_tableStrangeNewline3()
|
||||
|
||||
QTextTableCell cell = table->cellAt(0, 0);
|
||||
QCOMPARE(cell.firstCursorPosition().block().text(), QString("Meh"));
|
||||
QVERIFY(cell.firstCursorPosition().block() == cell.lastCursorPosition().block());
|
||||
QCOMPARE(cell.firstCursorPosition().block(), cell.lastCursorPosition().block());
|
||||
|
||||
cell = table->cellAt(0, 1);
|
||||
QCOMPARE(cell.firstCursorPosition().block().text(), QString("Foo"));
|
||||
QVERIFY(cell.firstCursorPosition().block() == cell.lastCursorPosition().block());
|
||||
QCOMPARE(cell.firstCursorPosition().block(), cell.lastCursorPosition().block());
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_caption()
|
||||
@ -3170,7 +3172,7 @@ void tst_QTextDocumentFragment::html_caption()
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
|
||||
QCOMPARE(cursor.block().text(), QString("This is a Caption!"));
|
||||
QVERIFY(cursor.blockFormat().alignment() == Qt::AlignHCenter);
|
||||
QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignHCenter);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QTextTable *table = cursor.currentTable();
|
||||
@ -3427,7 +3429,7 @@ void tst_QTextDocumentFragment::html_dontInheritAlignmentForFloatingImages()
|
||||
QVERIFY(o);
|
||||
QTextFormat f = o->format();
|
||||
QVERIFY(f.isFrameFormat());
|
||||
QVERIFY(f.toFrameFormat().position() == QTextFrameFormat::InFlow);
|
||||
QCOMPARE(f.toFrameFormat().position(), QTextFrameFormat::InFlow);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_verticalImageAlignment()
|
||||
@ -3437,35 +3439,35 @@ void tst_QTextDocumentFragment::html_verticalImageAlignment()
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().isImageFormat());
|
||||
QTextImageFormat fmt = cursor.charFormat().toImageFormat();
|
||||
QVERIFY(fmt.verticalAlignment() == QTextCharFormat::AlignNormal);
|
||||
QCOMPARE(fmt.verticalAlignment(), QTextCharFormat::AlignNormal);
|
||||
|
||||
doc->setHtml("<img src=\"foo\" align=middle />");
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().isImageFormat());
|
||||
fmt = cursor.charFormat().toImageFormat();
|
||||
QVERIFY(fmt.verticalAlignment() == QTextCharFormat::AlignMiddle);
|
||||
QCOMPARE(fmt.verticalAlignment(), QTextCharFormat::AlignMiddle);
|
||||
|
||||
doc->setHtml("<img src=\"foo\" style=\"vertical-align: middle\" />");
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().isImageFormat());
|
||||
fmt = cursor.charFormat().toImageFormat();
|
||||
QVERIFY(fmt.verticalAlignment() == QTextCharFormat::AlignMiddle);
|
||||
QCOMPARE(fmt.verticalAlignment(), QTextCharFormat::AlignMiddle);
|
||||
|
||||
doc->setHtml("<img src=\"foo\" align=top />");
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().isImageFormat());
|
||||
fmt = cursor.charFormat().toImageFormat();
|
||||
QVERIFY(fmt.verticalAlignment() == QTextCharFormat::AlignTop);
|
||||
QCOMPARE(fmt.verticalAlignment(), QTextCharFormat::AlignTop);
|
||||
|
||||
doc->setHtml("<img src=\"foo\" style=\"vertical-align: top\" />");
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextCharacter);
|
||||
QVERIFY(cursor.charFormat().isImageFormat());
|
||||
fmt = cursor.charFormat().toImageFormat();
|
||||
QVERIFY(fmt.verticalAlignment() == QTextCharFormat::AlignTop);
|
||||
QCOMPARE(fmt.verticalAlignment(), QTextCharFormat::AlignTop);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_verticalCellAlignment()
|
||||
@ -3944,11 +3946,11 @@ void tst_QTextDocumentFragment::html_directionWithHtml()
|
||||
|
||||
block = block.next();
|
||||
QVERIFY(block.blockFormat().hasProperty(QTextFormat::LayoutDirection));
|
||||
QVERIFY(block.blockFormat().layoutDirection() == Qt::RightToLeft);
|
||||
QCOMPARE(block.blockFormat().layoutDirection(), Qt::RightToLeft);
|
||||
|
||||
block = block.next();
|
||||
QVERIFY(block.blockFormat().hasProperty(QTextFormat::LayoutDirection));
|
||||
QVERIFY(block.blockFormat().layoutDirection() == Qt::LeftToRight);
|
||||
QCOMPARE(block.blockFormat().layoutDirection(), Qt::LeftToRight);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_directionWithRichText()
|
||||
@ -3961,11 +3963,11 @@ void tst_QTextDocumentFragment::html_directionWithRichText()
|
||||
|
||||
block = block.next();
|
||||
QVERIFY(block.blockFormat().hasProperty(QTextFormat::LayoutDirection));
|
||||
QVERIFY(block.blockFormat().layoutDirection() == Qt::RightToLeft);
|
||||
QCOMPARE(block.blockFormat().layoutDirection(), Qt::RightToLeft);
|
||||
|
||||
block = block.next();
|
||||
QVERIFY(block.blockFormat().hasProperty(QTextFormat::LayoutDirection));
|
||||
QVERIFY(block.blockFormat().layoutDirection() == Qt::LeftToRight);
|
||||
QCOMPARE(block.blockFormat().layoutDirection(), Qt::LeftToRight);
|
||||
}
|
||||
|
||||
void tst_QTextDocumentFragment::html_metaInBody()
|
||||
|
@ -101,7 +101,7 @@ void tst_QTextFormat::defaultAlignment()
|
||||
QTextBlockFormat fmt;
|
||||
QVERIFY(!fmt.hasProperty(QTextFormat::BlockAlignment));
|
||||
QCOMPARE(fmt.intProperty(QTextFormat::BlockAlignment), 0);
|
||||
QVERIFY(fmt.alignment() == Qt::AlignLeft);
|
||||
QCOMPARE(fmt.alignment(), Qt::AlignLeft);
|
||||
}
|
||||
|
||||
void tst_QTextFormat::testUnderlinePropertyPrecedence()
|
||||
@ -209,7 +209,7 @@ void tst_QTextFormat::resolveFont()
|
||||
QVector<QTextFormat> formats = doc.allFormats();
|
||||
QCOMPARE(formats.count(), 3);
|
||||
|
||||
QVERIFY(formats.at(2).type() == QTextFormat::CharFormat);
|
||||
QCOMPARE(formats.at(2).type(), int(QTextFormat::CharFormat));
|
||||
fmt = formats.at(2).toCharFormat();
|
||||
|
||||
QVERIFY(!fmt.font().underline());
|
||||
|
@ -1722,7 +1722,7 @@ void tst_QTextLayout::capitalization_allUpperCase()
|
||||
QTextEngine *engine = layout.engine();
|
||||
engine->itemize();
|
||||
QCOMPARE(engine->layoutData->items.count(), 1);
|
||||
QVERIFY(engine->layoutData->items.at(0).analysis.flags == QScriptAnalysis::Uppercase);
|
||||
QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Uppercase));
|
||||
}
|
||||
|
||||
void tst_QTextLayout::capitalization_allUpperCase_newline()
|
||||
@ -1742,9 +1742,9 @@ void tst_QTextLayout::capitalization_allUpperCase_newline()
|
||||
QTextEngine *engine = layout.engine();
|
||||
engine->itemize();
|
||||
QCOMPARE(engine->layoutData->items.count(), 3);
|
||||
QVERIFY(engine->layoutData->items.at(0).analysis.flags == QScriptAnalysis::Uppercase);
|
||||
QVERIFY(engine->layoutData->items.at(1).analysis.flags == QScriptAnalysis::LineOrParagraphSeparator);
|
||||
QVERIFY(engine->layoutData->items.at(2).analysis.flags == QScriptAnalysis::Uppercase);
|
||||
QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Uppercase));
|
||||
QCOMPARE(engine->layoutData->items.at(1).analysis.flags, ushort(QScriptAnalysis::LineOrParagraphSeparator));
|
||||
QCOMPARE(engine->layoutData->items.at(2).analysis.flags, ushort(QScriptAnalysis::Uppercase));
|
||||
}
|
||||
|
||||
void tst_QTextLayout::capitalization_allLowerCase()
|
||||
@ -1760,7 +1760,7 @@ void tst_QTextLayout::capitalization_allLowerCase()
|
||||
QTextEngine *engine = layout.engine();
|
||||
engine->itemize();
|
||||
QCOMPARE(engine->layoutData->items.count(), 1);
|
||||
QVERIFY(engine->layoutData->items.at(0).analysis.flags == QScriptAnalysis::Lowercase);
|
||||
QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Lowercase));
|
||||
}
|
||||
|
||||
void tst_QTextLayout::capitalization_smallCaps()
|
||||
@ -1776,8 +1776,8 @@ void tst_QTextLayout::capitalization_smallCaps()
|
||||
QTextEngine *engine = layout.engine();
|
||||
engine->itemize();
|
||||
QCOMPARE(engine->layoutData->items.count(), 2);
|
||||
QVERIFY(engine->layoutData->items.at(0).analysis.flags == QScriptAnalysis::None);
|
||||
QVERIFY(engine->layoutData->items.at(1).analysis.flags == QScriptAnalysis::SmallCaps);
|
||||
QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::None));
|
||||
QCOMPARE(engine->layoutData->items.at(1).analysis.flags, ushort(QScriptAnalysis::SmallCaps));
|
||||
}
|
||||
|
||||
void tst_QTextLayout::capitalization_capitalize()
|
||||
@ -1793,11 +1793,11 @@ void tst_QTextLayout::capitalization_capitalize()
|
||||
QTextEngine *engine = layout.engine();
|
||||
engine->itemize();
|
||||
QCOMPARE(engine->layoutData->items.count(), 5);
|
||||
QVERIFY(engine->layoutData->items.at(0).analysis.flags == QScriptAnalysis::Uppercase);
|
||||
QVERIFY(engine->layoutData->items.at(1).analysis.flags == QScriptAnalysis::None);
|
||||
QVERIFY(engine->layoutData->items.at(2).analysis.flags == QScriptAnalysis::Tab);
|
||||
QVERIFY(engine->layoutData->items.at(3).analysis.flags == QScriptAnalysis::Uppercase);
|
||||
QVERIFY(engine->layoutData->items.at(4).analysis.flags == QScriptAnalysis::None);
|
||||
QCOMPARE(engine->layoutData->items.at(0).analysis.flags, ushort(QScriptAnalysis::Uppercase));
|
||||
QCOMPARE(engine->layoutData->items.at(1).analysis.flags, ushort(QScriptAnalysis::None));
|
||||
QCOMPARE(engine->layoutData->items.at(2).analysis.flags, ushort(QScriptAnalysis::Tab));
|
||||
QCOMPARE(engine->layoutData->items.at(3).analysis.flags, ushort(QScriptAnalysis::Uppercase));
|
||||
QCOMPARE(engine->layoutData->items.at(4).analysis.flags, ushort(QScriptAnalysis::None));
|
||||
}
|
||||
|
||||
void tst_QTextLayout::longText()
|
||||
@ -2073,8 +2073,8 @@ void tst_QTextLayout::cursorInNonStopChars()
|
||||
QTextLine line = layout.createLine();
|
||||
layout.endLayout();
|
||||
|
||||
QVERIFY(line.cursorToX(1) == line.cursorToX(3));
|
||||
QVERIFY(line.cursorToX(2) == line.cursorToX(3));
|
||||
QCOMPARE(line.cursorToX(1), line.cursorToX(3));
|
||||
QCOMPARE(line.cursorToX(2), line.cursorToX(3));
|
||||
}
|
||||
|
||||
void tst_QTextLayout::justifyTrailingSpaces()
|
||||
|
@ -113,11 +113,11 @@ void tst_QTextList::autoNumbering()
|
||||
for (int i = 0; i < 27; ++i)
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(list->count() == 28);
|
||||
QCOMPARE(list->count(), 28);
|
||||
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 27);
|
||||
QVERIFY(cursor.currentList()->itemText(cursor.block()) == "ab.");
|
||||
QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), 27);
|
||||
QCOMPARE(cursor.currentList()->itemText(cursor.block()), QLatin1String("ab."));
|
||||
}
|
||||
|
||||
void tst_QTextList::autoNumberingPrefixAndSuffix()
|
||||
@ -132,11 +132,11 @@ void tst_QTextList::autoNumberingPrefixAndSuffix()
|
||||
for (int i = 0; i < 27; ++i)
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(list->count() == 28);
|
||||
QCOMPARE(list->count(), 28);
|
||||
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 27);
|
||||
QVERIFY(cursor.currentList()->itemText(cursor.block()) == "-ab)");
|
||||
QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), 27);
|
||||
QCOMPARE(cursor.currentList()->itemText(cursor.block()), QLatin1String("-ab)"));
|
||||
}
|
||||
|
||||
void tst_QTextList::autoNumberingPrefixAndSuffixRTL()
|
||||
@ -154,9 +154,9 @@ void tst_QTextList::autoNumberingPrefixAndSuffixRTL()
|
||||
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(list->count() == 2);
|
||||
QCOMPARE(list->count(), 2);
|
||||
|
||||
QVERIFY(cursor.currentList()->itemText(cursor.block()) == "*B-");
|
||||
QCOMPARE(cursor.currentList()->itemText(cursor.block()), QLatin1String("*B-"));
|
||||
}
|
||||
|
||||
void tst_QTextList::autoNumberingPrefixAndSuffixHtmlExportImport()
|
||||
@ -174,7 +174,7 @@ void tst_QTextList::autoNumberingPrefixAndSuffixHtmlExportImport()
|
||||
for (int i = 0; i < 27; ++i)
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(list->count() == 28);
|
||||
QCOMPARE(list->count(), 28);
|
||||
|
||||
QString htmlExport = doc->toHtml();
|
||||
QTextDocument importDoc;
|
||||
@ -185,9 +185,9 @@ void tst_QTextList::autoNumberingPrefixAndSuffixHtmlExportImport()
|
||||
importCursor.movePosition(QTextCursor::NextBlock);
|
||||
|
||||
QVERIFY(importCursor.currentList());
|
||||
QVERIFY(importCursor.currentList()->itemNumber(importCursor.block()) == 27);
|
||||
QVERIFY(importCursor.currentList()->itemText(importCursor.block()) == "\"ab#");
|
||||
QVERIFY(importCursor.currentList()->format().indent() == 10);
|
||||
QCOMPARE(importCursor.currentList()->itemNumber(importCursor.block()), 27);
|
||||
QCOMPARE(importCursor.currentList()->itemText(importCursor.block()), QLatin1String("\"ab#"));
|
||||
QCOMPARE(importCursor.currentList()->format().indent(), 10);
|
||||
}
|
||||
|
||||
void tst_QTextList::autoNumberingRTL()
|
||||
@ -203,9 +203,9 @@ void tst_QTextList::autoNumberingRTL()
|
||||
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(list->count() == 2);
|
||||
QCOMPARE(list->count(), 2);
|
||||
|
||||
QVERIFY(cursor.currentList()->itemText(cursor.block()) == ".B");
|
||||
QCOMPARE(cursor.currentList()->itemText(cursor.block()), QLatin1String(".B"));
|
||||
}
|
||||
|
||||
void tst_QTextList::romanNumbering()
|
||||
@ -218,11 +218,11 @@ void tst_QTextList::romanNumbering()
|
||||
for (int i = 0; i < 4998; ++i)
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(list->count() == 4999);
|
||||
QCOMPARE(list->count(), 4999);
|
||||
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4998);
|
||||
QVERIFY(cursor.currentList()->itemText(cursor.block()) == "MMMMCMXCIX.");
|
||||
QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), 4998);
|
||||
QCOMPARE(cursor.currentList()->itemText(cursor.block()), QLatin1String("MMMMCMXCIX."));
|
||||
}
|
||||
|
||||
void tst_QTextList::romanNumberingLimit()
|
||||
@ -235,11 +235,11 @@ void tst_QTextList::romanNumberingLimit()
|
||||
for (int i = 0; i < 4999; ++i)
|
||||
cursor.insertBlock();
|
||||
|
||||
QVERIFY(list->count() == 5000);
|
||||
QCOMPARE(list->count(), 5000);
|
||||
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 4999);
|
||||
QVERIFY(cursor.currentList()->itemText(cursor.block()) == "?.");
|
||||
QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), 4999);
|
||||
QCOMPARE(cursor.currentList()->itemText(cursor.block()), QLatin1String("?."));
|
||||
}
|
||||
|
||||
void tst_QTextList::formatChange()
|
||||
@ -257,12 +257,12 @@ void tst_QTextList::formatChange()
|
||||
QVERIFY(list && list->count() == 2);
|
||||
|
||||
QTextBlockFormat bfmt = cursor.blockFormat();
|
||||
// QVERIFY(bfmt.object() == list);
|
||||
// QCOMPARE(bfmt.object(), list);
|
||||
|
||||
bfmt.setObjectIndex(-1);
|
||||
cursor.setBlockFormat(bfmt);
|
||||
|
||||
QVERIFY(firstList->count() == 1);
|
||||
QCOMPARE(firstList->count(), 1);
|
||||
}
|
||||
|
||||
void tst_QTextList::cursorNavigation()
|
||||
@ -282,7 +282,7 @@ void tst_QTextList::cursorNavigation()
|
||||
QVERIFY(cursor.currentList());
|
||||
cursor.movePosition(QTextCursor::PreviousBlock);
|
||||
QVERIFY(cursor.currentList());
|
||||
QVERIFY(cursor.currentList()->itemNumber(cursor.block()) == 0);
|
||||
QCOMPARE(cursor.currentList()->itemNumber(cursor.block()), 0);
|
||||
}
|
||||
|
||||
void tst_QTextList::partialRemoval()
|
||||
|
@ -157,7 +157,7 @@ void tst_QTextPieceTable::insertion3()
|
||||
table->insert(pos, str, charFormatIndex);
|
||||
compare.insert(pos, str);
|
||||
}
|
||||
QVERIFY(table->plainText() == compare);
|
||||
QCOMPARE(table->plainText(), compare);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::insertion4()
|
||||
@ -176,7 +176,7 @@ void tst_QTextPieceTable::insertion4()
|
||||
// exit(12);
|
||||
// }
|
||||
}
|
||||
QVERIFY(table->plainText() == compare);
|
||||
QCOMPARE(table->plainText(), compare);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::insertion5()
|
||||
@ -196,10 +196,10 @@ void tst_QTextPieceTable::insertion5()
|
||||
}
|
||||
compare.insert(pos, str);
|
||||
}
|
||||
QVERIFY(table->plainText() == compare);
|
||||
QCOMPARE(table->plainText(), compare);
|
||||
for (QTextBlock it = table->blocksBegin(); it != table->blocksEnd(); it = it.next()) {
|
||||
QTextDocumentPrivate::FragmentIterator fit = table->find(it.position());
|
||||
QVERIFY(fit.position() == it.position());
|
||||
QCOMPARE(fit.position(), it.position());
|
||||
}
|
||||
}
|
||||
|
||||
@ -260,7 +260,7 @@ void tst_QTextPieceTable::removal3()
|
||||
// exit(12);
|
||||
// }
|
||||
}
|
||||
QVERIFY(table->plainText() == compare);
|
||||
QCOMPARE(table->plainText(), compare);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::removal4()
|
||||
@ -294,7 +294,7 @@ void tst_QTextPieceTable::removal4()
|
||||
// exit(12);
|
||||
// }
|
||||
}
|
||||
QVERIFY(table->plainText() == compare);
|
||||
QCOMPARE(table->plainText(), compare);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::undoRedo1()
|
||||
@ -392,7 +392,7 @@ void tst_QTextPieceTable::undoRedo6()
|
||||
QTextBlockFormat bfmt;
|
||||
bfmt.setAlignment(Qt::AlignHCenter);
|
||||
cursor.setBlockFormat(bfmt);
|
||||
QVERIFY(cursor.blockFormat().alignment() == Qt::AlignHCenter);
|
||||
QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignHCenter);
|
||||
|
||||
QTextCursor range = cursor;
|
||||
range.clearSelection();
|
||||
@ -404,11 +404,11 @@ void tst_QTextPieceTable::undoRedo6()
|
||||
range.mergeCharFormat(modifier);
|
||||
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
QVERIFY(cursor.blockFormat().alignment() == Qt::AlignHCenter);
|
||||
QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignHCenter);
|
||||
|
||||
doc.undo();
|
||||
|
||||
QVERIFY(cursor.blockFormat().alignment() == Qt::AlignHCenter);
|
||||
QCOMPARE(cursor.blockFormat().alignment(), Qt::AlignHCenter);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::undoRedo7()
|
||||
@ -497,13 +497,13 @@ void tst_QTextPieceTable::undoRedo11()
|
||||
}
|
||||
l += remove ? -1 : 2;
|
||||
}
|
||||
QVERIFY(table->plainText() == compare);
|
||||
QCOMPARE(table->plainText(), compare);
|
||||
for (int i = 0; i < loops; ++i)
|
||||
table->undo();
|
||||
QVERIFY(table->plainText() == QString(""));
|
||||
QCOMPARE(table->plainText(), QString(""));
|
||||
for (int i = 0; i < loops; ++i)
|
||||
table->redo();
|
||||
QVERIFY(table->plainText() == compare);
|
||||
QCOMPARE(table->plainText(), compare);
|
||||
}
|
||||
|
||||
|
||||
@ -693,9 +693,9 @@ void tst_QTextPieceTable::setBlockFormat()
|
||||
QTextBlock b = table->blocksFind(1);
|
||||
table->setBlockFormat(b, b, newbfmt);
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == bfmt);
|
||||
QVERIFY(table->blocksFind(1).blockFormat() == newbfmt);
|
||||
QVERIFY(table->blocksFind(2).blockFormat() == bfmt);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), bfmt);
|
||||
QCOMPARE(table->blocksFind(1).blockFormat(), newbfmt);
|
||||
QCOMPARE(table->blocksFind(2).blockFormat(), bfmt);
|
||||
}
|
||||
|
||||
|
||||
@ -705,19 +705,19 @@ void tst_QTextPieceTable::blockInsertion()
|
||||
fmt.setTopMargin(100);
|
||||
int idx = table->formatCollection()->indexForFormat(fmt);
|
||||
int charFormat = table->formatCollection()->indexForFormat(QTextCharFormat());
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
|
||||
table->insertBlock(0, idx, charFormat);
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(1).blockFormat() == fmt);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).blockFormat(), fmt);
|
||||
|
||||
table->undo();
|
||||
QVERIFY(table->blockMap().length() == 1);
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QCOMPARE(table->blockMap().length(), 1);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
|
||||
table->redo();
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(1).blockFormat() == fmt);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).blockFormat(), fmt);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::blockInsertion2()
|
||||
@ -755,37 +755,37 @@ void tst_QTextPieceTable::blockRemoval1()
|
||||
table->insertBlock(9, idx2, charFormatIndex);
|
||||
table->insert(10, "0123", charFormatIndex);
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->beginEditBlock();
|
||||
table->remove(5, 5);
|
||||
table->endEditBlock();
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(4).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 5);
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(4).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 5);
|
||||
|
||||
table->undo();
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->redo();
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(4).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 5);
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(4).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 5);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::blockRemoval2()
|
||||
@ -803,35 +803,35 @@ void tst_QTextPieceTable::blockRemoval2()
|
||||
table->insertBlock(9, idx2, charFormatIndex);
|
||||
table->insert(10, "0123", charFormatIndex);
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->remove(4, 1);
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(6).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 0);
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(6).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 0);
|
||||
|
||||
table->undo();
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->redo();
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(6).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 0);
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(6).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 0);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::blockRemoval3()
|
||||
@ -849,38 +849,38 @@ void tst_QTextPieceTable::blockRemoval3()
|
||||
table->insertBlock(9, idx2, charFormatIndex);
|
||||
table->insert(10, "0123", charFormatIndex);
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->beginEditBlock();
|
||||
table->remove(3, 4);
|
||||
table->endEditBlock();
|
||||
|
||||
QVERIFY(table->blocksFind(1).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 0);
|
||||
QCOMPARE(table->blocksFind(1).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 0);
|
||||
|
||||
table->undo();
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->redo();
|
||||
QVERIFY(table->blocksFind(1).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 0);
|
||||
QCOMPARE(table->blocksFind(1).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 0);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::blockRemoval4()
|
||||
@ -899,35 +899,35 @@ void tst_QTextPieceTable::blockRemoval4()
|
||||
table->insertBlock(9, idx2, charFormatIndex);
|
||||
table->insert(10, "0123", charFormatIndex);
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->remove(3, 7);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 0);
|
||||
QVERIFY(table->blocksFind(1).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 0);
|
||||
QCOMPARE(table->blocksFind(1).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), QTextBlockFormat());
|
||||
|
||||
table->undo();
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->redo();
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 0);
|
||||
QVERIFY(table->blocksFind(1).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 0);
|
||||
QCOMPARE(table->blocksFind(1).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), QTextBlockFormat());
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -946,38 +946,38 @@ void tst_QTextPieceTable::blockRemoval5()
|
||||
table->insertBlock(9, idx2, charFormatIndex);
|
||||
table->insert(10, "0123", charFormatIndex);
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->beginEditBlock();
|
||||
table->remove(3, 8);
|
||||
table->endEditBlock();
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 0);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 0);
|
||||
|
||||
table->undo();
|
||||
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(4).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == fmt1);
|
||||
QVERIFY(table->blocksFind(10).blockFormat() == fmt2);
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(6).position() == 5);
|
||||
QVERIFY(table->blocksFind(11).position() == 10);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(4).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), fmt1);
|
||||
QCOMPARE(table->blocksFind(10).blockFormat(), fmt2);
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(6).position(), 5);
|
||||
QCOMPARE(table->blocksFind(11).position(), 10);
|
||||
|
||||
table->redo();
|
||||
QVERIFY(table->blocksFind(0).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(5).blockFormat() == QTextBlockFormat());
|
||||
QVERIFY(table->blocksFind(1).position() == 0);
|
||||
QVERIFY(table->blocksFind(5).position() == 0);
|
||||
QCOMPARE(table->blocksFind(0).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(5).blockFormat(), QTextBlockFormat());
|
||||
QCOMPARE(table->blocksFind(1).position(), 0);
|
||||
QCOMPARE(table->blocksFind(5).position(), 0);
|
||||
}
|
||||
|
||||
|
||||
@ -996,66 +996,66 @@ void tst_QTextPieceTable::checkFrames1()
|
||||
QPointer<QTextFrame> frame = table->insertFrame(1, 3, ffmt);
|
||||
QTextFrame *root = table->rootFrame();
|
||||
|
||||
QVERIFY(root == frame->parentFrame());
|
||||
QCOMPARE(root, frame->parentFrame());
|
||||
|
||||
QVERIFY(root);
|
||||
QVERIFY(root->parentFrame() == 0);
|
||||
QVERIFY(!root->parentFrame());
|
||||
|
||||
QVERIFY(root->childFrames().count() == 1);
|
||||
QCOMPARE(root->childFrames().count(), 1);
|
||||
QVERIFY(frame->format() == ffmt);
|
||||
QVERIFY(frame->firstPosition() == 2);
|
||||
QVERIFY(frame->lastPosition() == 4);
|
||||
QCOMPARE(frame->firstPosition(), 2);
|
||||
QCOMPARE(frame->lastPosition(), 4);
|
||||
|
||||
|
||||
QPointer<QTextFrame> frame2 = table->insertFrame(2, 3, ffmt);
|
||||
|
||||
QVERIFY(root->childFrames().count() == 1);
|
||||
QVERIFY(root->childFrames().at(0) == frame);
|
||||
QVERIFY(frame->childFrames().count() == 1);
|
||||
QVERIFY(frame2->childFrames().count() == 0);
|
||||
QVERIFY(frame2->parentFrame() == frame);
|
||||
QVERIFY(frame2->firstPosition() == 3);
|
||||
QVERIFY(frame2->lastPosition() == 4);
|
||||
QCOMPARE(root->childFrames().count(), 1);
|
||||
QCOMPARE(root->childFrames().at(0), frame.data());
|
||||
QCOMPARE(frame->childFrames().count(), 1);
|
||||
QCOMPARE(frame2->childFrames().count(), 0);
|
||||
QCOMPARE(frame2->parentFrame(), frame.data());
|
||||
QCOMPARE(frame2->firstPosition(), 3);
|
||||
QCOMPARE(frame2->lastPosition(), 4);
|
||||
|
||||
QVERIFY(frame->format() == ffmt);
|
||||
QVERIFY(frame->firstPosition() == 2);
|
||||
QVERIFY(frame->lastPosition() == 6);
|
||||
QCOMPARE(frame->firstPosition(), 2);
|
||||
QCOMPARE(frame->lastPosition(), 6);
|
||||
|
||||
table->removeFrame(frame);
|
||||
|
||||
QVERIFY(root->childFrames().count() == 1);
|
||||
QVERIFY(root->childFrames().at(0) == frame2);
|
||||
QCOMPARE(root->childFrames().count(), 1);
|
||||
QCOMPARE(root->childFrames().at(0), frame2.data());
|
||||
QVERIFY(!frame);
|
||||
QVERIFY(frame2->childFrames().count() == 0);
|
||||
QVERIFY(frame2->parentFrame() == root);
|
||||
QVERIFY(frame2->firstPosition() == 2);
|
||||
QVERIFY(frame2->lastPosition() == 3);
|
||||
QCOMPARE(frame2->childFrames().count(), 0);
|
||||
QCOMPARE(frame2->parentFrame(), root);
|
||||
QCOMPARE(frame2->firstPosition(), 2);
|
||||
QCOMPARE(frame2->lastPosition(), 3);
|
||||
|
||||
table->undo();
|
||||
|
||||
frame = table->frameAt(2);
|
||||
|
||||
QVERIFY(root->childFrames().count() == 1);
|
||||
QVERIFY(root->childFrames().at(0) == frame);
|
||||
QVERIFY(frame->childFrames().count() == 1);
|
||||
QVERIFY(frame->childFrames().at(0) == frame2);
|
||||
QVERIFY(frame2->childFrames().count() == 0);
|
||||
QVERIFY(frame2->parentFrame() == frame);
|
||||
QVERIFY(frame2->firstPosition() == 3);
|
||||
QVERIFY(frame2->lastPosition() == 4);
|
||||
QCOMPARE(root->childFrames().count(), 1);
|
||||
QCOMPARE(root->childFrames().at(0), frame.data());
|
||||
QCOMPARE(frame->childFrames().count(), 1);
|
||||
QCOMPARE(frame->childFrames().at(0), frame2.data());
|
||||
QCOMPARE(frame2->childFrames().count(), 0);
|
||||
QCOMPARE(frame2->parentFrame(), frame.data());
|
||||
QCOMPARE(frame2->firstPosition(), 3);
|
||||
QCOMPARE(frame2->lastPosition(), 4);
|
||||
|
||||
QVERIFY(frame->firstPosition() == 2);
|
||||
QVERIFY(frame->lastPosition() == 6);
|
||||
QCOMPARE(frame->firstPosition(), 2);
|
||||
QCOMPARE(frame->lastPosition(), 6);
|
||||
|
||||
table->undo();
|
||||
|
||||
QVERIFY(root->childFrames().count() == 1);
|
||||
QVERIFY(root->childFrames().at(0) == frame);
|
||||
QVERIFY(frame->childFrames().count() == 0);
|
||||
QCOMPARE(root->childFrames().count(), 1);
|
||||
QCOMPARE(root->childFrames().at(0), frame.data());
|
||||
QCOMPARE(frame->childFrames().count(), 0);
|
||||
QVERIFY(!frame2);
|
||||
|
||||
QVERIFY(frame->firstPosition() == 2);
|
||||
QVERIFY(frame->lastPosition() == 4);
|
||||
QCOMPARE(frame->firstPosition(), 2);
|
||||
QCOMPARE(frame->lastPosition(), 4);
|
||||
}
|
||||
|
||||
void tst_QTextPieceTable::removeFrameDirect()
|
||||
@ -1065,7 +1065,7 @@ void tst_QTextPieceTable::removeFrameDirect()
|
||||
|
||||
QTextFrame *frame = table->insertFrame(1, 5, ffmt);
|
||||
|
||||
QVERIFY(frame->parentFrame() == table->rootFrame());
|
||||
QCOMPARE(frame->parentFrame(), table->rootFrame());
|
||||
|
||||
const int start = frame->firstPosition() - 1;
|
||||
const int end = frame->lastPosition();
|
||||
|
@ -146,87 +146,87 @@ void tst_QTextTable::variousTableModifications()
|
||||
QTextTableFormat tableFmt;
|
||||
|
||||
QTextTable *tab = cursor.insertTable(2, 2, tableFmt);
|
||||
QVERIFY(doc->toPlainText().length() == 5);
|
||||
QVERIFY(tab == cursor.currentTable());
|
||||
QVERIFY(tab->columns() == 2);
|
||||
QVERIFY(tab->rows() == 2);
|
||||
QCOMPARE(doc->toPlainText().length(), 5);
|
||||
QCOMPARE(tab, cursor.currentTable());
|
||||
QCOMPARE(tab->columns(), 2);
|
||||
QCOMPARE(tab->rows(), 2);
|
||||
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QTextCharFormat fmt = cursor.charFormat();
|
||||
QVERIFY(fmt.objectIndex() == -1);
|
||||
QCOMPARE(fmt.objectIndex(), -1);
|
||||
QTextTableCell cell = tab->cellAt(cursor);
|
||||
QVERIFY(cell.isValid());
|
||||
QVERIFY(cell.row() == 0);
|
||||
QVERIFY(cell.column() == 0);
|
||||
QCOMPARE(cell.row(), 0);
|
||||
QCOMPARE(cell.column(), 0);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 2);
|
||||
QCOMPARE(cursor.position(), 2);
|
||||
fmt = cursor.charFormat();
|
||||
QVERIFY(fmt.objectIndex() == -1);
|
||||
QCOMPARE(fmt.objectIndex(), -1);
|
||||
cell = tab->cellAt(cursor);
|
||||
QVERIFY(cell.isValid());
|
||||
QVERIFY(cell.row() == 0);
|
||||
QVERIFY(cell.column() == 1);
|
||||
QCOMPARE(cell.row(), 0);
|
||||
QCOMPARE(cell.column(), 1);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 3);
|
||||
QCOMPARE(cursor.position(), 3);
|
||||
fmt = cursor.charFormat();
|
||||
QVERIFY(fmt.objectIndex() == -1);
|
||||
QCOMPARE(fmt.objectIndex(), -1);
|
||||
cell = tab->cellAt(cursor);
|
||||
QVERIFY(cell.isValid());
|
||||
QVERIFY(cell.row() == 1);
|
||||
QVERIFY(cell.column() == 0);
|
||||
QCOMPARE(cell.row(), 1);
|
||||
QCOMPARE(cell.column(), 0);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 4);
|
||||
QCOMPARE(cursor.position(), 4);
|
||||
fmt = cursor.charFormat();
|
||||
QVERIFY(fmt.objectIndex() == -1);
|
||||
QCOMPARE(fmt.objectIndex(), -1);
|
||||
cell = tab->cellAt(cursor);
|
||||
QVERIFY(cell.isValid());
|
||||
QVERIFY(cell.row() == 1);
|
||||
QVERIFY(cell.column() == 1);
|
||||
QCOMPARE(cell.row(), 1);
|
||||
QCOMPARE(cell.column(), 1);
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 5);
|
||||
QCOMPARE(cursor.position(), 5);
|
||||
fmt = cursor.charFormat();
|
||||
QVERIFY(fmt.objectIndex() == -1);
|
||||
QCOMPARE(fmt.objectIndex(), -1);
|
||||
cell = tab->cellAt(cursor);
|
||||
QVERIFY(!cell.isValid());
|
||||
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 5);
|
||||
QCOMPARE(cursor.position(), 5);
|
||||
|
||||
// check we can't delete the cells with the cursor
|
||||
cursor.movePosition(QTextCursor::Start);
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
cursor.deleteChar();
|
||||
QVERIFY(doc->toPlainText().length() == 5);
|
||||
QCOMPARE(doc->toPlainText().length(), 5);
|
||||
cursor.movePosition(QTextCursor::NextBlock);
|
||||
QVERIFY(cursor.position() == 2);
|
||||
QCOMPARE(cursor.position(), 2);
|
||||
cursor.deleteChar();
|
||||
QVERIFY(doc->toPlainText().length() == 5);
|
||||
QCOMPARE(doc->toPlainText().length(), 5);
|
||||
cursor.deletePreviousChar();
|
||||
QVERIFY(cursor.position() == 2);
|
||||
QVERIFY(doc->toPlainText().length() == 5);
|
||||
QCOMPARE(cursor.position(), 2);
|
||||
QCOMPARE(doc->toPlainText().length(), 5);
|
||||
|
||||
QTextTable *table = cursor.currentTable();
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 2);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 2);
|
||||
|
||||
table->insertRows(2, 1);
|
||||
QVERIFY(table->rows() == 3);
|
||||
QVERIFY(table->columns() == 2);
|
||||
QVERIFY(doc->toPlainText().length() == 7);
|
||||
QCOMPARE(table->rows(), 3);
|
||||
QCOMPARE(table->columns(), 2);
|
||||
QCOMPARE(doc->toPlainText().length(), 7);
|
||||
table->insertColumns(2, 2);
|
||||
QVERIFY(table->rows() == 3);
|
||||
QVERIFY(table->columns() == 4);
|
||||
QVERIFY(doc->toPlainText().length() == 13);
|
||||
QCOMPARE(table->rows(), 3);
|
||||
QCOMPARE(table->columns(), 4);
|
||||
QCOMPARE(doc->toPlainText().length(), 13);
|
||||
|
||||
table->resize(4, 5);
|
||||
QVERIFY(table->rows() == 4);
|
||||
QVERIFY(table->columns() == 5);
|
||||
QVERIFY(doc->toPlainText().length() == 21);
|
||||
QCOMPARE(table->rows(), 4);
|
||||
QCOMPARE(table->columns(), 5);
|
||||
QCOMPARE(doc->toPlainText().length(), 21);
|
||||
}
|
||||
|
||||
void tst_QTextTable::tableShrinking()
|
||||
@ -234,25 +234,25 @@ void tst_QTextTable::tableShrinking()
|
||||
QTextTableFormat tableFmt;
|
||||
|
||||
cursor.insertTable(3, 4, tableFmt);
|
||||
QVERIFY(doc->toPlainText().length() == 13);
|
||||
QCOMPARE(doc->toPlainText().length(), 13);
|
||||
|
||||
QTextTable *table = cursor.currentTable();
|
||||
QVERIFY(table->rows() == 3);
|
||||
QVERIFY(table->columns() == 4);
|
||||
QCOMPARE(table->rows(), 3);
|
||||
QCOMPARE(table->columns(), 4);
|
||||
|
||||
table->removeRows(1, 1);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 4);
|
||||
QVERIFY(doc->toPlainText().length() == 9);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 4);
|
||||
QCOMPARE(doc->toPlainText().length(), 9);
|
||||
table->removeColumns(1, 2);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 2);
|
||||
QVERIFY(doc->toPlainText().length() == 5);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 2);
|
||||
QCOMPARE(doc->toPlainText().length(), 5);
|
||||
|
||||
table->resize(1, 1);
|
||||
QVERIFY(table->rows() == 1);
|
||||
QVERIFY(table->columns() == 1);
|
||||
QVERIFY(doc->toPlainText().length() == 2);
|
||||
QCOMPARE(table->rows(), 1);
|
||||
QCOMPARE(table->columns(), 1);
|
||||
QCOMPARE(doc->toPlainText().length(), 2);
|
||||
}
|
||||
|
||||
void tst_QTextTable::spans()
|
||||
@ -264,12 +264,12 @@ void tst_QTextTable::spans()
|
||||
QTextTable *table = cursor.currentTable();
|
||||
QVERIFY(table->cellAt(0, 0) != table->cellAt(0, 1));
|
||||
table->mergeCells(0, 0, 1, 2);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 2);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 2);
|
||||
QVERIFY(table->cellAt(0, 0) == table->cellAt(0, 1));
|
||||
table->mergeCells(0, 0, 2, 2);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 2);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 2);
|
||||
}
|
||||
|
||||
void tst_QTextTable::variousModifications2()
|
||||
@ -277,45 +277,45 @@ void tst_QTextTable::variousModifications2()
|
||||
QTextTableFormat tableFmt;
|
||||
|
||||
cursor.insertTable(2, 5, tableFmt);
|
||||
QVERIFY(doc->toPlainText().length() == 11);
|
||||
QCOMPARE(doc->toPlainText().length(), 11);
|
||||
QTextTable *table = cursor.currentTable();
|
||||
QVERIFY(cursor.position() == 1);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 5);
|
||||
QCOMPARE(cursor.position(), 1);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 5);
|
||||
|
||||
table->insertColumns(0, 1);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 6);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 6);
|
||||
table->insertColumns(6, 1);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 7);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 7);
|
||||
|
||||
table->insertRows(0, 1);
|
||||
QVERIFY(table->rows() == 3);
|
||||
QVERIFY(table->columns() == 7);
|
||||
QCOMPARE(table->rows(), 3);
|
||||
QCOMPARE(table->columns(), 7);
|
||||
table->insertRows(3, 1);
|
||||
QVERIFY(table->rows() == 4);
|
||||
QVERIFY(table->columns() == 7);
|
||||
QCOMPARE(table->rows(), 4);
|
||||
QCOMPARE(table->columns(), 7);
|
||||
|
||||
table->removeRows(0, 1);
|
||||
QVERIFY(table->rows() == 3);
|
||||
QVERIFY(table->columns() == 7);
|
||||
QCOMPARE(table->rows(), 3);
|
||||
QCOMPARE(table->columns(), 7);
|
||||
table->removeRows(2, 1);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 7);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 7);
|
||||
|
||||
table->removeColumns(0, 1);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 6);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 6);
|
||||
table->removeColumns(5, 1);
|
||||
QVERIFY(table->rows() == 2);
|
||||
QVERIFY(table->columns() == 5);
|
||||
QCOMPARE(table->rows(), 2);
|
||||
QCOMPARE(table->columns(), 5);
|
||||
|
||||
tableFmt = table->format();
|
||||
table->insertColumns(2, 1);
|
||||
table->setFormat(tableFmt);
|
||||
table->insertColumns(2, 1);
|
||||
QVERIFY(table->columns() == 7);
|
||||
QCOMPARE(table->columns(), 7);
|
||||
}
|
||||
|
||||
void tst_QTextTable::tableManager_undo()
|
||||
@ -325,16 +325,16 @@ void tst_QTextTable::tableManager_undo()
|
||||
QTextTable *table = cursor.insertTable(2, 2, fmt);
|
||||
QVERIFY(table);
|
||||
|
||||
QVERIFY(table->format().border() == 10);
|
||||
QCOMPARE(table->format().border(), qreal(10));
|
||||
|
||||
fmt.setBorder(20);
|
||||
table->setFormat(fmt);
|
||||
|
||||
QVERIFY(table->format().border() == 20);
|
||||
QCOMPARE(table->format().border(), qreal(20));
|
||||
|
||||
doc->undo();
|
||||
|
||||
QVERIFY(table->format().border() == 10);
|
||||
QCOMPARE(table->format().border(), qreal(10));
|
||||
}
|
||||
|
||||
void tst_QTextTable::tableManager_removeCell()
|
||||
@ -360,10 +360,10 @@ void tst_QTextTable::rowAt()
|
||||
QTextCursor cell20Cursor = table->cellAt(2, 0).firstCursorPosition();
|
||||
QTextCursor cell21Cursor = table->cellAt(2, 1).firstCursorPosition();
|
||||
QTextCursor cell30Cursor = table->cellAt(3, 0).firstCursorPosition();
|
||||
QVERIFY(table->cellAt(cell00Cursor).firstCursorPosition() == cell00Cursor);
|
||||
QVERIFY(table->cellAt(cell10Cursor).firstCursorPosition() == cell10Cursor);
|
||||
QVERIFY(table->cellAt(cell20Cursor).firstCursorPosition() == cell20Cursor);
|
||||
QVERIFY(table->cellAt(cell30Cursor).firstCursorPosition() == cell30Cursor);
|
||||
QCOMPARE(table->cellAt(cell00Cursor).firstCursorPosition(), cell00Cursor);
|
||||
QCOMPARE(table->cellAt(cell10Cursor).firstCursorPosition(), cell10Cursor);
|
||||
QCOMPARE(table->cellAt(cell20Cursor).firstCursorPosition(), cell20Cursor);
|
||||
QCOMPARE(table->cellAt(cell30Cursor).firstCursorPosition(), cell30Cursor);
|
||||
|
||||
table->mergeCells(1, 0, 2, 1);
|
||||
|
||||
@ -433,16 +433,16 @@ void tst_QTextTable::insertRows()
|
||||
QVERIFY(cursor == table->cellAt(0, 0).firstCursorPosition());
|
||||
|
||||
table->insertRows(0, 1);
|
||||
QVERIFY(table->rows() == 3);
|
||||
QCOMPARE(table->rows(), 3);
|
||||
|
||||
table->insertRows(1, 1);
|
||||
QVERIFY(table->rows() == 4);
|
||||
QCOMPARE(table->rows(), 4);
|
||||
|
||||
table->insertRows(-1, 1);
|
||||
QVERIFY(table->rows() == 5);
|
||||
QCOMPARE(table->rows(), 5);
|
||||
|
||||
table->insertRows(5, 2);
|
||||
QVERIFY(table->rows() == 7);
|
||||
QCOMPARE(table->rows(), 7);
|
||||
|
||||
}
|
||||
|
||||
@ -552,9 +552,9 @@ void tst_QTextTable::mergeCells()
|
||||
|
||||
QTextBlock block = table->cellAt(0, 0).firstCursorPosition().block();
|
||||
|
||||
QVERIFY(block.text() == "Blah Foo");
|
||||
QVERIFY(block.next().text() == "Hah");
|
||||
QVERIFY(block.next().next().text() == "Bar");
|
||||
QCOMPARE(block.text(), QLatin1String("Blah Foo"));
|
||||
QCOMPARE(block.next().text(), QLatin1String("Hah"));
|
||||
QCOMPARE(block.next().next().text(), QLatin1String("Bar"));
|
||||
|
||||
table = create4x4Table();
|
||||
|
||||
@ -580,7 +580,7 @@ void tst_QTextTable::mergeCells()
|
||||
if (table) {
|
||||
cursor = table->cellAt(0, 0).firstCursorPosition();
|
||||
|
||||
QVERIFY(cursor.block().text() == "Test");
|
||||
QCOMPARE(cursor.block().text(), QLatin1String("Test"));
|
||||
}
|
||||
|
||||
table = create2x2Table();
|
||||
@ -750,7 +750,7 @@ void tst_QTextTable::setCellFormat()
|
||||
fmt.setTableCellColumnSpan(25);
|
||||
fmt.setTableCellRowSpan(42);
|
||||
cell.setFormat(fmt);
|
||||
QVERIFY(cell.format().background().color() == QColor(Qt::blue));
|
||||
QCOMPARE(cell.format().background().color(), QColor(Qt::blue));
|
||||
QCOMPARE(cell.format().tableCellColumnSpan(), 1);
|
||||
QCOMPARE(cell.format().tableCellRowSpan(), 1);
|
||||
}
|
||||
|
@ -256,41 +256,41 @@ void tst_QDoubleValidator::notifySignals()
|
||||
dv.setTop(0.8);
|
||||
QCOMPARE(topSpy.count(), 1);
|
||||
QCOMPARE(changedSpy.count(), 1);
|
||||
QVERIFY(dv.top() == 0.8);
|
||||
QCOMPARE(dv.top(), 0.8);
|
||||
dv.setBottom(0.2);
|
||||
QCOMPARE(bottomSpy.count(), 1);
|
||||
QCOMPARE(changedSpy.count(), 2);
|
||||
QVERIFY(dv.bottom() == 0.2);
|
||||
QCOMPARE(dv.bottom(), 0.2);
|
||||
|
||||
dv.setRange(0.2, 0.7);
|
||||
QCOMPARE(topSpy.count(), 2);
|
||||
QCOMPARE(bottomSpy.count(), 1);
|
||||
QCOMPARE(decSpy.count(), 1);
|
||||
QCOMPARE(changedSpy.count(), 3);
|
||||
QVERIFY(dv.bottom() == 0.2);
|
||||
QVERIFY(dv.top() == 0.7);
|
||||
QVERIFY(dv.decimals() == 0.);
|
||||
QCOMPARE(dv.bottom(), 0.2);
|
||||
QCOMPARE(dv.top(), 0.7);
|
||||
QCOMPARE(dv.decimals(), 0);
|
||||
|
||||
dv.setRange(0.3, 0.7);
|
||||
QCOMPARE(topSpy.count(), 2);
|
||||
QCOMPARE(bottomSpy.count(), 2);
|
||||
QCOMPARE(changedSpy.count(), 4);
|
||||
QVERIFY(dv.bottom() == 0.3);
|
||||
QVERIFY(dv.top() == 0.7);
|
||||
QVERIFY(dv.decimals() == 0.);
|
||||
QCOMPARE(dv.bottom(), 0.3);
|
||||
QCOMPARE(dv.top(), 0.7);
|
||||
QCOMPARE(dv.decimals(), 0);
|
||||
|
||||
dv.setRange(0.4, 0.6);
|
||||
QCOMPARE(topSpy.count(), 3);
|
||||
QCOMPARE(bottomSpy.count(), 3);
|
||||
QCOMPARE(changedSpy.count(), 5);
|
||||
QVERIFY(dv.bottom() == 0.4);
|
||||
QVERIFY(dv.top() == 0.6);
|
||||
QVERIFY(dv.decimals() == 0.);
|
||||
QCOMPARE(dv.bottom(), 0.4);
|
||||
QCOMPARE(dv.top(), 0.6);
|
||||
QCOMPARE(dv.decimals(), 0);
|
||||
|
||||
dv.setDecimals(10);
|
||||
QCOMPARE(decSpy.count(), 2);
|
||||
QCOMPARE(changedSpy.count(), 6);
|
||||
QVERIFY(dv.decimals() == 10.);
|
||||
QCOMPARE(dv.decimals(), 10);
|
||||
|
||||
|
||||
dv.setRange(0.4, 0.6, 100);
|
||||
@ -298,14 +298,14 @@ void tst_QDoubleValidator::notifySignals()
|
||||
QCOMPARE(bottomSpy.count(), 3);
|
||||
QCOMPARE(decSpy.count(), 3);
|
||||
QCOMPARE(changedSpy.count(), 7);
|
||||
QVERIFY(dv.bottom() == 0.4);
|
||||
QVERIFY(dv.top() == 0.6);
|
||||
QVERIFY(dv.decimals() == 100.);
|
||||
QCOMPARE(dv.bottom(), 0.4);
|
||||
QCOMPARE(dv.top(), 0.6);
|
||||
QCOMPARE(dv.decimals(), 100);
|
||||
|
||||
dv.setNotation(QDoubleValidator::StandardNotation);
|
||||
QCOMPARE(notSpy.count(), 1);
|
||||
QCOMPARE(changedSpy.count(), 8);
|
||||
QVERIFY(dv.notation() == QDoubleValidator::StandardNotation);
|
||||
QCOMPARE(dv.notation(), QDoubleValidator::StandardNotation);
|
||||
|
||||
dv.setRange(dv.bottom(), dv.top(), dv.decimals());
|
||||
QCOMPARE(topSpy.count(), 3);
|
||||
|
@ -239,32 +239,32 @@ void tst_QIntValidator::notifySignals()
|
||||
iv.setTop(9);
|
||||
QCOMPARE(topSpy.count(), 1);
|
||||
QCOMPARE(changedSpy.count(), 1);
|
||||
QVERIFY(iv.top() == 9);
|
||||
QCOMPARE(iv.top(), 9);
|
||||
iv.setBottom(1);
|
||||
QCOMPARE(bottomSpy.count(), 1);
|
||||
QCOMPARE(changedSpy.count(), 2);
|
||||
QVERIFY(iv.bottom() == 1);
|
||||
QCOMPARE(iv.bottom(), 1);
|
||||
|
||||
iv.setRange(1, 8);
|
||||
QCOMPARE(topSpy.count(), 2);
|
||||
QCOMPARE(bottomSpy.count(), 1);
|
||||
QCOMPARE(changedSpy.count(), 3);
|
||||
QVERIFY(iv.top() == 8);
|
||||
QVERIFY(iv.bottom() == 1);
|
||||
QCOMPARE(iv.top(), 8);
|
||||
QCOMPARE(iv.bottom(), 1);
|
||||
|
||||
iv.setRange(2, 8);
|
||||
QCOMPARE(topSpy.count(), 2);
|
||||
QCOMPARE(bottomSpy.count(), 2);
|
||||
QCOMPARE(changedSpy.count(), 4);
|
||||
QVERIFY(iv.top() == 8);
|
||||
QVERIFY(iv.bottom() == 2);
|
||||
QCOMPARE(iv.top(), 8);
|
||||
QCOMPARE(iv.bottom(), 2);
|
||||
|
||||
iv.setRange(3, 7);
|
||||
QCOMPARE(topSpy.count(), 3);
|
||||
QCOMPARE(bottomSpy.count(), 3);
|
||||
QCOMPARE(changedSpy.count(), 5);
|
||||
QVERIFY(iv.top() == 7);
|
||||
QVERIFY(iv.bottom() == 3);
|
||||
QCOMPARE(iv.top(), 7);
|
||||
QCOMPARE(iv.bottom(), 3);
|
||||
|
||||
iv.setRange(3, 7);
|
||||
QCOMPARE(topSpy.count(), 3);
|
||||
|
@ -231,7 +231,7 @@ void tst_MacGui::spinBoxArrowButtons()
|
||||
const QRect lessRect = lessInterface->rect();
|
||||
const QRect lessLocalRect(colorWidget.mapFromGlobal(lessRect.topLeft()), colorWidget.mapFromGlobal(lessRect.bottomRight()));
|
||||
const QRect compareRect = lessLocalRect.adjusted(5, 3, -5, -7);
|
||||
QVERIFY(noFocus.copy(compareRect) == focus.copy(compareRect));
|
||||
QCOMPARE(noFocus.copy(compareRect), focus.copy(compareRect));
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_MacGui)
|
||||
|
Loading…
x
Reference in New Issue
Block a user