From: Mark H. <mha...@us...> - 2007-02-07 23:12:34
|
Update of /cvsroot/pywin32/pywin32/com/win32com/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12983/win32com/test Modified Files: testPyComTest.py Log Message: Fix issue [ 1651025 ] Use the specified type for constant values This makes constants in a typelib > sys.maxint to correctly be a long Index: testPyComTest.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/com/win32com/test/testPyComTest.py,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** testPyComTest.py 26 Aug 2006 08:23:37 -0000 1.25 --- testPyComTest.py 7 Feb 2007 23:12:31 -0000 1.26 *************** *** 50,53 **** --- 50,61 ---- raise error, "%s failed - result not %r but %r" % (pref, result, rc) + def TestConstant(constName, pyConst): + try: + comConst = getattr(constants, constName) + except: + raise error, "Constant %s missing" % (constName,) + if comConst != pyConst: + raise error, "Constant value wrong for %s - got %d, wanted %d" % (constName, comConst, pyConst) + # Simple handler class. This demo only fires one event. class RandomEventHandler: *************** *** 234,237 **** --- 242,258 ---- TestApplyResult(o.Test5, (constants.Attr2,), constants.Attr2) + TestApplyResult(o.Test6, (constants.WideAttr1,), constants.WideAttr1) + TestApplyResult(o.Test6, (constants.WideAttr2,), constants.WideAttr2) + TestApplyResult(o.Test6, (constants.WideAttr3,), constants.WideAttr3) + TestApplyResult(o.Test6, (constants.WideAttr4,), constants.WideAttr4) + TestApplyResult(o.Test6, (constants.WideAttr5,), constants.WideAttr5) + + TestConstant("ULongTest1", 0xFFFFFFFFL) + TestConstant("ULongTest2", 0x7FFFFFFFL) + TestConstant("LongTest1", -0x7FFFFFFFL) + TestConstant("LongTest2", 0x7FFFFFFFL) + TestConstant("UCharTest", 255) + TestConstant("CharTest", -1) + now = pythoncom.MakeTime(time.gmtime(time.time())) later = pythoncom.MakeTime(time.gmtime(time.time()+1)) |