[Pyobjc-dev] test for integer handling by undoManager
Brought to you by:
ronaldoussoren
From: David E. <epp...@ic...> - 2003-02-03 19:29:09
|
# test ability of int argument to pass through undo and then # be used as parameter to another routine expecting an int # # the actual routine I want to use is # NSTableView.editColumn_row_withEvent_select_ # but that involves setting up a UI; instead use NSIndexSpecifier from Foundation import NSObject, NSUndoManager, NSIndexSpecifier class TestUndoInt (NSObject): undo = NSUndoManager.alloc().init() idx = NSIndexSpecifier.alloc().init() idx.setIndex_(0) def test(self,i): self.undo.prepareWithInvocationTarget_(self).test(self.idx.index()) self.idx.setIndex_(i) # test that undo works x = TestUndoInt.alloc().init() x.test(3) assert(x.idx.index() == 3) x.undo.undo() assert(x.idx.index() == 0) -- David Eppstein UC Irvine Dept. of Information & Computer Science epp...@ic... http://www.ics.uci.edu/~eppstein/ |