Skip to content

Commit c10f6de

Browse files
committedMay 26, 2018
Unit tests for QgsLineString::(x/y)Data()
1 parent 29d5105 commit c10f6de

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed
 

‎tests/src/core/testqgsgeometry.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2645,6 +2645,13 @@ void TestQgsGeometry::lineString()
26452645
QCOMPARE( fromArray.yAt( 1 ), 12.0 );
26462646
QCOMPARE( fromArray.xAt( 2 ), 3.0 );
26472647
QCOMPARE( fromArray.yAt( 2 ), 13.0 );
2648+
QCOMPARE( *fromArray.xData(), 1.0 );
2649+
QCOMPARE( *( fromArray.xData() + 1 ), 2.0 );
2650+
QCOMPARE( *( fromArray.xData() + 2 ), 3.0 );
2651+
QCOMPARE( *fromArray.yData(), 11.0 );
2652+
QCOMPARE( *( fromArray.yData() + 1 ), 12.0 );
2653+
QCOMPARE( *( fromArray.yData() + 2 ), 13.0 );
2654+
26482655
// unbalanced
26492656
xx = QVector< double >() << 1 << 2;
26502657
yy = QVector< double >() << 11 << 12 << 13;
@@ -2964,6 +2971,12 @@ void TestQgsGeometry::lineString()
29642971
QgsPointSequence pts;
29652972
l8.points( pts );
29662973
QCOMPARE( pts, QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 2, 3 ) << QgsPoint( 3, 4 ) );
2974+
QCOMPARE( *l8.xData(), 1.0 );
2975+
QCOMPARE( *( l8.xData() + 1 ), 2.0 );
2976+
QCOMPARE( *( l8.xData() + 2 ), 3.0 );
2977+
QCOMPARE( *l8.yData(), 2.0 );
2978+
QCOMPARE( *( l8.yData() + 1 ), 3.0 );
2979+
QCOMPARE( *( l8.yData() + 2 ), 4.0 );
29672980

29682981
//setPoints with empty list, should clear linestring
29692982
l8.setPoints( QgsPointSequence() );

0 commit comments

Comments
 (0)
Please sign in to comment.