import unittest
import fractions
import setoverscan

try:
    reload(setoverscan)
except:
    import importlib
    importlib.reload(setoverscan)


try:
    import pymel.core
except:
    pymel = None


class SetOverscanFuncTests(unittest.TestCase):
    def test__setoverscan(self):
        old_res_x = 1920
        old_res_y = 1080
        osc_left = 10

        pymel.core.newFile(force=True)

        rendersettings = pymel.core.PyNode('defaultResolution')
        rendersettings.setAttr('width', old_res_x)
        rendersettings.setAttr('height', old_res_y)

        imageaspect = fractions.Fraction(old_res_x, old_res_y)

        self.assertIsNone(setoverscan.main())
        self.assertEqual(rendersettings.getAttr('width'), 1920)
        self.assertEqual(rendersettings.getAttr('height'), 1080)



def main():
    unittest.main(module=__name__, exit=False)


if __name__ == '__main__':
    unittest.main(module=__name__, exit=False)

@@ -13,24 +13,38 @@
 est%0A
+from fractions 
 import 
-f
+F
 raction
-s
 %0Aimp
@@ -300,23 +300,86 @@
     
-old_
+res_x = 1000%0A        res_y = 500%0A        osc_left = 50%0A        
 res_x
+_new
  = 1
-9
 2
+0
 0%0A  
@@ -388,23 +388,22 @@
     
-old_
 res_y
- = 108
+_new = 60
 0%0A  
@@ -412,21 +412,387 @@
     
-osc_left = 10
+image_ratio = Fraction(res_x, res_y)%0A        # res_x_new = res_x+(osc_left*2)%0A        # res_y_new = float(res_x_new / image_ratio)%0A%0A        print('image_ratio: ', float(image_ratio))%0A        print('overscan left / right: ', osc_left*2)%0A        print('res_x: ', res_x)%0A        print('res_x_new: ', res_x_new)%0A        print('res_y: ', res_y)%0A        print('res_y_new: ', res_y_new)
 %0A%0A  
@@ -933,20 +933,16 @@
 width', 
-old_
 res_x)%0A 
@@ -985,76 +985,8 @@
 t', 
-old_res_y)%0A%0A        imageaspect = fractions.Fraction(old_res_x, old_
 res_
@@ -1032,16 +1032,31 @@
 an.main(
+pixels=osc_left
 ))%0A     
@@ -1112,12 +1112,17 @@
 '), 
-1920
+res_x_new
 )%0A  
@@ -1182,12 +1182,17 @@
 '), 
-1080
+res_y_new
 )%0A%0A%0A
@@ -1278,16 +1278,26 @@
 _main__'
+ and pymel
 :%0A    un

set overscan tests update