Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix build on msvc #48773

Merged
merged 1 commit into from
May 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 22 additions & 26 deletions tests/src/core/geometry/testqgslinestring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ void TestQgsLineString::constructorEmpty()

void TestQgsLineString::constructorFromArrayZ()
{
QVector< double > xx = QVector< double >() << 1 << 2 << 3;
QVector< double > yy = QVector< double >() << 11 << 12 << 13;
QVector< double > zz = QVector< double >() << 21 << 22 << 23;
QVector< double > xx( {1, 2, 3} );
QVector< double > yy( {11, 12, 13} );
QVector< double > zz( {21, 22, 23} );

QgsLineString ls( xx, yy, zz );

Expand Down Expand Up @@ -169,7 +169,7 @@ void TestQgsLineString::constructorFromArrayZ()
QCOMPARE( ls.zAt( 2 ), 23.0 );

// unbalanced -> z ignored
zz = QVector< double >() << 21 << 22;
zz = QVector< double >( {21, 22} );
ls = QgsLineString( xx, yy, zz );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineString );
Expand All @@ -182,7 +182,7 @@ void TestQgsLineString::constructorFromArrayZ()
QCOMPARE( ls.yAt( 2 ), 13.0 );

// unbalanced -> z truncated
zz = QVector< double >() << 21 << 22 << 23 << 24;
zz = QVector< double >( {21, 22, 23, 24} );
ls = QgsLineString( xx, yy, zz );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineStringZ );
Expand All @@ -200,9 +200,9 @@ void TestQgsLineString::constructorFromArrayZ()

void TestQgsLineString::constructorFromArrayM()
{
QVector< double > xx = QVector< double >() << 1 << 2 << 3;
QVector< double > yy = QVector< double >() << 11 << 12 << 13;
QVector< double > mm = QVector< double >() << 21 << 22 << 23;
QVector< double > xx( {1, 2, 3} );
QVector< double > yy( {11, 12, 13} );
QVector< double > mm( {21, 22, 23} );
QgsLineString ls( xx, yy, QVector< double >(), mm );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineStringM );
Expand All @@ -218,7 +218,7 @@ void TestQgsLineString::constructorFromArrayM()
QCOMPARE( ls.mAt( 2 ), 23.0 );

// unbalanced -> m ignored
mm = QVector< double >() << 21 << 22;
mm = QVector< double >( {21, 22} );
ls = QgsLineString( xx, yy, QVector< double >(), mm );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineString );
Expand All @@ -231,7 +231,7 @@ void TestQgsLineString::constructorFromArrayM()
QCOMPARE( ls.yAt( 2 ), 13.0 );

// unbalanced -> m truncated
mm = QVector< double >() << 21 << 22 << 23 << 24;
mm = QVector< double >( {21, 22, 23, 24} );;
ls = QgsLineString( xx, yy, QVector< double >(), mm );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineStringM );
Expand All @@ -249,10 +249,10 @@ void TestQgsLineString::constructorFromArrayM()

void TestQgsLineString::constructorFromArrayZM()
{
QVector< double > xx = QVector< double >() << 1 << 2 << 3;
QVector< double > yy = QVector< double >() << 11 << 12 << 13;
QVector< double > zz = QVector< double >() << 21 << 22 << 23;
QVector< double > mm = QVector< double >() << 31 << 32 << 33;
QVector< double > xx( {1, 2, 3} );
QVector< double > yy( {11, 12, 13} );
QVector< double > zz( {21, 22, 23} );
QVector< double > mm( {31, 32, 33} );
QgsLineString ls( xx, yy, zz, mm );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineStringZM );
Expand Down Expand Up @@ -286,10 +286,8 @@ void TestQgsLineString::constructorFromArrayZM()

void TestQgsLineString::constructorFromArray()
{
QVector< double > xx;
xx << 1 << 2 << 3;
QVector< double > yy;
yy << 11 << 12 << 13;
QVector< double > xx( {1, 2, 3} );
QVector< double > yy( {11, 12, 13} );
QgsLineString ls( xx, yy );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineString );
Expand All @@ -308,8 +306,8 @@ void TestQgsLineString::constructorFromArray()
QCOMPARE( *( ls.yData() + 2 ), 13.0 );

// unbalanced
xx = QVector< double >() << 1 << 2;
yy = QVector< double >() << 11 << 12 << 13;
xx = QVector< double >( {1, 2} );
yy = QVector< double >( {11, 12, 13} );
ls = QgsLineString( xx, yy );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineString );
Expand All @@ -319,8 +317,8 @@ void TestQgsLineString::constructorFromArray()
QCOMPARE( ls.xAt( 1 ), 2.0 );
QCOMPARE( ls.yAt( 1 ), 12.0 );

xx = QVector< double >() << 1 << 2 << 3;
yy = QVector< double >() << 11 << 12;
xx = QVector< double >( {1, 2, 3} );
yy = QVector< double >( {11, 12} );
ls = QgsLineString( xx, yy );

QCOMPARE( ls.wkbType(), QgsWkbTypes::LineString );
Expand Down Expand Up @@ -2842,7 +2840,7 @@ void TestQgsLineString::visitPoints()
QVector< double > yy;
QVector< double > zz;
QVector< double > mm;
QVector<double> pX, pY, pZ, pM, nX, nY, nZ, nM;
QVector< double > pX, pY, pZ, pM, nX, nY, nZ, nM;

auto visitor = [ & ]( double x, double y, double z, double m, double ppx, double ppy, double ppz, double ppm, double nnx, double nny, double nnz, double nnm )->bool
{
Expand Down Expand Up @@ -3004,9 +3002,7 @@ void TestQgsLineString::setPointsFromData()
QCOMPARE( *( l8.yData() + 2 ), 4.0 );

//setPoints with empty list, should clear linestring
double x2 [] = {};
double y2 [] = {};
l8.setPoints( 0, x2, y2 );
l8.setPoints( 0, nullptr, nullptr );
QVERIFY( l8.isEmpty() );
QCOMPARE( l8.numPoints(), 0 );
QCOMPARE( l8.vertexCount(), 0 );
Expand Down