The Trunk: Tests-ul.161.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tests-ul.161.mcz

commits-2
Levente Uzonyi uploaded a new version of Tests to project The Trunk:
http://source.squeak.org/trunk/Tests-ul.161.mcz

==================== Summary ====================

Name: Tests-ul.161
Author: ul
Time: 19 August 2012, 6:53:41.704 pm
UUID: 9e72a8cb-b86e-3e45-819d-e98c1f3a84c9
Ancestors: Tests-cwp.160

Added a test for Clipboard, mainly for the new notification mechanism.

=============== Diff against Tests-cwp.160 ===============

Item was added:
+ TestCase subclass: #ClipboardTest
+ instanceVariableNames: 'originalClipboardText'
+ classVariableNames: ''
+ poolDictionaries: ''
+ category: 'Tests-System-Support'!

Item was added:
+ ----- Method: ClipboardTest>>setUp (in category 'as yet unclassified') -----
+ setUp
+ "Store the contents of the default clipboard. This is necessary, because all Clipboard instances modify the contents of the system clipboard."
+
+ originalClipboardText := Clipboard default clipboardText!

Item was added:
+ ----- Method: ClipboardTest>>tearDown (in category 'as yet unclassified') -----
+ tearDown
+ "Restore the contents of the default clipboard. This is necessary, because all Clipboard instances modify the contents of the system clipboard."
+
+ Clipboard default clipboardText: originalClipboardText!

Item was added:
+ ----- Method: ClipboardTest>>testClipboardText (in category 'as yet unclassified') -----
+ testClipboardText
+
+ | uuidString clipboard |
+ uuidString := UUID new asString36.
+ clipboard := Clipboard new.
+ clipboard clipboardText: uuidString.
+ self assert: uuidString equals: clipboard clipboardText asString!

Item was added:
+ ----- Method: ClipboardTest>>testClipboardTextNotifyWith (in category 'as yet unclassified') -----
+ testClipboardTextNotifyWith
+
+ | uuidString clipboard subscriber notifiedText notifiedSource |
+ uuidString := UUID new asString36.
+ clipboard := Clipboard new.
+ subscriber := [ :text :source |
+ notifiedText := text.
+ notifiedSource := source ].
+ clipboard
+ when: #contentChanged
+ send: #value:value:
+ to: subscriber.
+ clipboard clipboardText: uuidString.
+ self
+ assert: uuidString equals: notifiedText;
+ assert: nil equals: notifiedSource.
+ clipboard clipboardText: uuidString reversed notifyWith: self.
+ self
+ assert: uuidString reversed equals: notifiedText;
+ assert: self == notifiedSource.
+ clipboard removeActionsWithReceiver: subscriber.
+ clipboard clipboardText: uuidString.
+ self
+ assert: uuidString reversed equals: notifiedText;
+ assert: self == notifiedSource!