test_nsoutlineview.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_nsoutlineview.py

from PyObjCTools.TestSupport import *
from AppKit import *

class TestNSOutlineViewHelper (NSObject):
    def outlineView_sizeToFitWidthOfColumn_(self, v, c): return 1
    def outlineView_shouldReorderColumn_toColumn_(self, v, c1, c2): return 1
    def outlineView_shouldShowOutlineCellForItem_(self, v, i): return 1
    def outlineView_child_ofItem_(self, ov, nr, item): return 1
    def outlineView_isItemExpandable_(self, ov, item): return 1
    def outlineView_numberOfChildrenOfItem_(self, ov, item): return 1
    def outlineView_objectValueForTableColumn_byItem_(self, ov, tc, item): return 1
    def outlineView_setObjectValue_forTableColumn_byItem_(self, ov, value, tc, item): pass
    def outlineView_itemForPersistentObject_(self, ov, po): return 1
    def outlineView_persistentObjectForItem_(self, ov, item): return 1
    def outlineView_sortDescriptorsDidChange_(self, ov, old): pass
    def outlineView_writeItems_toPasteboard_(self, ov, items, pb): return 1
    def outlineView_validateDrop_proposedItem_proposedChildIndex_(self, ov, dr, item, idx): return 1
    def outlineView_acceptDrop_item_childIndex_(self, ov, dr, it, idx): return 1
    def outlineView_namesOfPromisedFilesDroppedAtDestination_forDraggedItems_(self, ov, dr, it): return 1

    def outlineView_willDisplayCell_forTableColumn_item_(self, ov, c, tc, i): pass
    def outlineView_shouldEditTableColumn_item_(self, ov, tc, i): return 1
    def selectionShouldChangeInOutlineView_(self, ov): return 1
    def outlineView_selectionIndexesForProposedSelection_(self, ov, idx): return 1
    def outlineView_shouldSelectItem_(self, ov, tc): return 1
    def outlineView_shouldSelectTableColumn_(self, ov, tc): return 1
    def outlineView_toolTipForCell_rect_tableColumn_item_mouseLocation_(self, ov, c, r, tc, it, ml): return 1
    def outlineView_heightOfRowByItem_(self, ov, item):  return 1
    def outlineView_typeSelectStringForTableColumn_item_(self, ov, tc, item): return 1
    def outlineView_nextTypeSelectMatchFromItem_toItem_forString_(self, ov, si, ei, ss): return 1
    def outlineView_shouldTypeSelectForEvent_withCurrentSearchString_(self, ov, ev, ss): return 1
    def outlineView_shouldShowCellExpansionForTableColumn_item_(self, ov, tc, it): return 1
    def outlineView_shouldTrackCell_forTableColumn_item_(self, ov, c, tc, it): return 1
    def outlineView_dataCellForTableColumn_item_(self, ov, tc, it): return 1
    def outlineView_isGroupItem_(self, ov, item): return 1
    def outlineView_shouldExpandItem_(self, ov, it): return 1
    def outlineView_shouldCollapseItem_(self, ov, it): return 1
    def outlineView_willDisplayOutlineCell_forTableColumn_item_(self, ov, c, tc, i): pass



