From: Ralf Jung Date: Wed, 23 Mar 2016 08:48:03 +0000 (+0100) Subject: fix aspect ratio shown for 720x480 X-Git-Url: https://git.ralfj.de/lilass.git/commitdiff_plain/9dcdd8e65683504437a6a2f93e20edbdfd50c9c0 fix aspect ratio shown for 720x480 --- diff --git a/screen.py b/screen.py index a95d45d..160efec 100644 --- a/screen.py +++ b/screen.py @@ -87,7 +87,9 @@ class Resolution: def __str__(self): # get ratio ratio = int(round(16.0*self.height/self.width)) - if ratio == 12: # 16:12 = 4:3 + if ratio == 11: # 16:10.66 = 3:2 + strRatio = "3:2" + elif ratio == 12: # 16:12 = 4:3 strRatio = '4:3' elif ratio == 13: # 16:12.8 = 5:4 strRatio = '5:4' diff --git a/tests.py b/tests.py index 5a48857..9f3fb46 100755 --- a/tests.py +++ b/tests.py @@ -11,6 +11,7 @@ class TestResolutions(unittest.TestCase): self.assertEqual(str(screen.Resolution(1366, 768)), '1366x768 (16:9)') self.assertEqual(str(screen.Resolution(1920, 1080)), '1920x1080 (16:9)') self.assertEqual(str(screen.Resolution(1920, 1200)), '1920x1200 (16:10)') + self.assertEqual(str(screen.Resolution(720, 480)), '720x480 (3:2)') if __name__ == '__main__': unittest.main()