|
29 | 29 | _upgradeConfigFrom_8_to_9_showMessages, |
30 | 30 | _upgradeConfigFrom_8_to_9_tetherTo, |
31 | 31 | upgradeConfigFrom_9_to_10, |
| 32 | + upgradeConfigFrom_11_to_12, |
32 | 33 | ) |
33 | 34 | from config.configFlags import ( |
34 | 35 | NVDAKey, |
35 | 36 | ShowMessages, |
36 | 37 | ReportLineIndentation, |
37 | 38 | ReportCellBorders, |
38 | 39 | TetherTo, |
| 40 | + OutputMode, |
39 | 41 | ) |
40 | 42 | from utils.displayString import ( |
41 | 43 | DisplayStringEnum |
@@ -782,6 +784,46 @@ def test_ManualProfile_setNumpadInsertFalseExtendedInsertFalse(self): |
782 | 784 | NVDAKey.CAPS_LOCK.value, |
783 | 785 | ) |
784 | 786 |
|
| 787 | +class Config_upgradeProfileSteps_upgradeProfileFrom_11_to_12(unittest.TestCase): |
| 788 | + def test_DefaultProfile_Unmodified(self): |
| 789 | + """reportFontAttributes unmodified.""" |
| 790 | + configString = "[documentFormatting]" |
| 791 | + profile = _loadProfile(configString) |
| 792 | + upgradeConfigFrom_11_to_12(profile) |
| 793 | + with self.assertRaises(KeyError): |
| 794 | + profile['documentFormatting']['reportFontAttributes'] |
| 795 | + |
| 796 | + def test_defaultProfile_reportFontAttributes_false(self): |
| 797 | + """reportFontAttributes unmodified set to False.""" |
| 798 | + configString = """ |
| 799 | + [documentFormatting] |
| 800 | + reportFontAttributes = False |
| 801 | + """ |
| 802 | + profile = _loadProfile(configString) |
| 803 | + upgradeConfigFrom_11_to_12(profile) |
| 804 | + self.assertEqual(profile['documentFormatting']['reportFontAttributes'], OutputMode.OFF.value) |
| 805 | + |
| 806 | + def test_defaultProfile_reportFontAttributes_true(self): |
| 807 | + """reportFontAttributes set to True.""" |
| 808 | + configString = """ |
| 809 | + [documentFormatting] |
| 810 | + reportFontAttributes = True |
| 811 | + """ |
| 812 | + profile = _loadProfile(configString) |
| 813 | + upgradeConfigFrom_11_to_12(profile) |
| 814 | + self.assertEqual(profile['documentFormatting']['reportFontAttributes'], OutputMode.SPEECH_AND_BRAILLE.value) |
| 815 | + |
| 816 | + def test_defaultProfile_reportFontAttributes_invalid(self): |
| 817 | + """reportFontAttributes set to a non-boolean value.""" |
| 818 | + configString = """ |
| 819 | + [documentFormatting] |
| 820 | + reportFontAttributes = notABool |
| 821 | + """ |
| 822 | + profile = _loadProfile(configString) |
| 823 | + upgradeConfigFrom_11_to_12(profile) |
| 824 | + with self.assertRaises(KeyError): |
| 825 | + profile['documentFormatting']['reportFontAttributes'] |
| 826 | + |
785 | 827 |
|
786 | 828 | class Config_AggregatedSection_getitem(unittest.TestCase): |
787 | 829 | def setUp(self): |
|
0 commit comments