-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
86 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# -*- coding: utf-8 -*- | ||
"""QGIS Unit tests for QgsDefaultValue. | ||
.. note:: This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
""" | ||
|
||
__author__ = 'Matthias Kuhn' | ||
__date__ = '26.9.2017' | ||
__copyright__ = 'Copyright 2017, The QGIS Project' | ||
# This will get replaced with a git SHA1 when you do a git archive | ||
__revision__ = '$Format:%H$' | ||
|
||
import qgis # NOQA | ||
|
||
|
||
from qgis.core import (QgsDefaultValue) | ||
from qgis.testing import unittest | ||
|
||
|
||
class TestQgsRasterColorRampShader(unittest.TestCase): | ||
|
||
def testValid(self): | ||
self.assertFalse(QgsDefaultValue()) | ||
self.assertTrue(QgsDefaultValue('test')) | ||
self.assertTrue(QgsDefaultValue('abc', True)) | ||
self.assertTrue(QgsDefaultValue('abc', False)) | ||
|
||
def setGetExpression(self): | ||
value = QgsDefaultValue('abc', False) | ||
self.assertEqual(value.expression(), 'abc') | ||
value.setExpression('def') | ||
self.assertEqual(value.expression(), 'def') | ||
|
||
def setGetApplyOnUpdate(self): | ||
value = QgsDefaultValue('abc', False) | ||
self.assertEqual(value.applyOnUpdate(), False) | ||
value.setApplyOnUpdate(True) | ||
self.assertEqual(value.applyOnUpdate(), True) | ||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters