1
2from PyObjCTools.TestSupport import *
3from AppKit import *
4
5class TestNSSpellChecker (TestCase):
6    def testMethods(self):
7        self.assertResultIsBOOL(NSSpellChecker.sharedSpellCheckerExists)
8        self.assertArgIsBOOL(NSSpellChecker.checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount_, 3)
9        self.assertArgIsOut(NSSpellChecker.checkSpellingOfString_startingAt_language_wrap_inSpellDocumentWithTag_wordCount_, 5)
10        self.assertResultIsBOOL(NSSpellChecker.setLanguage_)
11
12        self.assertArgHasType(NSSpellChecker.completionsForPartialWordRange_inString_language_inSpellDocumentWithTag_, 0, NSRange.__typestr__)
13
14
15    @min_os_level('10.5')
16    def testMethods10_5(self):
17        self.assertArgIsBOOL(NSSpellChecker.checkGrammarOfString_startingAt_language_wrap_inSpellDocumentWithTag_details_, 3)
18        self.assertArgIsOut(NSSpellChecker.checkGrammarOfString_startingAt_language_wrap_inSpellDocumentWithTag_details_, 5)
19        self.assertResultIsBOOL(NSSpellChecker.hasLearnedWord_)
20
21    @min_os_level('10.6')
22    def testMethods10_6(self):
23        self.assertArgHasType(NSSpellChecker.checkString_range_types_options_inSpellDocumentWithTag_orthography_wordCount_,
24                1, NSRange.__typestr__)
25        self.assertArgIsOut(NSSpellChecker.checkString_range_types_options_inSpellDocumentWithTag_orthography_wordCount_, 5)
26        self.assertArgIsOut(NSSpellChecker.checkString_range_types_options_inSpellDocumentWithTag_orthography_wordCount_, 6)
27
28        self.assertArgHasType(NSSpellChecker.requestCheckingOfString_range_types_options_inSpellDocumentWithTag_completionHandler_,
29                1, NSRange.__typestr__)
30        self.assertArgIsBlock(NSSpellChecker.requestCheckingOfString_range_types_options_inSpellDocumentWithTag_completionHandler_,
31                5, b'v' + objc._C_NSInteger + b'@@' + objc._C_NSInteger)
32
33        self.assertArgHasType(NSSpellChecker.menuForResult_string_options_atLocation_inView_, 3, NSPoint.__typestr__)
34
35        self.assertArgHasType(NSSpellChecker.guessesForWordRange_inString_language_inSpellDocumentWithTag_, 0, NSRange.__typestr__)
36
37        self.assertResultIsBOOL(NSSpellChecker.automaticallyIdentifiesLanguages)
38        self.assertArgIsBOOL(NSSpellChecker.setAutomaticallyIdentifiesLanguages_, 0)
39
40
41    @min_os_level('10.6')
42    def testConstants10_6(self):
43        self.assertIsInstance(NSTextCheckingOrthographyKey, unicode)
44        self.assertIsInstance(NSTextCheckingQuotesKey, unicode)
45        self.assertIsInstance(NSTextCheckingReplacementsKey, unicode)
46        self.assertIsInstance(NSTextCheckingReferenceDateKey, unicode)
47        self.assertIsInstance(NSTextCheckingReferenceTimeZoneKey, unicode)
48        self.assertIsInstance(NSTextCheckingDocumentURLKey, unicode)
49        self.assertIsInstance(NSTextCheckingDocumentTitleKey, unicode)
50        self.assertIsInstance(NSTextCheckingDocumentAuthorKey, unicode)
51
52
53
54if __name__ == "__main__":
55    main()
56