1from AppKit import * 2from PyObjCTools.TestSupport import * 3 4class TestNSCollectionViewHelper (NSObject): 5 def collectionView_canDragItemsAtIndexes_withEvent_(self, v, i, e): return 1 6 def collectionView_writeItemsAtIndexes_toPasteboard_(self, v, i, p): return 1 7 def collectionView_draggingImageForItemsAtIndexes_withEvent_offset_(self, v, i, e, o): return 1 8 def collectionView_validateDrop_proposedIndex_dropOperation_(self, v, d, i, o): return 1 9 def collectionView_acceptDrop_index_dropOperation_(self, v, d, i, o): return 1 10 11 12class TestNSCollectionView (TestCase): 13 def testMethods(self): 14 self.assertResultIsBOOL(NSCollectionViewItem.isSelected) 15 self.assertArgIsBOOL(NSCollectionViewItem.setSelected_, 0) 16 17 self.assertResultIsBOOL(NSCollectionView.isFirstResponder) 18 19 self.assertResultIsBOOL(NSCollectionView.isSelectable) 20 self.assertArgIsBOOL(NSCollectionView.setSelectable_, 0) 21 self.assertResultIsBOOL(NSCollectionView.allowsMultipleSelection) 22 self.assertArgIsBOOL(NSCollectionView.setAllowsMultipleSelection_, 0) 23 24 @min_os_level('10.6') 25 def testMethods10_6(self): 26 self.assertResultHasType(NSCollectionView.frameForItemAtIndex_, NSRect.__typestr__) 27 self.assertArgIsBOOL(NSCollectionView.setDraggingSourceOperationMask_forLocal_, 1) 28 self.assertArgHasType(NSCollectionView.draggingImageForItemsAtIndexes_withEvent_offset_, 2, 29 b'N^' + NSPoint.__typestr__) 30 31 self.assertResultIsBOOL(TestNSCollectionViewHelper.collectionView_canDragItemsAtIndexes_withEvent_) 32 self.assertResultIsBOOL(TestNSCollectionViewHelper.collectionView_writeItemsAtIndexes_toPasteboard_) 33 self.assertArgHasType(TestNSCollectionViewHelper.collectionView_draggingImageForItemsAtIndexes_withEvent_offset_, 34 3, b'N^' + NSPoint.__typestr__) 35 36 self.assertResultHasType(TestNSCollectionViewHelper.collectionView_validateDrop_proposedIndex_dropOperation_, 37 objc._C_NSInteger) 38 self.assertArgHasType(TestNSCollectionViewHelper.collectionView_validateDrop_proposedIndex_dropOperation_, 39 2, b'N^' + objc._C_NSInteger) 40 self.assertArgHasType(TestNSCollectionViewHelper.collectionView_validateDrop_proposedIndex_dropOperation_, 41 3, b'N^' + objc._C_NSInteger) 42 43 self.assertResultIsBOOL(TestNSCollectionViewHelper.collectionView_acceptDrop_index_dropOperation_) 44 self.assertArgHasType(TestNSCollectionViewHelper.collectionView_acceptDrop_index_dropOperation_, 45 2, objc._C_NSInteger) 46 self.assertArgHasType(TestNSCollectionViewHelper.collectionView_acceptDrop_index_dropOperation_, 47 3, objc._C_NSInteger) 48 49 50 @min_os_level('10.6') 51 def testConstants10_6(self): 52 self.assertEqual(NSCollectionViewDropOn, 0) 53 self.assertEqual(NSCollectionViewDropBefore, 1) 54 55if __name__ == "__main__": 56 main() 57