Port from container::count() and length() to size()

This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8:

  auto QtContainerClass = expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)
  makeRule(cxxMemberCallExpr(on(QtContainerClass),
                             callee(cxxMethodDecl(hasAnyName({"count", "length"),
                                                  parameterCountIs(0))))),
           changeTo(cat(access(o, cat("size"), "()"))),
           cat("use 'size()' instead of 'count()/length()'"))

a.k.a qt-port-to-std-compatible-api with config Scope: 'Container',
with the extended set of container classes recognized.

Change-Id: Ibed02600e225ee63c06d61bcd6187518f650a0a0
Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marc Mutz 2022-10-05 07:43:51 +02:00
parent affcc0be3f
commit 1a85163e15
14 changed files with 95 additions and 95 deletions

View File

@ -996,7 +996,7 @@ int Abstract3DController::addCustomItem(QCustom3DItem *item)
item->d_ptr->resetDirtyBits();
m_isCustomDataDirty = true;
emitNeedRender();
return m_customItems.count() - 1;
return m_customItems.size() - 1;
}
void Abstract3DController::deleteCustomItems()
@ -1523,7 +1523,7 @@ int Abstract3DController::selectedLabelIndex() const
{
int index = m_selectedLabelIndex;
QAbstract3DAxis *axis = selectedAxis();
if (axis && axis->labels().count() <= index)
if (axis && axis->labels().size() <= index)
index = -1;
return index;
}
@ -1553,7 +1553,7 @@ QAbstract3DAxis *Abstract3DController::selectedAxis() const
int Abstract3DController::selectedCustomItemIndex() const
{
int index = m_selectedCustomItemIndex;
if (m_customItems.count() <= index)
if (m_customItems.size() <= index)
index = -1;
return index;
}

View File

