test_nssplitview.py :  » Development » PyObjC » trunk » pyobjc » pyobjc-framework-Cocoa » PyObjCTest » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Development » PyObjC 
PyObjC » trunk » pyobjc » pyobjc framework Cocoa » PyObjCTest » test_nssplitview.py

from PyObjCTools.TestSupport import *
from AppKit import *

class TestNSSplitViewHelper (NSObject):
    def splitView_canCollapseSubview_(self, sp, sv): return 1
    def splitView_shouldCollapseSubview_forDoubleClickOnDividerAtIndex_(self, sp, sv, i): return 1
    def splitView_constrainMinCoordinate_ofSubviewAt_(self, sv, c, i): return 1
    def splitView_constrainMaxCoordinate_ofSubviewAt_(self, sv, c, i): return 1
    def splitView_constrainSplitPosition_ofSubviewAt_(self, sv, c, i): return 1
    def splitView_resizeSubviewsWithOldSize_(self, sv, sz): pass
    def splitView_shouldHideDividerAtIndex_(self, sv, i): return 1
    def splitView_effectiveRect_forDrawnRect_ofDividerAtIndex_(self, sv, er, dr, i): return 1
    def splitView_additionalEffectiveRectOfDividerAtIndex_(self, sv, i): return 1
    def splitViewWillResizeSubviews_(self, nt): pass
    def splitViewDidResizeSubviews_(self, nt): pass
    def splitView_shouldAdjustSizeOfSubview_(self, s, sv): return 1

class TestNSSplitView (TestCase):
    def testConstants(self):
        self.assertEqual(NSSplitViewDividerStyleThick, 1)
        self.assertEqual(NSSplitViewDividerStyleThin, 2)

        self.assertIsInstance(NSSplitViewWillResizeSubviewsNotification, unicode)
        self.assertIsInstance(NSSplitViewDidResizeSubviewsNotification, unicode)

    @min_os_level('10.6')
    def testConstants10_6(self):
        self.assertEqual(NSSplitViewDividerStylePaneSplitter, 3)


    def testMethods(self):
        self.assertResultIsBOOL(NSSplitView.isVertical)
        self.assertArgIsBOOL(NSSplitView.setVertical_, 0)
        self.assertResultIsBOOL(NSSplitView.isSubviewCollapsed_)
        self.assertResultIsBOOL(NSSplitView.isPaneSplitter)
        self.assertArgIsBOOL(NSSplitView.setIsPaneSplitter_, 0)

    def testProtocol(self):
        self.assertResultIsBOOL(TestNSSplitViewHelper.splitView_canCollapseSubview_)
        self.assertResultIsBOOL(TestNSSplitViewHelper.splitView_shouldCollapseSubview_forDoubleClickOnDividerAtIndex_)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_shouldCollapseSubview_forDoubleClickOnDividerAtIndex_, 2, objc._C_NSInteger)
        self.assertResultHasType(TestNSSplitViewHelper.splitView_constrainMinCoordinate_ofSubviewAt_, objc._C_CGFloat)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_constrainMinCoordinate_ofSubviewAt_, 1, objc._C_CGFloat)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_constrainMinCoordinate_ofSubviewAt_, 2, objc._C_NSInteger)
        self.assertResultHasType(TestNSSplitViewHelper.splitView_constrainMaxCoordinate_ofSubviewAt_, objc._C_CGFloat)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_constrainMaxCoordinate_ofSubviewAt_, 1, objc._C_CGFloat)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_constrainMaxCoordinate_ofSubviewAt_, 2, objc._C_NSInteger)
        self.assertResultHasType(TestNSSplitViewHelper.splitView_constrainSplitPosition_ofSubviewAt_, objc._C_CGFloat)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_constrainSplitPosition_ofSubviewAt_, 1, objc._C_CGFloat)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_constrainSplitPosition_ofSubviewAt_, 2, objc._C_NSInteger)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_resizeSubviewsWithOldSize_, 1, NSSize.__typestr__)

    @min_os_level('10.5')
    def testProtocol10_5(self):
        self.assertResultIsBOOL(TestNSSplitViewHelper.splitView_shouldHideDividerAtIndex_)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_shouldHideDividerAtIndex_, 1, objc._C_NSInteger)

        self.assertResultHasType(TestNSSplitViewHelper.splitView_effectiveRect_forDrawnRect_ofDividerAtIndex_, NSRect.__typestr__)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_effectiveRect_forDrawnRect_ofDividerAtIndex_, 1, NSRect.__typestr__)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_effectiveRect_forDrawnRect_ofDividerAtIndex_, 2, NSRect.__typestr__)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_effectiveRect_forDrawnRect_ofDividerAtIndex_, 3, objc._C_NSInteger)

        self.assertResultHasType(TestNSSplitViewHelper.splitView_additionalEffectiveRectOfDividerAtIndex_, NSRect.__typestr__)
        self.assertArgHasType(TestNSSplitViewHelper.splitView_additionalEffectiveRectOfDividerAtIndex_, 1, objc._C_NSInteger)

    @min_os_level('10.6')
    def testProtocol10_6(self):
        self.assertResultIsBOOL(TestNSSplitViewHelper.splitView_shouldAdjustSizeOfSubview_)

if __name__ == "__main__":
    main()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.