1 2from PyObjCTools.TestSupport import * 3from Quartz.PDFKit import * 4 5class TestPDFDocument (TestCase): 6 def testConstants(self): 7 self.assertEqual(kPDFPrintPageScaleNone, 0) 8 self.assertEqual(kPDFPrintPageScaleToFit, 1) 9 self.assertEqual(kPDFPrintPageScaleDownToFit, 2) 10 11 self.assertIsInstance(PDFDocumentDidUnlockNotification, unicode) 12 self.assertIsInstance(PDFDocumentDidBeginFindNotification, unicode) 13 self.assertIsInstance(PDFDocumentDidEndFindNotification, unicode) 14 self.assertIsInstance(PDFDocumentDidBeginPageFindNotification, unicode) 15 self.assertIsInstance(PDFDocumentDidEndPageFindNotification, unicode) 16 self.assertIsInstance(PDFDocumentDidFindMatchNotification, unicode) 17 self.assertIsInstance(PDFDocumentDidBeginWriteNotification, unicode) 18 self.assertIsInstance(PDFDocumentDidEndWriteNotification, unicode) 19 self.assertIsInstance(PDFDocumentDidBeginPageWriteNotification, unicode) 20 self.assertIsInstance(PDFDocumentDidEndPageWriteNotification, unicode) 21 self.assertIsInstance(PDFDocumentTitleAttribute, unicode) 22 self.assertIsInstance(PDFDocumentAuthorAttribute, unicode) 23 self.assertIsInstance(PDFDocumentSubjectAttribute, unicode) 24 self.assertIsInstance(PDFDocumentCreatorAttribute, unicode) 25 self.assertIsInstance(PDFDocumentProducerAttribute, unicode) 26 self.assertIsInstance(PDFDocumentCreationDateAttribute, unicode) 27 self.assertIsInstance(PDFDocumentModificationDateAttribute, unicode) 28 self.assertIsInstance(PDFDocumentKeywordsAttribute, unicode) 29 30 def testMethods(self): 31 self.assertResultIsBOOL(PDFDocument.isEncrypted) 32 self.assertResultIsBOOL(PDFDocument.isLocked) 33 self.assertResultIsBOOL(PDFDocument.unlockWithPassword_) 34 self.assertResultIsBOOL(PDFDocument.allowsPrinting) 35 self.assertResultIsBOOL(PDFDocument.allowsCopying) 36 self.assertResultIsBOOL(PDFDocument.writeToFile_) 37 self.assertResultIsBOOL(PDFDocument.writeToFile_withOptions_) 38 self.assertResultIsBOOL(PDFDocument.writeToURL_) 39 self.assertResultIsBOOL(PDFDocument.writeToURL_withOptions_) 40 self.assertResultIsBOOL(PDFDocument.isFinding) 41 42 def testProtocols(self): 43 self.assertIsInstance(protocols.PDFDocumentNotifications, objc.informal_protocol) 44 self.assertIsInstance(protocols.PDFDocumentDelegate, objc.informal_protocol) 45 46 47if __name__ == "__main__": 48 main() 49