Source

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

from PyObjCTools.TestSupport import *
from WebKit import *

class TestWebEditingDelegateHelper (NSObject):
    def webView_shouldBeginEditingInDOMRange_(self, a, b): return 1
    def webView_shouldEndEditingInDOMRange_(self, a, b): return 1
    def webView_shouldInsertNode_replacingDOMRange_givenAction_(self, a, b, c, d): return 1
    def webView_shouldInsertText_replacingDOMRange_givenAction_(self, a, b, c, d): return 1
    def webView_shouldDeleteDOMRange_(self, a, b): return 1
    def webView_shouldChangeSelectedDOMRange_toDOMRange_affinity_stillSelecting_(self, a, b, c, d, e): return 1
    def webView_shouldApplyStyle_toElementsInDOMRange_(self, a, b, c): return 1
    def webView_shouldChangeTypingStyle_toStyle_(self, a, b, c): return 1
    def webView_doCommandBySelector_(self, a, b): return 1

class TestWebEditingDelegate (TestCase):
    def testConstants(self):
        self.assertEqual(WebViewInsertActionTyped, 0)
        self.assertEqual(WebViewInsertActionPasted, 1)
        self.assertEqual(WebViewInsertActionDropped, 2)

    def testMethods(self):
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldBeginEditingInDOMRange_)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldEndEditingInDOMRange_)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldInsertNode_replacingDOMRange_givenAction_)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldInsertText_replacingDOMRange_givenAction_)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldDeleteDOMRange_)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldChangeSelectedDOMRange_toDOMRange_affinity_stillSelecting_)
        self.assertArgIsBOOL(TestWebEditingDelegateHelper.webView_shouldChangeSelectedDOMRange_toDOMRange_affinity_stillSelecting_, 4)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldApplyStyle_toElementsInDOMRange_)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_shouldChangeTypingStyle_toStyle_)
        self.assertResultIsBOOL(TestWebEditingDelegateHelper.webView_doCommandBySelector_)

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.