class TestNSOutlineView (TestCase):
    def testConstants(self):
        self.assertEqual(NSOutlineViewDropOnItemIndex, -1)

        self.assertIsInstance(NSOutlineViewSelectionDidChangeNotification, unicode)
        self.assertIsInstance(NSOutlineViewColumnDidMoveNotification, unicode)
        self.assertIsInstance(NSOutlineViewColumnDidResizeNotification, unicode)
        self.assertIsInstance(NSOutlineViewSelectionIsChangingNotification, unicode)
        self.assertIsInstance(NSOutlineViewItemWillExpandNotification, unicode)
        self.assertIsInstance(NSOutlineViewItemDidExpandNotification, unicode)
        self.assertIsInstance(NSOutlineViewItemWillCollapseNotification, unicode)
        self.assertIsInstance(NSOutlineViewItemDidCollapseNotification, unicode)


    def testMethods(self):
        self.assertResultIsBOOL(NSOutlineView.isExpandable_)
        self.assertArgIsBOOL(NSOutlineView.expandItem_expandChildren_, 1)
        self.assertArgIsBOOL(NSOutlineView.collapseItem_collapseChildren_, 1)
        self.assertArgIsBOOL(NSOutlineView.reloadItem_reloadChildren_, 1)
        self.assertResultIsBOOL(NSOutlineView.isItemExpanded_)
        self.assertResultIsBOOL(NSOutlineView.indentationMarkerFollowsCell)
        self.assertArgIsBOOL(NSOutlineView.setIndentationMarkerFollowsCell_, 0)
        self.assertResultIsBOOL(NSOutlineView.autoresizesOutlineColumn)
        self.assertArgIsBOOL(NSOutlineView.setAutoresizesOutlineColumn_, 0)
        self.assertResultIsBOOL(NSOutlineView.shouldCollapseAutoExpandedItemsForDeposited_)
        self.assertArgIsBOOL(NSOutlineView.shouldCollapseAutoExpandedItemsForDeposited_, 0)
        self.assertResultIsBOOL(NSOutlineView.autosaveExpandedItems)
        self.assertArgIsBOOL(NSOutlineView.setAutosaveExpandedItems_, 0)

    def testProtocols(self):
        self.assertArgHasType(TestNSOutlineViewHelper.outlineView_child_ofItem_, 1, objc._C_NSInteger)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_isItemExpandable_)
        self.assertResultHasType(TestNSOutlineViewHelper.outlineView_numberOfChildrenOfItem_, objc._C_NSInteger)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_writeItems_toPasteboard_)
        self.assertResultHasType(TestNSOutlineViewHelper.outlineView_validateDrop_proposedItem_proposedChildIndex_, objc._C_NSUInteger)
        self.assertArgHasType(TestNSOutlineViewHelper.outlineView_validateDrop_proposedItem_proposedChildIndex_, 3, objc._C_NSInteger)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldEditTableColumn_item_)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.selectionShouldChangeInOutlineView_)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldSelectItem_)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldSelectTableColumn_)
        self.assertArgHasType(TestNSOutlineViewHelper.outlineView_toolTipForCell_rect_tableColumn_item_mouseLocation_, 2, b'N^' + NSRect.__typestr__)
        self.assertArgHasType(TestNSOutlineViewHelper.outlineView_toolTipForCell_rect_tableColumn_item_mouseLocation_, 5, NSPoint.__typestr__)
        self.assertResultHasType(TestNSOutlineViewHelper.outlineView_heightOfRowByItem_, objc._C_CGFloat)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldExpandItem_)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldCollapseItem_)

    @min_os_level('10.5')
    def testProtocols10_5(self):
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldTypeSelectForEvent_withCurrentSearchString_)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldShowCellExpansionForTableColumn_item_)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldTrackCell_forTableColumn_item_)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_isGroupItem_)


    @min_os_level('10.6')
    def testProtocols10_6(self):
        self.assertResultHasType(TestNSOutlineViewHelper.outlineView_sizeToFitWidthOfColumn_, objc._C_CGFloat)
        self.assertArgHasType(TestNSOutlineViewHelper.outlineView_sizeToFitWidthOfColumn_, 1, objc._C_NSInteger)
        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldReorderColumn_toColumn_)
        self.assertArgHasType(TestNSOutlineViewHelper.outlineView_shouldReorderColumn_toColumn_, 1, objc._C_NSInteger)
        self.assertArgHasType(TestNSOutlineViewHelper.outlineView_shouldReorderColumn_toColumn_, 2, objc._C_NSInteger)

        self.assertResultIsBOOL(TestNSOutlineViewHelper.outlineView_shouldShowOutlineCellForItem_)


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.