Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix test failure
  • Loading branch information
nyalldawson committed Nov 24, 2017
1 parent dddce25 commit 584cbd0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/gui/layout/qgslayoutnewitempropertiesdialog.cpp
Expand Up @@ -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() );
}
Expand All @@ -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
Expand Down
6 changes: 5 additions & 1 deletion tests/src/python/test_qgslayoutitempropertiesdialog.py
Expand Up @@ -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
Expand All @@ -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)
Expand Down

0 comments on commit 584cbd0

Please sign in to comment.