@ -95,12 +95,12 @@ void QTouch3DInputHandler::touchEvent(QTouchEvent *event)
QList<QTouchEvent::TouchPoint> points;
points = event->points();
if (!scene()->isSlicingActive() && points.count() == 2) {
if (!scene()->isSlicingActive() && points.size() == 2) {
d_ptr->m_holdTimer->stop();
QPointF distance = points.at(0).position() - points.at(1).position();
QPoint midPoint = ((points.at(0).position() + points.at(1).position()) / 2.0).toPoint();
d_ptr->handlePinchZoom(distance.manhattanLength(), midPoint);
} else if (points.count() == 1) {
} else if (points.size() == 1) {
QPointF pointerPos = points.at(0).position();
if (event->type() == QEvent::TouchBegin) {
// Flush input state

View File

@ -55,7 +55,7 @@ bool MeshLoader::loadOBJ(const QString &path, QList<QVector3D> &out_vertices,
QStringList set1 = lineContents.at(1).split(slashTag);
QStringList set2 = lineContents.at(2).split(slashTag);
QStringList set3 = lineContents.at(3).split(slashTag);
if (set1.length() < 3 || set2.length() < 3 || set3.length() < 3) {
if (set1.size() < 3 || set2.size() < 3 || set3.size() < 3) {
qWarning("The file being loaded is missing UVs and/or normals");
return false;
}

View File

@ -52,10 +52,10 @@ void ScatterObjectBufferHelper::fullLoad(ScatterSeriesRenderCache *cache, qreal
const QList<QVector3D> indexed_vertices = dotObj->indexedvertices();
const QList<QVector2D> indexed_uvs = dotObj->indexedUVs();
const QList<QVector3D> indexed_normals = dotObj->indexedNormals();
const int indicesCount = indices.count();
const int verticeCount = indexed_vertices.count();
const int uvsCount = indexed_uvs.count();
const int normalsCount = indexed_normals.count();
const int indicesCount = indices.size();
const int verticeCount = indexed_vertices.size();
const int uvsCount = indexed_uvs.size();
const int normalsCount = indexed_normals.size();
float itemSize = cache->itemSize() / itemScaler;
if (itemSize == 0.0f)
@ -172,7 +172,7 @@ void ScatterObjectBufferHelper::fullLoad(ScatterSeriesRenderCache *cache, qreal
void ScatterObjectBufferHelper::updateUVs(ScatterSeriesRenderCache *cache)
{
ObjectHelper *dotObj = cache->object();
const int uvsCount = dotObj->indexedUVs().count();
const int uvsCount = dotObj->indexedUVs().size();
const ScatterRenderItemArray &renderArray = cache->renderArray();
const bool updateAll = (cache->updateIndices().size() == 0);
const int updateSize = updateAll ? renderArray.size() : cache->updateIndices().size();
@ -213,7 +213,7 @@ uint ScatterObjectBufferHelper::createRangeGradientUVs(ScatterSeriesRenderCache
QList<QVector2D> &buffered_uvs)
{
ObjectHelper *dotObj = cache->object();
const int uvsCount = dotObj->indexedUVs().count();
const int uvsCount = dotObj->indexedUVs().size();
const ScatterRenderItemArray &renderArray = cache->renderArray();
const bool updateAll = (cache->updateIndices().size() == 0);
const int updateSize = updateAll ? renderArray.size() : cache->updateIndices().size();
@ -256,7 +256,7 @@ uint ScatterObjectBufferHelper::createObjectGradientUVs(ScatterSeriesRenderCache
const QList<QVector3D> &indexed_vertices)
{
ObjectHelper *dotObj = cache->object();
const int uvsCount = dotObj->indexedUVs().count();
const int uvsCount = dotObj->indexedUVs().size();
const ScatterRenderItemArray &renderArray = cache->renderArray();
const uint renderArraySize = renderArray.size();
@ -293,7 +293,7 @@ void ScatterObjectBufferHelper::update(ScatterSeriesRenderCache *cache, qreal do
// Index vertices
const QList<QVector3D> indexed_vertices = dotObj->indexedvertices();
int verticeCount = indexed_vertices.count();
int verticeCount = indexed_vertices.size();
float itemSize = cache->itemSize() / itemScaler;
if (itemSize == 0.0f)

View File

@ -163,7 +163,7 @@ void DeclarativeBar3DSeries::appendRowColorsFunc(QQmlListProperty<DeclarativeCol
qsizetype DeclarativeBar3DSeries::countRowColorsFunc(QQmlListProperty<DeclarativeColor> *list)
{
return reinterpret_cast<DeclarativeBar3DSeries *>(list->data)->colorList().count();
return reinterpret_cast<DeclarativeBar3DSeries *>(list->data)->colorList().size();
}
DeclarativeColor *DeclarativeBar3DSeries::atRowColorsFunc(QQmlListProperty<DeclarativeColor> *list,

View File

@ -54,7 +54,7 @@ void tst_axis::initialProperties()
{
QVERIFY(m_axis);
QCOMPARE(m_axis->labels().length(), 0);
QCOMPARE(m_axis->labels().size(), 0);
// Common (from QAbstract3DAxis)
QCOMPARE(m_axis->isAutoAdjustRange(), true);
@ -74,7 +74,7 @@ void tst_axis::initializeProperties()
m_axis->setLabels(QStringList() << "first" << "second");
QCOMPARE(m_axis->labels().length(), 2);
QCOMPARE(m_axis->labels().size(), 2);
QCOMPARE(m_axis->labels().at(1), QString("second"));
// Common (from QAbstract3DAxis)

View File

@ -62,7 +62,7 @@ void tst_axis::initialProperties()
// Common (from QAbstract3DAxis)
QCOMPARE(m_axis->isAutoAdjustRange(), true);
QCOMPARE(m_axis->labelAutoRotation(), 0.0f);
QCOMPARE(m_axis->labels().length(), 6);
QCOMPARE(m_axis->labels().size(), 6);
QCOMPARE(m_axis->labels().at(0), QString("0.00"));
QCOMPARE(m_axis->labels().at(1), QString("2.00"));
QCOMPARE(m_axis->labels().at(2), QString("4.00"));
@ -103,7 +103,7 @@ void tst_axis::initializeProperties()
QCOMPARE(m_axis->isAutoAdjustRange(), false);
QCOMPARE(m_axis->labelAutoRotation(), 15.0f);
QCOMPARE(m_axis->labels().length(), 3);
QCOMPARE(m_axis->labels().size(), 3);
QCOMPARE(m_axis->labels().at(0), QString("5m"));
QCOMPARE(m_axis->labels().at(1), QString("15m"));
QCOMPARE(m_axis->labels().at(2), QString("25m"));

View File

@ -66,8 +66,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->columnRole(), QString(""));
QCOMPARE(proxy->valueRole(), QString("val"));
QCOMPARE(proxy->rotationRole(), QString(""));
QCOMPARE(proxy->rowCategories().length(), 0);
QCOMPARE(proxy->columnCategories().length(), 0);
QCOMPARE(proxy->rowCategories().size(), 0);
QCOMPARE(proxy->columnCategories().size(), 0);
delete proxy;
proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val");
@ -76,8 +76,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->columnRole(), QString("col"));
QCOMPARE(proxy->valueRole(), QString("val"));
QCOMPARE(proxy->rotationRole(), QString(""));
QCOMPARE(proxy->rowCategories().length(), 0);
QCOMPARE(proxy->columnCategories().length(), 0);
QCOMPARE(proxy->rowCategories().size(), 0);
QCOMPARE(proxy->columnCategories().size(), 0);
delete proxy;
proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val", "rot");
@ -86,8 +86,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->columnRole(), QString("col"));
QCOMPARE(proxy->valueRole(), QString("val"));
QCOMPARE(proxy->rotationRole(), QString("rot"));
QCOMPARE(proxy->rowCategories().length(), 0);
QCOMPARE(proxy->columnCategories().length(), 0);
QCOMPARE(proxy->rowCategories().size(), 0);
QCOMPARE(proxy->columnCategories().size(), 0);
delete proxy;
proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val",
@ -97,8 +97,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->columnRole(), QString("col"));
QCOMPARE(proxy->valueRole(), QString("val"));
QCOMPARE(proxy->rotationRole(), QString(""));
QCOMPARE(proxy->rowCategories().length(), 1);
QCOMPARE(proxy->columnCategories().length(), 1);
QCOMPARE(proxy->rowCategories().size(), 1);
QCOMPARE(proxy->columnCategories().size(), 1);
delete proxy;
proxy = new QItemModelBarDataProxy(table->model(), "row", "col", "val", "rot",
@ -108,8 +108,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->columnRole(), QString("col"));
QCOMPARE(proxy->valueRole(), QString("val"));
QCOMPARE(proxy->rotationRole(), QString("rot"));
QCOMPARE(proxy->rowCategories().length(), 1);
QCOMPARE(proxy->columnCategories().length(), 1);
QCOMPARE(proxy->rowCategories().size(), 1);
QCOMPARE(proxy->columnCategories().size(), 1);
delete proxy;
}
@ -137,9 +137,9 @@ void tst_proxy::initialProperties()
QCOMPARE(m_proxy->valueRolePattern(), QRegularExpression());
QCOMPARE(m_proxy->valueRoleReplace(), QString());
QCOMPARE(m_proxy->columnLabels().count(), 0);
QCOMPARE(m_proxy->columnLabels().size(), 0);
QCOMPARE(m_proxy->rowCount(), 0);
QCOMPARE(m_proxy->rowLabels().count(), 0);
QCOMPARE(m_proxy->rowLabels().size(), 0);
QVERIFY(!m_proxy->series());
QCOMPARE(m_proxy->type(), QAbstractDataProxy::DataTypeBar);
@ -173,7 +173,7 @@ void tst_proxy::initializeProperties()
QCOMPARE(m_proxy->autoColumnCategories(), false);
QCOMPARE(m_proxy->autoRowCategories(), false);
QCOMPARE(m_proxy->columnCategories().count(), 2);
QCOMPARE(m_proxy->columnCategories().size(), 2);
QCOMPARE(m_proxy->columnRole(), QString("column"));
QCOMPARE(m_proxy->columnRolePattern(), QRegularExpression("/^.*-(\\d\\d)$/"));
QCOMPARE(m_proxy->columnRoleReplace(), QString("\\\\1"));
@ -182,7 +182,7 @@ void tst_proxy::initializeProperties()
QCOMPARE(m_proxy->rotationRole(), QString("rotation"));
QCOMPARE(m_proxy->rotationRolePattern(), QRegularExpression("/-/"));
QCOMPARE(m_proxy->rotationRoleReplace(), QString("\\\\1"));
QCOMPARE(m_proxy->rowCategories().count(), 2);
QCOMPARE(m_proxy->rowCategories().size(), 2);
QCOMPARE(m_proxy->rowRole(), QString("row"));
QCOMPARE(m_proxy->rowRolePattern(), QRegularExpression("/^(\\d\\d\\d\\d).*$/"));
QCOMPARE(m_proxy->rowRoleReplace(), QString("\\\\1"));
@ -246,9 +246,9 @@ void tst_proxy::multiMatch()
QCoreApplication::processEvents();
QCOMPARE(graph.valueAxis()->max(), 15.0f);
QCOMPARE(m_proxy->columnLabels().count(), 1);
QCOMPARE(m_proxy->columnLabels().size(), 1);
QCOMPARE(m_proxy->rowCount(), 1);
QCOMPARE(m_proxy->rowLabels().count(), 1);
QCOMPARE(m_proxy->rowLabels().size(), 1);
QVERIFY(m_proxy->series());
m_proxy = 0; // Proxy gets deleted as graph gets deleted

View File

@ -53,9 +53,9 @@ void tst_proxy::initialProperties()
{
QVERIFY(m_proxy);
QCOMPARE(m_proxy->columnLabels().count(), 0);
QCOMPARE(m_proxy->columnLabels().size(), 0);
QCOMPARE(m_proxy->rowCount(), 0);
QCOMPARE(m_proxy->rowLabels().count(), 0);
QCOMPARE(m_proxy->rowLabels().size(), 0);
QVERIFY(!m_proxy->series());
QCOMPARE(m_proxy->type(), QAbstractDataProxy::DataTypeBar);
@ -71,9 +71,9 @@ void tst_proxy::initializeProperties()
m_proxy->addRow(data);
m_proxy->setRowLabels(QStringList() << "1");
QCOMPARE(m_proxy->columnLabels().count(), 3);
QCOMPARE(m_proxy->columnLabels().size(), 3);
QCOMPARE(m_proxy->rowCount(), 1);
QCOMPARE(m_proxy->rowLabels().count(), 1);
QCOMPARE(m_proxy->rowLabels().size(), 1);
}
QTEST_MAIN(tst_proxy)

View File

@ -98,7 +98,7 @@ void tst_bars::initialProperties()
QCOMPARE(m_graph->barSpacing(), QSizeF(1.0f, 1.0f));
QCOMPARE(m_graph->barSeriesMargin(), QSizeF(0.0f, 0.0f));
QCOMPARE(m_graph->isBarSpacingRelative(), true);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
QVERIFY(!m_graph->selectedSeries());
QVERIFY(!m_graph->primarySeries());
QCOMPARE(m_graph->floorLevel(), 0.0);
@ -198,7 +198,7 @@ void tst_bars::addSeries()
m_graph->addSeries(series);
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
QVERIFY(!m_graph->selectedSeries());
QCOMPARE(m_graph->primarySeries(), series);
}
@ -213,7 +213,7 @@ void tst_bars::addMultipleSeries()
m_graph->addSeries(series2);
m_graph->addSeries(series3);
QCOMPARE(m_graph->seriesList().length(), 3);
QCOMPARE(m_graph->seriesList().size(), 3);
QCOMPARE(m_graph->primarySeries(), series);
m_graph->setPrimarySeries(series2);
@ -228,7 +228,7 @@ void tst_bars::selectSeries()
m_graph->addSeries(series);
m_graph->primarySeries()->setSelectedBar(QPoint(0, 0));
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
QCOMPARE(m_graph->selectedSeries(), series);
m_graph->clearSelection();
@ -241,7 +241,7 @@ void tst_bars::removeSeries()
m_graph->addSeries(series);
m_graph->removeSeries(series);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
delete series;
}
@ -259,16 +259,16 @@ void tst_bars::removeMultipleSeries()
QCOMPARE(m_graph->selectedSeries(), series);
m_graph->removeSeries(series);
QCOMPARE(m_graph->seriesList().length(), 2);
QCOMPARE(m_graph->seriesList().size(), 2);
QCOMPARE(m_graph->primarySeries(), series2);
QVERIFY(!m_graph->selectedSeries());
m_graph->removeSeries(series2);
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
QCOMPARE(m_graph->primarySeries(), series3);
m_graph->removeSeries(series3);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
delete series;
delete series2;
@ -294,14 +294,14 @@ void tst_bars::addInputHandler()
m_graph->addInputHandler(handler);
m_graph->addInputHandler(handler2);
QCOMPARE(m_graph->inputHandlers().length(), 3); // Default, as it is still active, plus added ones
QCOMPARE(m_graph->inputHandlers().size(), 3); // Default, as it is still active, plus added ones
QCOMPARE(m_graph->activeInputHandler(), initialHandler);
m_graph->setActiveInputHandler(handler2);
QCOMPARE(m_graph->activeInputHandler(), handler2);
m_graph->setActiveInputHandler(NULL);
QVERIFY(!m_graph->activeInputHandler());
QCOMPARE(m_graph->inputHandlers().length(), 2);
QCOMPARE(m_graph->inputHandlers().size(), 2);
}
void tst_bars::removeInputHandler()
@ -313,12 +313,12 @@ void tst_bars::removeInputHandler()
m_graph->addInputHandler(handler2);
m_graph->setActiveInputHandler(handler2);
QCOMPARE(m_graph->inputHandlers().length(), 2); // Default handler removed by previous call
QCOMPARE(m_graph->inputHandlers().size(), 2); // Default handler removed by previous call
QCOMPARE(m_graph->activeInputHandler(), handler2);
m_graph->releaseInputHandler(handler2);
QCOMPARE(m_graph->inputHandlers().length(), 1);
QCOMPARE(m_graph->inputHandlers().size(), 1);
m_graph->releaseInputHandler(handler);
QCOMPARE(m_graph->inputHandlers().length(), 0);
QCOMPARE(m_graph->inputHandlers().size(), 0);
delete handler2;
delete handler;
@ -332,7 +332,7 @@ void tst_bars::addTheme()
m_graph->addTheme(theme);
m_graph->addTheme(theme2);
QCOMPARE(m_graph->themes().length(), 3); // Default, plus added ones
QCOMPARE(m_graph->themes().size(), 3); // Default, plus added ones
QCOMPARE(m_graph->activeTheme(), initialTheme);
m_graph->setActiveTheme(theme2);
QCOMPARE(m_graph->activeTheme(), theme2);
@ -348,9 +348,9 @@ void tst_bars::removeTheme()
m_graph->setActiveTheme(theme2);
QCOMPARE(m_graph->activeTheme(), theme2);
m_graph->releaseTheme(theme2);
QCOMPARE(m_graph->themes().length(), 2);
QCOMPARE(m_graph->themes().size(), 2);
m_graph->releaseTheme(theme);
QCOMPARE(m_graph->themes().length(), 1); // Default theme remains
QCOMPARE(m_graph->themes().size(), 1); // Default theme remains
delete theme2;
delete theme;
@ -362,9 +362,9 @@ void tst_bars::addCustomItem()
QCustom3DItem *item2 = new QCustom3DItem();
m_graph->addCustomItem(item);
QCOMPARE(m_graph->customItems().length(), 1);
QCOMPARE(m_graph->customItems().size(), 1);
m_graph->addCustomItem(item2);
QCOMPARE(m_graph->customItems().length(), 2);
QCOMPARE(m_graph->customItems().size(), 2);
}
void tst_bars::removeCustomItem()
@ -379,14 +379,14 @@ void tst_bars::removeCustomItem()
m_graph->addCustomItem(item3);
m_graph->releaseCustomItem(item);
QCOMPARE(m_graph->customItems().length(), 2);
QCOMPARE(m_graph->customItems().size(), 2);
m_graph->removeCustomItem(item2);
QCOMPARE(m_graph->customItems().length(), 1);
QCOMPARE(m_graph->customItems().size(), 1);
m_graph->addCustomItem(item);
m_graph->removeCustomItemAt(QVector3D(1, 1, 1));
QCOMPARE(m_graph->customItems().length(), 1);
QCOMPARE(m_graph->customItems().size(), 1);
m_graph->removeCustomItems();
QCOMPARE(m_graph->customItems().length(), 0);
QCOMPARE(m_graph->customItems().size(), 0);
}
void tst_bars::renderToImage()

View File

@ -78,7 +78,7 @@ void tst_scatter::construct()
void tst_scatter::initialProperties()
{
QVERIFY(m_graph);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
QVERIFY(!m_graph->selectedSeries());
QCOMPARE(m_graph->axisX()->orientation(), QAbstract3DAxis::AxisOrientationX);
QCOMPARE(m_graph->axisY()->orientation(), QAbstract3DAxis::AxisOrientationY);
@ -158,7 +158,7 @@ void tst_scatter::addSeries()
{
m_graph->addSeries(newSeries());
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
QVERIFY(!m_graph->selectedSeries());
}
@ -172,7 +172,7 @@ void tst_scatter::addMultipleSeries()
m_graph->addSeries(series2);
m_graph->addSeries(series3);
QCOMPARE(m_graph->seriesList().length(), 3);
QCOMPARE(m_graph->seriesList().size(), 3);
}
void tst_scatter::selectSeries()
@ -182,7 +182,7 @@ void tst_scatter::selectSeries()
m_graph->addSeries(series);
m_graph->seriesList()[0]->setSelectedItem(1);
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
QCOMPARE(m_graph->selectedSeries(), series);
m_graph->clearSelection();
@ -195,7 +195,7 @@ void tst_scatter::removeSeries()
m_graph->addSeries(series);
m_graph->removeSeries(series);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
delete series;
}
@ -214,14 +214,14 @@ void tst_scatter::removeMultipleSeries()
QCOMPARE(m_graph->selectedSeries(), series);
m_graph->removeSeries(series);
QCOMPARE(m_graph->seriesList().length(), 2);
QCOMPARE(m_graph->seriesList().size(), 2);
QVERIFY(!m_graph->selectedSeries());
m_graph->removeSeries(series2);
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
m_graph->removeSeries(series3);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
delete series;
delete series2;

View File

@ -68,8 +68,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->xPosRole(), QString(""));
QCOMPARE(proxy->yPosRole(), QString("y"));
QCOMPARE(proxy->zPosRole(), QString(""));
QCOMPARE(proxy->rowCategories().length(), 0);
QCOMPARE(proxy->columnCategories().length(), 0);
QCOMPARE(proxy->rowCategories().size(), 0);
QCOMPARE(proxy->columnCategories().size(), 0);
delete proxy;
proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "y");
@ -79,8 +79,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->xPosRole(), QString("column"));
QCOMPARE(proxy->yPosRole(), QString("y"));
QCOMPARE(proxy->zPosRole(), QString("row"));
QCOMPARE(proxy->rowCategories().length(), 0);
QCOMPARE(proxy->columnCategories().length(), 0);
QCOMPARE(proxy->rowCategories().size(), 0);
QCOMPARE(proxy->columnCategories().size(), 0);
delete proxy;
proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "x", "y", "z");
@ -90,8 +90,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->xPosRole(), QString("x"));
QCOMPARE(proxy->yPosRole(), QString("y"));
QCOMPARE(proxy->zPosRole(), QString("z"));
QCOMPARE(proxy->rowCategories().length(), 0);
QCOMPARE(proxy->columnCategories().length(), 0);
QCOMPARE(proxy->rowCategories().size(), 0);
QCOMPARE(proxy->columnCategories().size(), 0);
delete proxy;
proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "y",
@ -102,8 +102,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->xPosRole(), QString("column"));
QCOMPARE(proxy->yPosRole(), QString("y"));
QCOMPARE(proxy->zPosRole(), QString("row"));
QCOMPARE(proxy->rowCategories().length(), 1);
QCOMPARE(proxy->columnCategories().length(), 1);
QCOMPARE(proxy->rowCategories().size(), 1);
QCOMPARE(proxy->columnCategories().size(), 1);
delete proxy;
proxy = new QItemModelSurfaceDataProxy(table.model(), "row", "column", "x", "y", "z",
@ -114,8 +114,8 @@ void tst_proxy::construct()
QCOMPARE(proxy->xPosRole(), QString("x"));
QCOMPARE(proxy->yPosRole(), QString("y"));
QCOMPARE(proxy->zPosRole(), QString("z"));
QCOMPARE(proxy->rowCategories().length(), 1);
QCOMPARE(proxy->columnCategories().length(), 1);
QCOMPARE(proxy->rowCategories().size(), 1);
QCOMPARE(proxy->columnCategories().size(), 1);
delete proxy;
}
@ -184,13 +184,13 @@ void tst_proxy::initializeProperties()
QCOMPARE(m_proxy->autoColumnCategories(), false);
QCOMPARE(m_proxy->autoRowCategories(), false);
QCOMPARE(m_proxy->columnCategories().count(), 2);
QCOMPARE(m_proxy->columnCategories().size(), 2);
QCOMPARE(m_proxy->columnRole(), QString("column"));
QCOMPARE(m_proxy->columnRolePattern(), QRegularExpression("/^.*-(\\d\\d)$/"));
QCOMPARE(m_proxy->columnRoleReplace(), QString("\\\\1"));
QVERIFY(m_proxy->itemModel());
QCOMPARE(m_proxy->multiMatchBehavior(), QItemModelSurfaceDataProxy::MMBAverage);
QCOMPARE(m_proxy->rowCategories().count(), 2);
QCOMPARE(m_proxy->rowCategories().size(), 2);
QCOMPARE(m_proxy->rowRole(), QString("row"));
QCOMPARE(m_proxy->rowRolePattern(), QRegularExpression("/^(\\d\\d\\d\\d).*$/"));
QCOMPARE(m_proxy->rowRoleReplace(), QString("\\\\1"));

