From 9dcdd8e65683504437a6a2f93e20edbdfd50c9c0 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 23 Mar 2016 09:48:03 +0100 Subject: [PATCH] fix aspect ratio shown for 720x480 --- screen.py | 4 +++- tests.py | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) 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() -- 2.30.2