Skip to content
Permalink
Browse files

Fix test failure

  • Loading branch information
nyalldawson committed Nov 6, 2017
1 parent dddce25 commit 584cbd0734497b6afcc368c79a0d75a5681e5b7d
@@ -61,7 +61,7 @@ void QgsLayoutItemPropertiesDialog::setItemPosition( QgsLayoutPoint position )
position = mLayout->convertFromLayoutUnits( mLayout->pageCollection()->positionOnPage( layoutPoint ), position.units() );

mPageSpin->setValue( page + 1 );
mPosUnitsComboBox->setUnit( position.units() );
whileBlocking( mPosUnitsComboBox )->setUnit( position.units() );
mXPosSpin->setValue( position.x() );
mYPosSpin->setValue( position.y() );
}
@@ -80,7 +80,7 @@ void QgsLayoutItemPropertiesDialog::setItemSize( QgsLayoutSize size )
{
mWidthSpin->setValue( size.width() );
mHeightSpin->setValue( size.height() );
mSizeUnitsComboBox->setUnit( size.units() );
whileBlocking( mSizeUnitsComboBox )->setUnit( size.units() );
}

QgsLayoutSize QgsLayoutItemPropertiesDialog::itemSize() const
@@ -14,7 +14,7 @@

import qgis # NOQA

from qgis.core import QgsUnitTypes, QgsLayoutSize, QgsLayoutPoint, QgsLayoutItem
from qgis.core import QgsUnitTypes, QgsLayoutSize, QgsLayoutPoint, QgsLayoutItem, QgsProject, QgsLayout
from qgis.gui import QgsLayoutItemPropertiesDialog

from qgis.testing import start_app, unittest
@@ -28,6 +28,10 @@ def testGettersSetters(self):
""" test dialog getters/setters """
dlg = qgis.gui.QgsLayoutItemPropertiesDialog()

l = QgsLayout(QgsProject.instance())
l.initializeDefaults()
dlg.setLayout(l)

dlg.setItemPosition(QgsLayoutPoint(5, 6, QgsUnitTypes.LayoutPixels))
self.assertEqual(dlg.itemPosition().x(), 5.0)
self.assertEqual(dlg.itemPosition().y(), 6.0)

0 comments on commit 584cbd0

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