Skip to content
Permalink
Browse files

Unit tests for QgsLineString::(x/y)Data()

  • Loading branch information
nyalldawson committed May 25, 2018
1 parent 29d5105 commit c10f6de437eabaf8a2ac1ae9c601339e1e81ec33
Showing with 13 additions and 0 deletions.
  1. +13 −0 tests/src/core/testqgsgeometry.cpp
@@ -2645,6 +2645,13 @@ void TestQgsGeometry::lineString()
QCOMPARE( fromArray.yAt( 1 ), 12.0 );
QCOMPARE( fromArray.xAt( 2 ), 3.0 );
QCOMPARE( fromArray.yAt( 2 ), 13.0 );
QCOMPARE( *fromArray.xData(), 1.0 );
QCOMPARE( *( fromArray.xData() + 1 ), 2.0 );
QCOMPARE( *( fromArray.xData() + 2 ), 3.0 );
QCOMPARE( *fromArray.yData(), 11.0 );
QCOMPARE( *( fromArray.yData() + 1 ), 12.0 );
QCOMPARE( *( fromArray.yData() + 2 ), 13.0 );

// unbalanced
xx = QVector< double >() << 1 << 2;
yy = QVector< double >() << 11 << 12 << 13;
@@ -2964,6 +2971,12 @@ void TestQgsGeometry::lineString()
QgsPointSequence pts;
l8.points( pts );
QCOMPARE( pts, QgsPointSequence() << QgsPoint( 1, 2 ) << QgsPoint( 2, 3 ) << QgsPoint( 3, 4 ) );
QCOMPARE( *l8.xData(), 1.0 );
QCOMPARE( *( l8.xData() + 1 ), 2.0 );
QCOMPARE( *( l8.xData() + 2 ), 3.0 );
QCOMPARE( *l8.yData(), 2.0 );
QCOMPARE( *( l8.yData() + 1 ), 3.0 );
QCOMPARE( *( l8.yData() + 2 ), 4.0 );

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

0 comments on commit c10f6de

Please sign in to comment.
You can’t perform that action at this time.