Fix some failing tests

This commit is contained in:
Nyall Dawson 2017-01-20 17:23:17 +10:00
parent f1b2940623
commit 17d4d3a8a4
5 changed files with 8 additions and 4 deletions

View File

@ -222,17 +222,16 @@ void QgsPropertyCollection::rescan() const
QHash<int, QgsProperty>::const_iterator it = mProperties.constBegin(); QHash<int, QgsProperty>::const_iterator it = mProperties.constBegin();
for ( ; it != mProperties.constEnd(); ++it ) for ( ; it != mProperties.constEnd(); ++it )
{ {
if ( it.value() )
mCount++;
if ( it.value().isActive() ) if ( it.value().isActive() )
{ {
mHasActiveProperties = true; mHasActiveProperties = true;
if ( it.value().propertyType() != QgsProperty::StaticProperty ) if ( it.value().propertyType() != QgsProperty::StaticProperty )
{ {
mHasDynamicProperties = true; mHasDynamicProperties = true;
break;
} }
} }
if ( it.value() )
mCount++;
} }
} }
mDirty = false; mDirty = false;

View File

@ -2818,6 +2818,7 @@ QgsLinePatternFillSymbolLayer* QgsLinePatternFillSymbolLayer::clone() const
clonedLayer->setSubSymbol( mFillLineSymbol->clone() ); clonedLayer->setSubSymbol( mFillLineSymbol->clone() );
} }
copyPaintEffect( clonedLayer ); copyPaintEffect( clonedLayer );
copyDataDefinedProperties( clonedLayer );
return clonedLayer; return clonedLayer;
} }
@ -3227,6 +3228,7 @@ QgsPointPatternFillSymbolLayer* QgsPointPatternFillSymbolLayer::clone() const
{ {
clonedLayer->setSubSymbol( mMarkerSymbol->clone() ); clonedLayer->setSubSymbol( mMarkerSymbol->clone() );
} }
copyDataDefinedProperties( clonedLayer );
copyPaintEffect( clonedLayer ); copyPaintEffect( clonedLayer );
return clonedLayer; return clonedLayer;
} }

View File

@ -1596,6 +1596,7 @@ QgsFilledMarkerSymbolLayer *QgsFilledMarkerSymbolLayer::clone() const
{ {
QgsFilledMarkerSymbolLayer* m = static_cast< QgsFilledMarkerSymbolLayer* >( QgsFilledMarkerSymbolLayer::create( properties() ) ); QgsFilledMarkerSymbolLayer* m = static_cast< QgsFilledMarkerSymbolLayer* >( QgsFilledMarkerSymbolLayer::create( properties() ) );
copyPaintEffect( m ); copyPaintEffect( m );
copyDataDefinedProperties( m );
m->setSubSymbol( mFill->clone() ); m->setSubSymbol( mFill->clone() );
return m; return m;
} }

View File

@ -210,6 +210,7 @@ void TestQgsComposerScaleBar::dataDefined()
QCOMPARE( mComposerScaleBar->pen().color().name(), QColor( 255, 255, 0 ).name() ); QCOMPARE( mComposerScaleBar->pen().color().name(), QColor( 255, 255, 0 ).name() );
QCOMPARE( mComposerScaleBar->pen().widthF(), 1.2 ); QCOMPARE( mComposerScaleBar->pen().widthF(), 1.2 );
mComposerScaleBar->setDataDefinedProperties( QgsPropertyCollection() ); mComposerScaleBar->setDataDefinedProperties( QgsPropertyCollection() );
mComposerScaleBar->setLineWidth( 1.0 );
} }
QGSTEST_MAIN( TestQgsComposerScaleBar ) QGSTEST_MAIN( TestQgsComposerScaleBar )

View File

@ -890,6 +890,7 @@ void TestQgsProperty::propertyCollection()
collection.setProperty( Property2, QgsProperty::fromValue( "v2", false ) ); collection.setProperty( Property2, QgsProperty::fromValue( "v2", false ) );
collection.setProperty( Property3, QgsProperty::fromField( "field1", true ) ); collection.setProperty( Property3, QgsProperty::fromField( "field1", true ) );
collection.setProperty( Property4, QgsProperty::fromExpression( "\"field1\" + \"field2\"", true ) ); collection.setProperty( Property4, QgsProperty::fromExpression( "\"field1\" + \"field2\"", true ) );
QCOMPARE( collection.count(), 4 );
// test referenced fields // test referenced fields
QCOMPARE( collection.referencedFields( context ).count(), 2 ); QCOMPARE( collection.referencedFields( context ).count(), 2 );
@ -1041,7 +1042,7 @@ void TestQgsProperty::collectionStack()
//now add a property to the collection //now add a property to the collection
QgsProperty property = QgsProperty::fromValue( "value", true ); QgsProperty property = QgsProperty::fromValue( "value", true );
collection->setProperty( Property1, property ); stack.at( 0 )->setProperty( Property1, property );
QVERIFY( stack.isActive( Property1 ) ); QVERIFY( stack.isActive( Property1 ) );
QCOMPARE( stack.property( Property1 ).value( context ), property.value( context ) ); QCOMPARE( stack.property( Property1 ).value( context ), property.value( context ) );
QCOMPARE( stack.value( Property1, context ), property.value( context ) ); QCOMPARE( stack.value( Property1, context ), property.value( context ) );