Skip to content
Permalink
Browse files

Expand tests

  • Loading branch information
nyalldawson committed Mar 12, 2020
1 parent d66175a commit 46267fd43132f9938707c68bde7abef87c260c49
Showing with 17 additions and 0 deletions.
  1. +17 −0 tests/src/python/test_qgsprojecttimesettings.py
@@ -13,6 +13,7 @@
import qgis # NOQA

from qgis.core import (QgsProject,
QgsUnitTypes,
QgsProjectTimeSettings,
QgsReadWriteContext,
QgsDateTimeRange)
@@ -57,6 +58,16 @@ def testTemporalRange(self):
p.reset()
self.assertEqual(len(spy), 2)

def testGettersSetters(self):
p = QgsProjectTimeSettings()

p.setTimeStep(4.8)
self.assertEqual(p.timeStep(), 4.8)
p.setTimeStepUnit(QgsUnitTypes.TemporalDecades)
self.assertEqual(p.timeStepUnit(), QgsUnitTypes.TemporalDecades)
p.setFramesPerSecond(90)
self.assertEqual(p.framesPerSecond(), 90)

def testReadWrite(self):
p = QgsProjectTimeSettings()
self.assertTrue(p.temporalRange().isInfinite())
@@ -74,13 +85,19 @@ def testReadWrite(self):
QDateTime(QDate(2020, 12, 1), QTime(8, 0, 0))
)
p.setTemporalRange(r)
p.setTimeStep(4.8)
p.setTimeStepUnit(QgsUnitTypes.TemporalDecades)
p.setFramesPerSecond(90)
elem = p.writeXml(doc, QgsReadWriteContext())

p2 = QgsProjectTimeSettings()
spy = QSignalSpy(p2.temporalRangeChanged)
self.assertTrue(p2.readXml(elem, QgsReadWriteContext()))
self.assertEqual(p2.temporalRange(), r)
self.assertEqual(len(spy), 1)
self.assertEqual(p2.timeStep(), 4.8)
self.assertEqual(p2.timeStepUnit(), QgsUnitTypes.TemporalDecades)
self.assertEqual(p2.framesPerSecond(), 90)


if __name__ == '__main__':

0 comments on commit 46267fd

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