Source

pyobjc / pyobjc-framework-WebKit / PyObjCTest / test_webpreferences.py

from PyObjCTools.TestSupport import *
from WebKit import *

try:
    unicode
except NameError:
    unicode = str

class TestWebPreferences (TestCase):
    def testConstants(self):
        self.assertEqual(WebCacheModelDocumentViewer, 0)
        self.assertEqual(WebCacheModelDocumentBrowser, 1)
        self.assertEqual(WebCacheModelPrimaryWebBrowser, 2)

        self.assertIsInstance(WebPreferencesChangedNotification, unicode)

    def testMethods(self):
        self.assertResultIsBOOL(WebPreferences.userStyleSheetEnabled)
        self.assertArgIsBOOL(WebPreferences.setUserStyleSheetEnabled_, 0)

        self.assertResultIsBOOL(WebPreferences.isJavaEnabled)
        self.assertArgIsBOOL(WebPreferences.setJavaEnabled_, 0)

        self.assertResultIsBOOL(WebPreferences.isJavaScriptEnabled)
        self.assertArgIsBOOL(WebPreferences.setJavaScriptEnabled_, 0)

        self.assertResultIsBOOL(WebPreferences.javaScriptCanOpenWindowsAutomatically)
        self.assertArgIsBOOL(WebPreferences.setJavaScriptCanOpenWindowsAutomatically_, 0)

        self.assertResultIsBOOL(WebPreferences.arePlugInsEnabled)
        self.assertArgIsBOOL(WebPreferences.setPlugInsEnabled_, 0)

        self.assertResultIsBOOL(WebPreferences.allowsAnimatedImages)
        self.assertArgIsBOOL(WebPreferences.setAllowsAnimatedImages_, 0)

        self.assertResultIsBOOL(WebPreferences.allowsAnimatedImageLooping)
        self.assertArgIsBOOL(WebPreferences.setAllowsAnimatedImageLooping_, 0)

        self.assertResultIsBOOL(WebPreferences.loadsImagesAutomatically)
        self.assertArgIsBOOL(WebPreferences.setLoadsImagesAutomatically_, 0)

        self.assertResultIsBOOL(WebPreferences.autosaves)
        self.assertArgIsBOOL(WebPreferences.setAutosaves_, 0)

        self.assertResultIsBOOL(WebPreferences.shouldPrintBackgrounds)
        self.assertArgIsBOOL(WebPreferences.setShouldPrintBackgrounds_, 0)

        self.assertResultIsBOOL(WebPreferences.privateBrowsingEnabled)
        self.assertArgIsBOOL(WebPreferences.setPrivateBrowsingEnabled_, 0)

        self.assertResultIsBOOL(WebPreferences.tabsToLinks)
        self.assertArgIsBOOL(WebPreferences.setTabsToLinks_, 0)

        self.assertResultIsBOOL(WebPreferences.usesPageCache)
        self.assertArgIsBOOL(WebPreferences.setUsesPageCache_, 0)


if __name__ == "__main__":
    main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.