fix aspect ratio shown for 720x480
authorRalf Jung <post@ralfj.de>
Wed, 23 Mar 2016 08:48:03 +0000 (09:48 +0100)
committerRalf Jung <post@ralfj.de>
Wed, 23 Mar 2016 08:48:03 +0000 (09:48 +0100)
screen.py
tests.py

index a95d45dc8d19cd4f8a39715baa2332e323899786..160efecaa6d95b2915657ad0d81b6abb646701a2 100644 (file)
--- 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'
index 5a488573a8ebe29c8d2d08606a6b4a35bebf5b4c..9f3fb46a15bf18e4265b061a8eaaca5625d1227a 100755 (executable)
--- 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()