View File

@ -83,7 +83,7 @@ void tst_surface::construct()
void tst_surface::initialProperties()
{
QVERIFY(m_graph);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
QVERIFY(!m_graph->selectedSeries());
QCOMPARE(m_graph->flipHorizontalGrid(), false);
QCOMPARE(m_graph->axisX()->orientation(), QAbstract3DAxis::AxisOrientationX);
@ -168,7 +168,7 @@ void tst_surface::addSeries()
{
m_graph->addSeries(newSeries());
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
QVERIFY(!m_graph->selectedSeries());
}
@ -182,7 +182,7 @@ void tst_surface::addMultipleSeries()
m_graph->addSeries(series2);
m_graph->addSeries(series3);
QCOMPARE(m_graph->seriesList().length(), 3);
QCOMPARE(m_graph->seriesList().size(), 3);
}
void tst_surface::selectSeries()
@ -192,7 +192,7 @@ void tst_surface::selectSeries()
m_graph->addSeries(series);
m_graph->seriesList()[0]->setSelectedPoint(QPoint(0, 0));
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
QCOMPARE(m_graph->selectedSeries(), series);
m_graph->clearSelection();
@ -205,7 +205,7 @@ void tst_surface::removeSeries()
m_graph->addSeries(series);
m_graph->removeSeries(series);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
delete series;
}
@ -224,14 +224,14 @@ void tst_surface::removeMultipleSeries()
QCOMPARE(m_graph->selectedSeries(), series);
m_graph->removeSeries(series);
QCOMPARE(m_graph->seriesList().length(), 2);
QCOMPARE(m_graph->seriesList().size(), 2);
QVERIFY(!m_graph->selectedSeries());
m_graph->removeSeries(series2);
QCOMPARE(m_graph->seriesList().length(), 1);
QCOMPARE(m_graph->seriesList().size(), 1);
m_graph->removeSeries(series3);
QCOMPARE(m_graph->seriesList().length(), 0);
QCOMPARE(m_graph->seriesList().size(), 0);
delete series;
delete series2;

View File

@ -54,10 +54,10 @@ void tst_theme::construct()
QCOMPARE(theme->ambientLightStrength(), 0.5f);
QCOMPARE(theme->backgroundColor(), QColor(Qt::black));
QCOMPARE(theme->isBackgroundEnabled(), true);
QCOMPARE(theme->baseColors().length(), 5);
QCOMPARE(theme->baseColors().size(), 5);
QCOMPARE(theme->baseColors().at(0), QColor(Qt::white));
QCOMPARE(theme->baseColors().at(4), QColor(QRgb(0x6b6b6b)));
QCOMPARE(theme->baseGradients().length(), 5);
QCOMPARE(theme->baseGradients().size(), 5);
QCOMPARE(theme->baseGradients().at(0).stops().at(1).second, QColor(Qt::white));
QCOMPARE(theme->baseGradients().at(4).stops().at(1).second, QColor(QRgb(0x6b6b6b)));
QCOMPARE(theme->colorStyle(), Q3DTheme::ColorStyleUniform);
@ -87,9 +87,9 @@ void tst_theme::initialProperties()
QCOMPARE(m_theme->ambientLightStrength(), 0.25f);
QCOMPARE(m_theme->backgroundColor(), QColor(Qt::black));
QCOMPARE(m_theme->isBackgroundEnabled(), true);
QCOMPARE(m_theme->baseColors().length(), 1);
QCOMPARE(m_theme->baseColors().size(), 1);
QCOMPARE(m_theme->baseColors().at(0), QColor(Qt::black));
QCOMPARE(m_theme->baseGradients().length(), 1);
QCOMPARE(m_theme->baseGradients().size(), 1);
QCOMPARE(m_theme->baseGradients().at(0).stops().at(0).second, QColor(Qt::black));
QCOMPARE(m_theme->baseGradients().at(0).stops().at(1).second, QColor(Qt::white));
QCOMPARE(m_theme->colorStyle(), Q3DTheme::ColorStyleUniform);
@ -152,10 +152,10 @@ void tst_theme::initializeProperties()
QCOMPARE(m_theme->ambientLightStrength(), 0.3f);
QCOMPARE(m_theme->backgroundColor(), QColor(Qt::red));
QCOMPARE(m_theme->isBackgroundEnabled(), false);
QCOMPARE(m_theme->baseColors().length(), 2);
QCOMPARE(m_theme->baseColors().size(), 2);
QCOMPARE(m_theme->baseColors().at(0), QColor(Qt::red));
QCOMPARE(m_theme->baseColors().at(1), QColor(Qt::blue));
QCOMPARE(m_theme->baseGradients().length(), 2);
QCOMPARE(m_theme->baseGradients().size(), 2);
QCOMPARE(m_theme->baseGradients().at(0), gradient1);
QCOMPARE(m_theme->baseGradients().at(0), gradient2);
QCOMPARE(m_theme->colorStyle(), Q3DTheme::ColorStyleRangeGradient);