A rather rudimentary test with basic checks for the style setting

This commit is contained in:
Lee Miller 2024-05-04 00:07:29 +03:00
parent 0ccbf6832f
commit d46af0835a
Signed by untrusted user: lee.miller
GPG Key ID: 4F97A5EA88F4AB63

View File

@ -1,3 +1,4 @@
"""Tests for PyBitmessage settings"""
import threading import threading
import time import time
@ -14,8 +15,7 @@ class TestSettings(TestBase):
def test_udp(self): def test_udp(self):
"""Test the effect of checkBoxUDP""" """Test the effect of checkBoxUDP"""
udp_setting = config.safeGetBoolean( udp_setting = config.safeGetBoolean('bitmessagesettings', 'udp')
'bitmessagesettings', 'udp')
self.assertEqual(udp_setting, self.dialog.checkBoxUDP.isChecked()) self.assertEqual(udp_setting, self.dialog.checkBoxUDP.isChecked())
self.dialog.checkBoxUDP.setChecked(not udp_setting) self.dialog.checkBoxUDP.setChecked(not udp_setting)
self.dialog.accept() self.dialog.accept()
@ -32,3 +32,22 @@ class TestSettings(TestBase):
else: else:
if not udp_setting: if not udp_setting:
self.fail('No Announcer thread found while udp set to True') self.fail('No Announcer thread found while udp set to True')
def test_styling(self):
"""Test custom windows style and font"""
style_setting = config.safeGet('bitmessagesettings', 'windowstyle')
font_setting = config.safeGet('bitmessagesettings', 'font')
self.assertIs(style_setting, None)
self.assertIs(font_setting, None)
style_control = self.dialog.comboBoxStyle
self.assertEqual(style_control.currentText(), 'GTK+')
style_count = style_control.count()
self.assertGreater(style_count, 1)
for i in range(style_count):
if i != style_control.currentIndex():
style_control.setCurrentIndex(i)
break
self.dialog.accept()
self.assertEqual(
config.safeGet('bitmessagesettings', 'windowstyle'),
style_control.currentText())