-
-
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.
Add a new dialog for selecting file encoding, QgsEncodingSelectionDialog
Can be used to prompt users for a file encoding choice
- Loading branch information
1 parent
e05cca2
commit f660d78
Showing
5 changed files
with
181 additions
and
0 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
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,38 @@ | ||
# -*- coding: utf-8 -*- | ||
"""QGIS Unit tests for QgsEncodingSelectionDialog | ||
.. 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__ = 'Nyall Dawson' | ||
__date__ = '21/11/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.gui import QgsEncodingSelectionDialog | ||
|
||
from qgis.testing import start_app, unittest | ||
|
||
start_app() | ||
|
||
|
||
class TestQgsEncodingSelectionDialog(unittest.TestCase): | ||
|
||
def testGettersSetters(self): | ||
""" test dialog getters/setters """ | ||
dlg = qgis.gui.QgsEncodingSelectionDialog(encoding='UTF-16') | ||
self.assertEqual(dlg.encoding(), 'UTF-16') | ||
dlg.setEncoding('UTF-8') | ||
self.assertEqual(dlg.encoding(), 'UTF-8') | ||
# custom encoding option | ||
dlg.setEncoding('trisolarian') | ||
self.assertEqual(dlg.encoding(), 'trisolarian') | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |