summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMarius Storm-Olsen <marius.storm-olsen@nokia.com>2009-11-06 09:33:33 +0100
committerMarius Storm-Olsen <marius.storm-olsen@nokia.com>2009-11-06 15:45:10 +0100
commite53c26b52c890f242491e0dfed4201313d98f720 (patch)
tree7fac2b3f8972ea22c1136995864f6eacda87ccac /tests
parent98e0b95581f46b94773a55195e0e67a466c333ed (diff)
API review: Rename functions numColors(), setNumColors() and numBytes()
QPaintDevice and QImage used the functions numColors(), setNumColors(), and numBytes(). However, this is not consistent with the rest of the Qt API which uses *Count() and set*Count(). Removed all usage of these functions inside Qt and test-cases. Reviewed-by: Andreas Aardal Hanssen
Diffstat (limited to 'tests')
-rw-r--r--tests/arthur/common/paintcommands.cpp16
-rw-r--r--tests/arthur/common/paintcommands.h2
-rw-r--r--tests/auto/qdatastream/tst_qdatastream.cpp2
-rw-r--r--tests/auto/qimage/tst_qimage.cpp24
-rw-r--r--tests/auto/qimagewriter/tst_qimagewriter.cpp2
-rw-r--r--tests/auto/qitemdelegate/tst_qitemdelegate.cpp2
-rw-r--r--tests/auto/qpainter/tst_qpainter.cpp4
-rw-r--r--tests/auto/qpixmap/tst_qpixmap.cpp6
8 files changed, 29 insertions, 29 deletions
diff --git a/tests/arthur/common/paintcommands.cpp b/tests/arthur/common/paintcommands.cpp
index 44deb0e624..feabaed3c7 100644
--- a/tests/arthur/common/paintcommands.cpp
+++ b/tests/arthur/common/paintcommands.cpp
@@ -587,10 +587,10 @@ void PaintCommands::staticInit()
"^image_setColor\\s+([\\w.:\\/]*)\\s+([0-9]*)\\s+#([0-9]*)$",
"image_setColor <imageName> <index> <color>",
"image_setColor myImage 0 black");
- DECL_PAINTCOMMAND("image_setNumColors", command_image_setNumColors,
- "^image_setNumColors\\s+([\\w.:\\/]*)\\s+([0-9]*)$",
- "image_setNumColors <imageName> <nbColors>",
- "image_setNumColors myImage 128");
+ DECL_PAINTCOMMAND("image_setColorCount", command_image_setColorCount,
+ "^image_setColorCount\\s+([\\w.:\\/]*)\\s+([0-9]*)$",
+ "image_setColorCount <imageName> <nbColors>",
+ "image_setColorCount myImage 128");
DECL_PAINTCOMMANDSECTION("transformations");
DECL_PAINTCOMMAND("resetMatrix", command_resetMatrix,
@@ -2245,7 +2245,7 @@ void PaintCommands::command_image_load(QRegExp re)
}
/***************************************************************************************************/
-void PaintCommands::command_image_setNumColors(QRegExp re)
+void PaintCommands::command_image_setColorCount(QRegExp re)
{
QStringList caps = re.capturedTexts();
@@ -2253,10 +2253,10 @@ void PaintCommands::command_image_setNumColors(QRegExp re)
int count = convertToInt(caps.at(2));
if (m_verboseMode)
- printf(" -(lance) image_setNumColors(%s), %d -> %d\n",
- qPrintable(name), m_imageMap[name].numColors(), count);
+ printf(" -(lance) image_setColorCount(%s), %d -> %d\n",
+ qPrintable(name), m_imageMap[name].colorCount(), count);
- m_imageMap[name].setNumColors(count);
+ m_imageMap[name].setColorCount(count);
}
/***************************************************************************************************/
diff --git a/tests/arthur/common/paintcommands.h b/tests/arthur/common/paintcommands.h
index ba91a9266a..e2c4d67af7 100644
--- a/tests/arthur/common/paintcommands.h
+++ b/tests/arthur/common/paintcommands.h
@@ -239,7 +239,7 @@ private:
void command_image_convertToFormat(QRegExp re);
void command_image_load(QRegExp re);
void command_image_setColor(QRegExp re);
- void command_image_setNumColors(QRegExp re);
+ void command_image_setColorCount(QRegExp re);
// commands: transformation
void command_resetMatrix(QRegExp re);
diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp
index 56fc53a235..7535645d1e 100644
--- a/tests/auto/qdatastream/tst_qdatastream.cpp
+++ b/tests/auto/qdatastream/tst_qdatastream.cpp
@@ -1461,7 +1461,7 @@ void tst_QDataStream::readQImage(QDataStream *s)
QVERIFY(d12.width() == ref.width());
QVERIFY(d12.height() == ref.height());
QVERIFY(d12.depth() == ref.depth());
- QVERIFY(d12.numColors() == ref.numColors());
+ QVERIFY(d12.colorCount() == ref.colorCount());
#ifdef QT3_SUPPORT
QVERIFY(d12.hasAlphaBuffer() == ref.hasAlphaBuffer());
#else
diff --git a/tests/auto/qimage/tst_qimage.cpp b/tests/auto/qimage/tst_qimage.cpp
index e15ae8a645..da4e85d074 100644
--- a/tests/auto/qimage/tst_qimage.cpp
+++ b/tests/auto/qimage/tst_qimage.cpp
@@ -104,7 +104,7 @@ private slots:
void setPixel_data();
void setPixel();
- void setNumColors();
+ void setColorCount();
void setColor();
void rasterClipping();
@@ -155,7 +155,7 @@ void tst_QImage::create()
#endif
//QImage image(7000000, 7000000, 8, 256, QImage::IgnoreEndian);
QImage image(7000000, 7000000, QImage::Format_Indexed8);
- image.setNumColors(256);
+ image.setColorCount(256);
cr = !image.isNull();
#if !defined(Q_WS_QWS) && !defined(Q_OS_WINCE)
} catch (...) {
@@ -242,7 +242,7 @@ void tst_QImage::convertBitOrder()
QSKIP("Qt compiled without Qt3Support", SkipAll);
#else
QImage i(9,5,1,2,QImage::LittleEndian);
- qMemSet(i.bits(), 0, i.numBytes());
+ qMemSet(i.bits(), 0, i.byteCount());
i.setDotsPerMeterX(9);
i.setDotsPerMeterY(5);
@@ -258,7 +258,7 @@ void tst_QImage::convertBitOrder()
QVERIFY(i.dotsPerMeterY() == ni.dotsPerMeterY());
QVERIFY(i.depth() == ni.depth());
QVERIFY(i.size() == ni.size());
- QVERIFY(i.numColors() == ni.numColors());
+ QVERIFY(i.colorCount() == ni.colorCount());
#endif
}
@@ -365,7 +365,7 @@ void tst_QImage::setAlphaChannel()
QImage alphaChannel;
if (gray) {
alphaChannel = QImage(width, height, QImage::Format_Indexed8);
- alphaChannel.setNumColors(256);
+ alphaChannel.setColorCount(256);
for (int i=0; i<256; ++i)
alphaChannel.setColor(i, qRgb(i, i, i));
alphaChannel.fill(alpha);
@@ -927,7 +927,7 @@ void tst_QImage::rotate()
original.fill(qRgb(255,255,255));
if (format == QImage::Format_Indexed8) {
- original.setNumColors(256);
+ original.setColorCount(256);
for (int i = 0; i < 255; ++i)
original.setColor(i, qRgb(0, i, i));
}
@@ -1196,23 +1196,23 @@ void tst_QImage::convertToFormatPreserveText()
}
#endif // QT_NO_IMAGE_TEXT
-void tst_QImage::setNumColors()
+void tst_QImage::setColorCount()
{
QImage img(0, 0, QImage::Format_Indexed8);
- QTest::ignoreMessage(QtWarningMsg, "QImage::setNumColors: null image");
- img.setNumColors(256);
- QCOMPARE(img.numColors(), 0);
+ QTest::ignoreMessage(QtWarningMsg, "QImage::setColorCount: null image");
+ img.setColorCount(256);
+ QCOMPARE(img.colorCount(), 0);
}
void tst_QImage::setColor()
{
QImage img(0, 0, QImage::Format_Indexed8);
img.setColor(0, qRgba(18, 219, 108, 128));
- QCOMPARE(img.numColors(), 0);
+ QCOMPARE(img.colorCount(), 0);
QImage img2(1, 1, QImage::Format_Indexed8);
img2.setColor(0, qRgba(18, 219, 108, 128));
- QCOMPARE(img2.numColors(), 1);
+ QCOMPARE(img2.colorCount(), 1);
}
/* Just some sanity checking that we don't draw outside the buffer of
diff --git a/tests/auto/qimagewriter/tst_qimagewriter.cpp b/tests/auto/qimagewriter/tst_qimagewriter.cpp
index 584a0602bb..ab5572dc58 100644
--- a/tests/auto/qimagewriter/tst_qimagewriter.cpp
+++ b/tests/auto/qimagewriter/tst_qimagewriter.cpp
@@ -546,7 +546,7 @@ void tst_QImageWriter::saveWithNoFormat()
QFETCH(QImageWriter::ImageWriterError, error);
QImage niceImage(64, 64, QImage::Format_ARGB32);
- qMemSet(niceImage.bits(), 0, niceImage.numBytes());
+ qMemSet(niceImage.bits(), 0, niceImage.byteCount());
QImageWriter writer(fileName /* , 0 - no format! */);
if (error != 0) {
diff --git a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
index 426887d7cf..a2770d49d3 100644
--- a/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/qitemdelegate/tst_qitemdelegate.cpp
@@ -877,7 +877,7 @@ void tst_QItemDelegate::decoration()
}
case QVariant::Image: {
QImage img(size, QImage::Format_Mono);
- qMemSet(img.bits(), 0, img.numBytes());
+ qMemSet(img.bits(), 0, img.byteCount());
value = img;
break;
}
diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp
index 4d2c6266ba..003a494987 100644
--- a/tests/auto/qpainter/tst_qpainter.cpp
+++ b/tests/auto/qpainter/tst_qpainter.cpp
@@ -2918,7 +2918,7 @@ void tst_QPainter::monoImages()
QImage img(2, 2, format);
- if (img.numColors() > 0) {
+ if (img.colorCount() > 0) {
img.setColor(0, QColor(colorPairs[j][0]).rgba());
img.setColor(1, QColor(colorPairs[j][1]).rgba());
}
@@ -2940,7 +2940,7 @@ void tst_QPainter::monoImages()
// should not change the image
QCOMPARE(original, img);
- if (img.numColors() == 0)
+ if (img.colorCount() == 0)
continue;
for (int k = 0; k < 2; ++k) {
diff --git a/tests/auto/qpixmap/tst_qpixmap.cpp b/tests/auto/qpixmap/tst_qpixmap.cpp
index 8e02c74e25..d7f042edea 100644
--- a/tests/auto/qpixmap/tst_qpixmap.cpp
+++ b/tests/auto/qpixmap/tst_qpixmap.cpp
@@ -293,7 +293,7 @@ void tst_QPixmap::setAlphaChannel()
QRgb expected = alpha == 0 ? 0 : qRgba(red, green, blue, alpha);
for (int y = 0; y < height; ++y) {
for (int x = 0; x < width; ++x) {
- if (result.numColors() > 0) {
+ if (result.colorCount() > 0) {
ok &= result.pixelIndex(x, y) == expected;
} else {
ok &= result.pixel(x, y) == expected;
@@ -330,7 +330,7 @@ void tst_QPixmap::fromImage()
QImage image(37, 16, format);
- if (image.numColors() == 2) {
+ if (image.colorCount() == 2) {
image.setColor(0, QColor(Qt::color0).rgba());
image.setColor(1, QColor(Qt::color1).rgba());
}
@@ -731,7 +731,7 @@ void tst_QPixmap::testMetrics()
void tst_QPixmap::createMaskFromColor()
{
QImage image(3, 3, QImage::Format_Indexed8);
- image.setNumColors(10);
+ image.setColorCount(10);
image.setColor(0, 0xffffffff);
image.setColor(1, 0xff000000);
image.setColor(2, 0xffff0000);