Exemple #1
0
        stg = do.GetData(cf)
        got = stg.data
        # The data we get back has the \0, as our STGMEDIUM has no way of
        # knowing if it meant to be a string, or a binary buffer, so
        # it must return it too.
        self.failUnlessEqual(got, val + "\0")

    def testDataObjectFlush(self):
        do = TestDataObject("Hello from Python")
        do = WrapCOMObject(do, iid=pythoncom.IID_IDataObject)
        pythoncom.OleSetClipboard(do)
        self.assertEqual(num_do_objects, 1)

        do = None  # clear my ref!
        pythoncom.OleFlushClipboard()
        self.assertEqual(num_do_objects, 0)

    def testDataObjectReset(self):
        do = TestDataObject("Hello from Python")
        do = WrapCOMObject(do)
        pythoncom.OleSetClipboard(do)
        do = None  # clear my ref!
        self.assertEqual(num_do_objects, 1)
        pythoncom.OleSetClipboard(None)
        self.assertEqual(num_do_objects, 0)


if __name__ == '__main__':
    import util
    util.testmain()
Exemple #2
0
    if t.getn() != 3:
        raise error, "New value wrong"

def DoTestAll():
    o = win32com.client.Dispatch("PyCOMVBTest.Tester")
    TestVB(o,1)

    o = win32com.client.dynamic.DumbDispatch("PyCOMVBTest.Tester")
    TestVB(o,0)

def TestAll():
    if not __debug__:
        raise RuntimeError, "This must be run in debug mode - we use assert!"
    try:
        DoTestAll()
        print "All tests appear to have worked!"
    except:
        print "TestAll() failed!!"
        traceback.print_exc()

# Make this test run under our test suite to leak tests etc work
def suite():
    import unittest
    test = util.CapturingFunctionTestCase(TestAll, description="VB tests")
    suite = unittest.TestSuite()
    suite.addTest(test)
    return suite

if __name__=='__main__':
    util.testmain()