tests/auto/gui: Remove some placeholder formatting.
Use QByteArray/QString addition instead in loops and for test row names. Change-Id: I31adb60bdaf7ea243143a9244b6c4f66f38b189d Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@theqtcompany.com>bb10
parent
71ae742c1f
commit
733ac31ccc
|
|
@ -970,13 +970,17 @@ void tst_QImage::createAlphaMask_data()
|
|||
int alphas[] = { 0, 127, 255 };
|
||||
|
||||
for (unsigned a1 = 0; a1 < sizeof(alphas) / sizeof(int); ++a1) {
|
||||
const QByteArray a1B = QByteArray::number(alphas[a1]);
|
||||
for (unsigned a2 = 0; a2 < sizeof(alphas) / sizeof(int); ++a2) {
|
||||
if (a1 == a2)
|
||||
continue;
|
||||
const QByteArray a2B = QByteArray::number(alphas[a2]);
|
||||
for (int x=10; x<18; x+=3) {
|
||||
const QByteArray xB = QByteArray::number(x);
|
||||
for (int y=100; y<108; y+=3) {
|
||||
QTest::newRow(qPrintable(QString::fromLatin1("x=%1, y=%2, a1=%3, a2=%4").arg(x).arg(y).arg(alphas[a1]).arg(alphas[a2])))
|
||||
<< x << y << alphas[a1] << alphas[a2];
|
||||
const QByteArray testName = "x=" + xB + ", y=" + QByteArray::number(y)
|
||||
+ ", a1=" + a1B + ", a2=" + a2B;
|
||||
QTest::newRow(testName.constData()) << x << y << alphas[a1] << alphas[a2];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1073,34 +1077,34 @@ void tst_QImage::rotate_data()
|
|||
degrees << 0 << 90 << 180 << 270;
|
||||
|
||||
foreach (int d, degrees) {
|
||||
QString title = QString("%1 %2").arg(d);
|
||||
QTest::newRow(qPrintable(title.arg("Format_RGB32")))
|
||||
const QByteArray dB = QByteArray::number(d);
|
||||
QTest::newRow((dB + " Format_RGB32").constData())
|
||||
<< QImage::Format_RGB32 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_ARGB32")))
|
||||
QTest::newRow((dB + " Format_ARGB32").constData())
|
||||
<< QImage::Format_ARGB32 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_ARGB32_Premultiplied")))
|
||||
QTest::newRow((dB + " Format_ARGB32_Premultiplied").constData())
|
||||
<< QImage::Format_ARGB32_Premultiplied << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_RGB16")))
|
||||
QTest::newRow((dB + " Format_RGB16").constData())
|
||||
<< QImage::Format_RGB16 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_ARGB8565_Premultiplied")))
|
||||
QTest::newRow((dB + " Format_ARGB8565_Premultiplied").constData())
|
||||
<< QImage::Format_ARGB8565_Premultiplied << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_RGB666")))
|
||||
QTest::newRow((dB + " Format_RGB666").constData())
|
||||
<< QImage::Format_RGB666 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_RGB555")))
|
||||
QTest::newRow((dB + " Format_RGB555").constData())
|
||||
<< QImage::Format_RGB555 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_ARGB8555_Premultiplied")))
|
||||
QTest::newRow((dB + " Format_ARGB8555_Premultiplied").constData())
|
||||
<< QImage::Format_ARGB8555_Premultiplied << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_RGB888")))
|
||||
QTest::newRow((dB + " Format_RGB888").constData())
|
||||
<< QImage::Format_RGB888 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_Indexed8")))
|
||||
QTest::newRow((dB + " Format_Indexed8").constData())
|
||||
<< QImage::Format_Indexed8 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_RGBX8888")))
|
||||
QTest::newRow((dB + " Format_RGBX8888").constData())
|
||||
<< QImage::Format_RGBX8888 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_RGBA8888_Premultiplied")))
|
||||
QTest::newRow((dB + " Format_RGBA8888_Premultiplied").constData())
|
||||
<< QImage::Format_RGBA8888_Premultiplied << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_Alpha8")))
|
||||
QTest::newRow((dB + " Format_Alpha8").constData())
|
||||
<< QImage::Format_Alpha8 << d;
|
||||
QTest::newRow(qPrintable(title.arg("Format_Grayscale8")))
|
||||
QTest::newRow((dB + " Format_Grayscale8").constData())
|
||||
<< QImage::Format_Grayscale8 << d;
|
||||
}
|
||||
}
|
||||
|
|
@ -1624,9 +1628,11 @@ void tst_QImage::smoothScale2_data()
|
|||
int sizes[] = { 2, 3, 4, 6, 7, 8, 10, 16, 20, 32, 40, 64, 100, 101, 128, 0 };
|
||||
QImage::Format formats[] = { QImage::Format_RGB32, QImage::Format_ARGB32_Premultiplied, QImage::Format_Invalid };
|
||||
for (int j = 0; formats[j] != QImage::Format_Invalid; ++j) {
|
||||
QString formatstr = formats[j] == QImage::Format_RGB32 ? QStringLiteral("rgb32") : QStringLiteral("argb32pm");
|
||||
QByteArray formatstr = formats[j] == QImage::Format_RGB32 ? QByteArrayLiteral("rgb32") : QByteArrayLiteral("argb32pm");
|
||||
for (int i = 0; sizes[i] != 0; ++i) {
|
||||
QTest::newRow(QString("%1 %2x%2").arg(formatstr).arg(sizes[i]).toUtf8()) << (int)formats[j] << sizes[i];
|
||||
const QByteArray sizeB = QByteArray::number(sizes[i]);
|
||||
QTest::newRow((formatstr + ' ' + sizeB + 'x' + sizeB).constData())
|
||||
<< (int)formats[j] << sizes[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2598,10 +2604,11 @@ void tst_QImage::genericRgbConversion_data()
|
|||
QTest::addColumn<QImage::Format>("dest_format");
|
||||
|
||||
for (int i = QImage::Format_RGB32; i < QImage::Format_Alpha8; ++i) {
|
||||
const QString formatI = formatToString(QImage::Format(i));
|
||||
for (int j = QImage::Format_RGB32; j < QImage::Format_Alpha8; ++j) {
|
||||
if (i == j)
|
||||
continue;
|
||||
QString test = QString::fromLatin1("%1 -> %2").arg(formatToString(QImage::Format(i))).arg(formatToString(QImage::Format(j)));
|
||||
const QString test = formatI + QLatin1String(" -> ") + formatToString(QImage::Format(j));
|
||||
QTest::newRow(qPrintable(test)) << QImage::Format(i) << QImage::Format(j);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -785,7 +785,7 @@ void tst_QImageReader::animatedGif()
|
|||
QVERIFY(!image.isNull());
|
||||
int i = 0;
|
||||
while(!image.isNull()){
|
||||
QString frameName = QString(":images/qt%1.gif").arg(++i);
|
||||
QString frameName = QLatin1String(":images/qt") + QString::number(++i) + QLatin1String(".gif");
|
||||
QCOMPARE(image, QImage(frameName));
|
||||
image = io.read();
|
||||
}
|
||||
|
|
@ -1637,14 +1637,14 @@ void tst_QImageReader::pixelCompareWithBaseline()
|
|||
// least one file succeeded we know that the plugin was built.
|
||||
// The other failures are then real failures.
|
||||
QImage icoImg;
|
||||
const QString inputFileName(QString::fromLatin1("images/%1").arg(fileName));
|
||||
const QString inputFileName(QLatin1String("images/") + fileName);
|
||||
QFileInfo fi(inputFileName);
|
||||
|
||||
++enteredCount;
|
||||
// might fail if the plugin does not exist, which is ok.
|
||||
if (icoImg.load(inputFileName)) {
|
||||
icoImg = icoImg.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
const QString baselineFileName(QString::fromLatin1("baseline/%1.png").arg(fi.baseName()));
|
||||
const QString baselineFileName(QLatin1String("baseline/") + fi.baseName() + QLatin1String(".png"));
|
||||
#if 0
|
||||
icoImg.save(baselineFileName);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -271,8 +271,8 @@ void tst_QImageWriter::writeImage2_data()
|
|||
QImage image = image0.convertToFormat(imgFormat);
|
||||
initializePadding(&image);
|
||||
foreach (const QString format, formats) {
|
||||
const QString fileName = QString("solidcolor_%1.%2").arg(imgFormat)
|
||||
.arg(format);
|
||||
const QString fileName = QLatin1String("solidcolor_")
|
||||
+ QString::number(imgFormat) + QLatin1Char('.') + format;
|
||||
QTest::newRow(fileName.toLatin1()) << fileName
|
||||
<< format.toLatin1()
|
||||
<< image;
|
||||
|
|
|
|||
|
|
@ -445,7 +445,8 @@ void tst_QPixmap::scroll()
|
|||
else
|
||||
QVERIFY(pixmap.cacheKey() != oldKey);
|
||||
|
||||
QString fileName = QString(":/images/%1.png").arg(QTest::currentDataTag());
|
||||
const QString fileName = QLatin1String(":/images/") + QLatin1String(QTest::currentDataTag())
|
||||
+ QLatin1String(".png");
|
||||
QPixmap output(fileName);
|
||||
QCOMPARE(input.isNull(), output.isNull());
|
||||
QVERIFY(lenientCompare(pixmap, output));
|
||||
|
|
@ -458,7 +459,7 @@ void tst_QPixmap::fill_data()
|
|||
QTest::addColumn<bool>("syscolor");
|
||||
QTest::addColumn<bool>("bitmap");
|
||||
for (int color = Qt::black; color < Qt::darkYellow; ++color)
|
||||
QTest::newRow(QString("syscolor_%1").arg(color).toLatin1())
|
||||
QTest::newRow(("syscolor_" + QByteArray::number(color)).constData())
|
||||
<< uint(color) << true << false;
|
||||
|
||||
#if defined (Q_OS_WINCE)
|
||||
|
|
@ -1000,7 +1001,9 @@ void tst_QPixmap::toWinHICON()
|
|||
HBITMAP bitmap = qt_pixmapToWinHBITMAP(empty, Alpha);
|
||||
SelectObject(bitmap_dc, bitmap);
|
||||
|
||||
QImage imageFromFile(image + QString(QLatin1String("_%1x%2.png")).arg(width).arg(height));
|
||||
const QString fileName = image + QLatin1Char('_') + QString::number(width) + QLatin1Char('x')
|
||||
+ QString::number(height) + QLatin1String(".png");
|
||||
QImage imageFromFile(fileName);
|
||||
imageFromFile = imageFromFile.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
HICON icon = qt_pixmapToWinHICON(QPixmap::fromImage(imageFromFile));
|
||||
|
|
@ -1036,7 +1039,9 @@ void tst_QPixmap::fromWinHICON()
|
|||
QImage imageFromHICON = qt_pixmapFromWinHICON(icon).toImage();
|
||||
DestroyIcon(icon);
|
||||
|
||||
QImage imageFromFile(image + QString(QLatin1String("_%1x%2.png")).arg(width).arg(height));
|
||||
const QString fileName = image + QLatin1Char('_') + QString::number(width) + QLatin1Char('x')
|
||||
+ QString::number(height) + QLatin1String(".png");
|
||||
QImage imageFromFile(fileName);
|
||||
imageFromFile = imageFromFile.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
// fuzzy comparison must be used, as the pixel values change slightly during conversion
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@ void tst_QStandardItem::getSetData()
|
|||
QStandardItem item;
|
||||
for (int x = 0; x < 2; ++x) {
|
||||
for (int i = 1; i <= 2; ++i) {
|
||||
QString text = QString("text %0").arg(i);
|
||||
const QString iS = QString::number(i);
|
||||
QString text = QLatin1String("text ") + iS;
|
||||
item.setText(text);
|
||||
QCOMPARE(item.text(), text);
|
||||
|
||||
|
|
@ -150,15 +151,15 @@ void tst_QStandardItem::getSetData()
|
|||
item.setIcon(icon);
|
||||
QCOMPARE(item.icon(), icon);
|
||||
|
||||
QString toolTip = QString("toolTip %0").arg(i);
|
||||
QString toolTip = QLatin1String("toolTip ") + iS;
|
||||
item.setToolTip(toolTip);
|
||||
QCOMPARE(item.toolTip(), toolTip);
|
||||
|
||||
QString statusTip = QString("statusTip %0").arg(i);
|
||||
QString statusTip = QLatin1String("statusTip ") + iS;
|
||||
item.setStatusTip(statusTip);
|
||||
QCOMPARE(item.statusTip(), statusTip);
|
||||
|
||||
QString whatsThis = QString("whatsThis %0").arg(i);
|
||||
QString whatsThis = QLatin1String("whatsThis ") + iS;
|
||||
item.setWhatsThis(whatsThis);
|
||||
QCOMPARE(item.whatsThis(), whatsThis);
|
||||
|
||||
|
|
@ -188,11 +189,11 @@ void tst_QStandardItem::getSetData()
|
|||
item.setCheckState(checkState);
|
||||
QCOMPARE(item.checkState(), checkState);
|
||||
|
||||
QString accessibleText = QString("accessibleText %0").arg(i);
|
||||
QString accessibleText = QLatin1String("accessibleText ") + iS;
|
||||
item.setAccessibleText(accessibleText);
|
||||
QCOMPARE(item.accessibleText(), accessibleText);
|
||||
|
||||
QString accessibleDescription = QString("accessibleDescription %0").arg(i);
|
||||
QString accessibleDescription = QLatin1String("accessibleDescription ") + iS;
|
||||
item.setAccessibleDescription(accessibleDescription);
|
||||
QCOMPARE(item.accessibleDescription(), accessibleDescription);
|
||||
|
||||
|
|
|
|||
|
|
@ -300,7 +300,7 @@ void tst_QStandardItemModel::insertRowsItems()
|
|||
QStandardItemModel *m = qobject_cast<QStandardItemModel*>(m_model);
|
||||
QStandardItem *hiddenRoot = m->invisibleRootItem();
|
||||
for (int i = 0; i < 3; ++i)
|
||||
items.append(new QStandardItem(QString("%1").arg(i + 10)));
|
||||
items.append(new QStandardItem(QString::number(i + 10)));
|
||||
hiddenRoot->appendRows(items);
|
||||
QCOMPARE(m_model->rowCount(), rowCount + 3);
|
||||
QCOMPARE(m_model->index(rowCount + 0, 0).data().toInt(), 10);
|
||||
|
|
@ -874,7 +874,7 @@ void tst_QStandardItemModel::sort_data()
|
|||
<< "zulu");
|
||||
QStringList list;
|
||||
for (int i=1000; i < 2000; ++i)
|
||||
list.append(QString("Number: %1").arg(i));
|
||||
list.append(QStringLiteral("Number: ") + QString::number(i));
|
||||
QTest::newRow("large set ascending") << static_cast<int>(Qt::AscendingOrder) << list << list;
|
||||
}
|
||||
|
||||
|
|
@ -1336,7 +1336,7 @@ void tst_QStandardItemModel::useCase3()
|
|||
// create the tree structure first
|
||||
QStandardItem *childItem = 0;
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
|
||||
QStandardItem *item = new QStandardItem(QStringLiteral("item ") + QString::number(i));
|
||||
if (childItem)
|
||||
item->appendRow(childItem);
|
||||
childItem = item;
|
||||
|
|
@ -1466,6 +1466,38 @@ struct FriendlyTreeView : public QTreeView
|
|||
#endif
|
||||
|
||||
#ifdef QT_BUILD_INTERNAL
|
||||
|
||||
static void populateDragAndDropModel(QStandardItemModel &model, int nRow, int nCol)
|
||||
{
|
||||
const QString item = QStringLiteral("item ");
|
||||
const QString dash = QStringLiteral(" - ");
|
||||
for (int i = 0; i < nRow; ++i) {
|
||||
const QString iS = QString::number(i);
|
||||
QList<QStandardItem *> colItems1;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems1 << new QStandardItem(item + iS + dash + QString::number(c));
|
||||
model.appendRow(colItems1);
|
||||
|
||||
for (int j = 0; j < nRow; ++j) {
|
||||
const QString jS = QString::number(j);
|
||||
QList<QStandardItem *> colItems2;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems2 << new QStandardItem(item + iS + QLatin1Char('/') + jS + dash + QString::number(c));
|
||||
colItems1.at(0)->appendRow(colItems2);
|
||||
|
||||
for (int k = 0; k < nRow; ++k) {
|
||||
QList<QStandardItem *> colItems3;
|
||||
const QString kS = QString::number(k);
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems3 << new QStandardItem(item + iS + QLatin1Char('/') + jS
|
||||
+ QLatin1Char('/') + kS
|
||||
+ dash + QString::number(c));
|
||||
colItems2.at(0)->appendRow(colItems3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QStandardItemModel::treeDragAndDrop()
|
||||
{
|
||||
const int nRow = 5;
|
||||
|
|
@ -1474,47 +1506,8 @@ void tst_QStandardItemModel::treeDragAndDrop()
|
|||
QStandardItemModel model;
|
||||
QStandardItemModel checkModel;
|
||||
|
||||
for (int i = 0; i < nRow; ++i) {
|
||||
QList<QStandardItem *> colItems1;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i));
|
||||
model.appendRow(colItems1);
|
||||
|
||||
for (int j = 0; j < nRow; ++j) {
|
||||
QList<QStandardItem *> colItems2;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j));
|
||||
colItems1.at(0)->appendRow(colItems2);
|
||||
|
||||
for (int k = 0; k < nRow; ++k) {
|
||||
QList<QStandardItem *> colItems3;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems3 << new QStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k));
|
||||
colItems2.at(0)->appendRow(colItems3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < nRow; ++i) {
|
||||
QList<QStandardItem *> colItems1;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems1 << new QStandardItem(QString("item %1 - %0").arg(c).arg(i));
|
||||
checkModel.appendRow(colItems1);
|
||||
|
||||
for (int j = 0; j < nRow; ++j) {
|
||||
QList<QStandardItem *> colItems2;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems2 << new QStandardItem(QString("item %1/%2 - %0").arg(c).arg(i).arg(j));
|
||||
colItems1.at(0)->appendRow(colItems2);
|
||||
|
||||
for (int k = 0; k < nRow; ++k) {
|
||||
QList<QStandardItem *> colItems3;
|
||||
for (int c = 0 ; c < nCol; c ++)
|
||||
colItems3 << new QStandardItem(QString("item %1/%2/%3 - %0").arg(c).arg(i).arg(j).arg(k));
|
||||
colItems2.at(0)->appendRow(colItems3);
|
||||
}
|
||||
}
|
||||
}
|
||||
populateDragAndDropModel(model, nRow, nCol);
|
||||
populateDragAndDropModel(checkModel, nRow, nCol);
|
||||
|
||||
QVERIFY(compareModels(&model, &checkModel));
|
||||
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ QColor tst_QPainter::baseColor( int k, int intensity )
|
|||
QImage tst_QPainter::getResImage( const QString &dir, const QString &addition, const QString &extension )
|
||||
{
|
||||
QImage res;
|
||||
QString resFilename = dir + QString( "/res_%1." ).arg( addition ) + extension;
|
||||
QString resFilename = dir + QLatin1String("/res_") + addition + QLatin1Char('.') + extension;
|
||||
if ( !res.load( resFilename ) ) {
|
||||
QWARN(QString("Could not load result data %s %1").arg(resFilename).toLatin1());
|
||||
return QImage();
|
||||
|
|
@ -674,14 +674,14 @@ QImage tst_QPainter::getResImage( const QString &dir, const QString &addition, c
|
|||
QBitmap tst_QPainter::getBitmap( const QString &dir, const QString &filename, bool mask )
|
||||
{
|
||||
QBitmap bm;
|
||||
QString bmFilename = dir + QString( "/%1.xbm" ).arg( filename );
|
||||
QString bmFilename = dir + QLatin1Char('/') + filename + QLatin1String(".xbm");
|
||||
if ( !bm.load( bmFilename ) ) {
|
||||
QWARN(QString("Could not load bitmap '%1'").arg(bmFilename).toLatin1());
|
||||
return QBitmap();
|
||||
}
|
||||
if ( mask ) {
|
||||
QBitmap mask;
|
||||
QString maskFilename = dir + QString( "/%1-mask.xbm" ).arg( filename );
|
||||
QString maskFilename = dir + QLatin1Char('/') + filename + QLatin1String("-mask.xbm");
|
||||
if (!mask.load(maskFilename)) {
|
||||
QWARN(QString("Could not load mask '%1'").arg(maskFilename).toLatin1());
|
||||
return QBitmap();
|
||||
|
|
@ -1521,10 +1521,11 @@ void tst_QPainter::drawEllipse_data()
|
|||
// ratio between width and hight is too large/small (task 114874). Those
|
||||
// ratios are therefore currently avoided.
|
||||
for (int w = 10; w < 128; w += 7) {
|
||||
const QByteArray wB = QByteArray::number(w);
|
||||
for (int h = w/2; h < qMin(2*w, 128); h += 13) {
|
||||
QString s = QString("%1x%2").arg(w).arg(h);
|
||||
QTest::newRow(QString("%1 with pen").arg(s).toLatin1()) << QSize(w, h) << true;
|
||||
QTest::newRow(QString("%1 no pen").arg(s).toLatin1()) << QSize(w, h) << false;
|
||||
const QByteArray sB = wB + 'x' + QByteArray::number(h);
|
||||
QTest::newRow((sB + " with pen").constData()) << QSize(w, h) << true;
|
||||
QTest::newRow((sB + " no pen").constData()) << QSize(w, h) << false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1562,16 +1563,17 @@ void tst_QPainter::drawClippedEllipse_data()
|
|||
QTest::addColumn<QRect>("rect");
|
||||
|
||||
for (int w = 20; w < 128; w += 7) {
|
||||
const QByteArray wB = QByteArray::number(w);
|
||||
for (int h = w/2; h < qMin(2*w, 128); h += 13) {
|
||||
QString s = QString("%1x%2").arg(w).arg(h);
|
||||
QTest::newRow(QString("%1 top").arg(s).toLatin1()) << QRect(0, -h/2, w, h);
|
||||
QTest::newRow(QString("%1 topright").arg(s).toLatin1()) << QRect(w/2, -h/2, w, h);
|
||||
QTest::newRow(QString("%1 right").arg(s).toLatin1()) << QRect(w/2, 0, w, h);
|
||||
QTest::newRow(QString("%1 bottomright").arg(s).toLatin1()) << QRect(w/2, h/2, w, h);
|
||||
QTest::newRow(QString("%1 bottom").arg(s).toLatin1()) << QRect(0, h/2, w, h);
|
||||
QTest::newRow(QString("%1 bottomleft").arg(s).toLatin1()) << QRect(-w/2, h/2, w, h);
|
||||
QTest::newRow(QString("%1 left").arg(s).toLatin1()) << QRect(-w/2, 0, w, h);
|
||||
QTest::newRow(QString("%1 topleft").arg(s).toLatin1()) << QRect(-w/2, -h/2, w, h);
|
||||
const QByteArray sB = wB + 'x' + QByteArray::number(h);
|
||||
QTest::newRow((sB + " top").constData()) << QRect(0, -h/2, w, h);
|
||||
QTest::newRow((sB + " topright").constData()) << QRect(w/2, -h/2, w, h);
|
||||
QTest::newRow((sB + " right").constData()) << QRect(w/2, 0, w, h);
|
||||
QTest::newRow((sB + " bottomright").constData()) << QRect(w/2, h/2, w, h);
|
||||
QTest::newRow((sB + " bottom").constData()) << QRect(0, h/2, w, h);
|
||||
QTest::newRow((sB + " bottomleft").constData()) << QRect(-w/2, h/2, w, h);
|
||||
QTest::newRow((sB + " left").constData()) << QRect(-w/2, 0, w, h);
|
||||
QTest::newRow((sB + " topleft").constData()) << QRect(-w/2, -h/2, w, h);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1678,13 +1680,14 @@ void tst_QPainter::fillData()
|
|||
QTest::addColumn<bool>("usePen");
|
||||
|
||||
for (int w = 3; w < 50; w += 7) {
|
||||
const QByteArray wB = QByteArray::number(w);
|
||||
for (int h = 3; h < 50; h += 11) {
|
||||
int x = w/2 + 5;
|
||||
int y = h/2 + 5;
|
||||
QTest::newRow(QString("rect(%1, %2, %3, %4) with pen").arg(x).arg(y).arg(w).arg(h).toLatin1())
|
||||
<< QRect(x, y, w, h) << true;
|
||||
QTest::newRow(QString("rect(%1, %2, %3, %4) no pen").arg(x).arg(y).arg(w).arg(h).toLatin1())
|
||||
<< QRect(x, y, w, h) << false;
|
||||
const QByteArray rB = "rect(" + QByteArray::number(x) + ", " + QByteArray::number(y)
|
||||
+ ", " + QByteArray::number(w) + ", " + QByteArray::number(h) + ')';
|
||||
QTest::newRow((rB + " with pen").constData()) << QRect(x, y, w, h) << true;
|
||||
QTest::newRow((rB + " no pen").constData()) << QRect(x, y, w, h) << false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2167,21 +2170,23 @@ void tst_QPainter::clippedLines_data()
|
|||
<< QLineF(15, 50, 66, 50);
|
||||
|
||||
foreach (QLineF line, lines) {
|
||||
QString desc = QString("line (%1, %2, %3, %4) %5").arg(line.x1())
|
||||
.arg(line.y1()).arg(line.x2()).arg(line.y2());
|
||||
QTest::newRow(qPrintable(desc.arg(0))) << QSize(100, 100) << line
|
||||
const QByteArray desc = "line (" + QByteArray::number(line.x1())
|
||||
+ ", " + QByteArray::number(line.y1()) + ", "
|
||||
+ QByteArray::number(line.x2()) + ", " + QByteArray::number(line.y2())
|
||||
+ ") ";
|
||||
QTest::newRow((desc + '0').constData()) << QSize(100, 100) << line
|
||||
<< QRect(15, 15, 49, 49)
|
||||
<< QPen(Qt::black);
|
||||
QTest::newRow(qPrintable(desc.arg(1))) << QSize(100, 100) << line
|
||||
QTest::newRow((desc + '1').constData()) << QSize(100, 100) << line
|
||||
<< QRect(15, 15, 50, 50)
|
||||
<< QPen(Qt::black);
|
||||
QTest::newRow(qPrintable(desc.arg(2))) << QSize(100, 100) << line
|
||||
QTest::newRow((desc + '2').constData()) << QSize(100, 100) << line
|
||||
<< QRect(15, 15, 51, 51)
|
||||
<< QPen(Qt::black);
|
||||
QTest::newRow(qPrintable(desc.arg(3))) << QSize(100, 100) << line
|
||||
QTest::newRow((desc + '3').constData()) << QSize(100, 100) << line
|
||||
<< QRect(15, 15, 51, 51)
|
||||
<< QPen(Qt::NoPen);
|
||||
QTest::newRow(qPrintable(desc.arg(4))) << QSize(100, 100) << line
|
||||
QTest::newRow((desc + '4').constData()) << QSize(100, 100) << line
|
||||
<< QRect(15, 15, 51, 51)
|
||||
<< pen2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -270,13 +270,13 @@ void tst_QPainterPath::contains_QPointF_data()
|
|||
inside.addEllipse(base_rect.adjusted(5, 5, -5, -5));
|
||||
QPolygonF inside_poly = inside.toFillPolygon();
|
||||
for (int i=0; i<inside_poly.size(); ++i)
|
||||
QTest::newRow(qPrintable(QString("inside_ellipse %1").arg(i))) << path << inside_poly.at(i) << true;
|
||||
QTest::newRow(("inside_ellipse " + QByteArray::number(i)).constData()) << path << inside_poly.at(i) << true;
|
||||
|
||||
QPainterPath outside;
|
||||
outside.addEllipse(base_rect.adjusted(-5, -5, 5, 5));
|
||||
QPolygonF outside_poly = outside.toFillPolygon();
|
||||
for (int i=0; i<outside_poly.size(); ++i)
|
||||
QTest::newRow(qPrintable(QString("outside_ellipse %1").arg(i))) << path << outside_poly.at(i) << false;
|
||||
QTest::newRow(("outside_ellipse " + QByteArray::number(i)).constData()) << path << outside_poly.at(i) << false;
|
||||
|
||||
path = QPainterPath();
|
||||
base_rect = QRectF(50, 50, 200, 200);
|
||||
|
|
@ -852,8 +852,10 @@ void tst_QPainterPath::testArcMoveTo_data()
|
|||
<< QRectF(100, 100, -100, -100);
|
||||
|
||||
for (int domain=0; domain<rects.size(); ++domain) {
|
||||
const QByteArray dB = QByteArray::number(domain);
|
||||
for (int i=-360; i<=360; ++i) {
|
||||
QTest::newRow(qPrintable(QString("test %1 %2").arg(domain).arg(i))) << rects.at(domain) << (qreal) i;
|
||||
QTest::newRow(("test " + dB + ' ' + QByteArray::number(i)).constData())
|
||||
<< rects.at(domain) << (qreal) i;
|
||||
}
|
||||
|
||||
// test low angles
|
||||
|
|
|
|||
|
|
@ -916,21 +916,37 @@ void tst_QCssParser::marginValue_data()
|
|||
int ex = QFontMetrics(f).xHeight();
|
||||
int em = QFontMetrics(f).height();
|
||||
|
||||
const QString ex1234 = QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex)
|
||||
+ QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ')
|
||||
+ QString::number(4 * ex);
|
||||
const QString em2ex4 = QLatin1String("1 ") + QString::number(2*em) + QLatin1String(" 3 ")
|
||||
+ QString::number(4 * ex);
|
||||
|
||||
QTest::newRow("one value") << "margin: 1px" << "1 1 1 1";
|
||||
QTest::newRow("two values") << "margin: 1px 2px" << "1 2 1 2";
|
||||
QTest::newRow("three value") << "margin: 1px 2px 3px" << "1 2 3 2";
|
||||
QTest::newRow("four values") << "margin: 1px 2px 3px 4px" << "1 2 3 4";
|
||||
QTest::newRow("default px") << "margin: 1 2 3 4" << "1 2 3 4";
|
||||
QTest::newRow("no unit") << "margin: 1 2 3 4" << "1 2 3 4";
|
||||
QTest::newRow("em") << "margin: 1ex 2ex 3ex 4ex" << QString("%1 %2 %3 %4").arg(ex).arg(2*ex).arg(3*ex).arg(4*ex);
|
||||
QTest::newRow("ex") << "margin: 1 2em 3px 4ex" << QString("%1 %2 %3 %4").arg(1).arg(2*em).arg(3).arg(4*ex);
|
||||
QTest::newRow("em") << "margin: 1ex 2ex 3ex 4ex"
|
||||
<< (QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex)
|
||||
+ QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ')
|
||||
+ QString::number(4 * ex));
|
||||
QTest::newRow("ex") << "margin: 1 2em 3px 4ex"
|
||||
<< (QLatin1String("1 ") + QString::number(2 * em) + QLatin1String(" 3 ")
|
||||
+ QString::number(4 * ex));
|
||||
|
||||
f.setPointSize(20);
|
||||
f.setBold(true);
|
||||
ex = QFontMetrics(f).xHeight();
|
||||
em = QFontMetrics(f).height();
|
||||
QTest::newRow("em2") << "font: bold 20pt; margin: 1ex 2ex 3ex 4ex" << QString("%1 %2 %3 %4").arg(ex).arg(2*ex).arg(3*ex).arg(4*ex);
|
||||
QTest::newRow("ex2") << "margin: 1 2em 3px 4ex; font-size: 20pt; font-weight: bold;" << QString("%1 %2 %3 %4").arg(1).arg(2*em).arg(3).arg(4*ex);
|
||||
QTest::newRow("em2") << "font: bold 20pt; margin: 1ex 2ex 3ex 4ex"
|
||||
<< (QString::number(ex) + QLatin1Char(' ') + QString::number(2 * ex)
|
||||
+ QLatin1Char(' ') + QString::number(3 * ex) + QLatin1Char(' ')
|
||||
+ QString::number(4 * ex));
|
||||
QTest::newRow("ex2") << "margin: 1 2em 3px 4ex; font-size: 20pt; font-weight: bold;"
|
||||
<< (QLatin1String("1 ") + QString::number(2 * em) + QLatin1String(" 3 ")
|
||||
+ QString::number(4 * ex));
|
||||
|
||||
QTest::newRow("crap") << "margin: crap" << "0 0 0 0";
|
||||
}
|
||||
|
|
@ -963,7 +979,8 @@ void tst_QCssParser::marginValue()
|
|||
int p[4];
|
||||
int spacing;
|
||||
v.extractBox(m, p, &spacing);
|
||||
QString str = QString("%1 %2 %3 %4").arg(m[0]).arg(m[1]).arg(m[2]).arg(m[3]);
|
||||
QString str = QString::number(m[0]) + QLatin1Char(' ') + QString::number(m[1])
|
||||
+ QLatin1Char(' ') + QString::number(m[2]) + QLatin1Char(' ') + QString::number(m[3]);
|
||||
QCOMPARE(str, expectedMargin);
|
||||
}
|
||||
}
|
||||
|
|
@ -1090,7 +1107,7 @@ void tst_QCssParser::styleSelector()
|
|||
QFETCH(QString, xml);
|
||||
QFETCH(QString, elementToCheck);
|
||||
|
||||
QString css = QString("%1 { background-color: green }").arg(selector);
|
||||
const QString css = selector + QLatin1String(" { background-color: green }");
|
||||
QCss::Parser parser(css);
|
||||
QCss::StyleSheet sheet;
|
||||
QVERIFY(parser.parse(&sheet));
|
||||
|
|
@ -1154,7 +1171,7 @@ void tst_QCssParser::specificity()
|
|||
{
|
||||
QFETCH(QString, selector);
|
||||
|
||||
QString css = QString("%1 { }").arg(selector);
|
||||
QString css = selector + QLatin1String(" { }");
|
||||
QCss::Parser parser(css);
|
||||
QCss::StyleSheet sheet;
|
||||
QVERIFY(parser.parse(&sheet));
|
||||
|
|
|
|||
|
|
@ -679,7 +679,7 @@ static inline QByteArray msgNotAcceptableFont(const QString &defaultFamily, cons
|
|||
{
|
||||
QString res = QString::fromLatin1("Font family '%1' is not one of the following acceptable results: ").arg(defaultFamily);
|
||||
Q_FOREACH (const QString &family, acceptableFamilies)
|
||||
res += QString::fromLatin1("\n %1").arg(family);
|
||||
res += QLatin1String("\n ") + family;
|
||||
return res.toLocal8Bit();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -216,8 +216,8 @@ public:
|
|||
QString tst_QTextDocument::cssFontSizeString(const QFont &font)
|
||||
{
|
||||
return font.pointSize() >= 0
|
||||
? QStringLiteral("%1pt").arg(font.pointSizeF())
|
||||
: QStringLiteral("%1px").arg(font.pixelSize());
|
||||
? QString::number(font.pointSizeF()) + QStringLiteral("pt")
|
||||
: QString::number(font.pixelSize()) + QStringLiteral("px");
|
||||
}
|
||||
|
||||
// Testing get/set functions
|
||||
|
|
@ -3082,7 +3082,7 @@ void tst_QTextDocument::baseUrl()
|
|||
document.setBaseUrl(base);
|
||||
QCOMPARE(document.baseUrl(), base);
|
||||
|
||||
document.setHtml(QString("<img src='%1'/>").arg(resource.toString()));
|
||||
document.setHtml(QLatin1String("<img src='") + resource.toString() + QLatin1String("'/>"));
|
||||
document.resource(QTextDocument::ImageResource, resource);
|
||||
QCOMPARE(document.loadedResource(), loaded);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1177,9 +1177,11 @@ void tst_QTextDocumentFragment::copySubTable()
|
|||
fmt.setColumnWidthConstraints(constraints);
|
||||
|
||||
QTextTable *table = cursor.insertTable(4, 4, fmt);
|
||||
for (int row = 0; row < 4; ++row)
|
||||
for (int row = 0; row < 4; ++row) {
|
||||
const QString rowS = QString::number(row) + QLatin1Char('/');
|
||||
for (int col = 0; col < 4; ++col)
|
||||
table->cellAt(row, col).firstCursorPosition().insertText(QString("%1/%2").arg(row).arg(col));
|
||||
table->cellAt(row, col).firstCursorPosition().insertText(rowS + QString::number(col));
|
||||
}
|
||||
|
||||
QCOMPARE(table->format().columnWidthConstraints().count(), table->columns());
|
||||
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ void tst_QTextOdfWriter::testWriteParagraph_data()
|
|||
"<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">foobar <text:s text:c=\"2\"/>word<text:tab/>tab x</text:span></text:p>";
|
||||
QTest::newRow("misc2") << "\t \tFoo" <<
|
||||
"<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\"><text:tab/> <text:s text:c=\"4\"/><text:tab/>Foo</text:span></text:p>";
|
||||
QTest::newRow("linefeed") << QString("line1%1line2").arg(QChar(0x2028)) <<
|
||||
QTest::newRow("linefeed") << (QStringLiteral("line1") + QChar(0x2028) + QStringLiteral("line2")) <<
|
||||
"<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">line1<text:line-break/>line2</text:span></text:p>";
|
||||
QTest::newRow("spaces") << "The quick brown fox jumped over the lazy dog" <<
|
||||
"<text:p text:style-name=\"p1\"><text:span text:style-name=\"c0\">The quick brown fox jumped over the lazy dog</text:span></text:p>";
|
||||
|
|
|
|||
Loading…
Reference in New Issue