Marcel Taeumel uploaded a new version of MorphicTests to project The Trunk:
http://source.squeak.org/trunk/MorphicTests-mt.29.mcz ==================== Summary ==================== Name: MorphicTests-mt.29 Author: mt Time: 1 May 2015, 11:52:25.528 am UUID: 79cef7f2-a107-194e-b2c0-88452a5711b5 Ancestors: MorphicTests-mt.28 Tests added for text editor's model callbacks. =============== Diff against MorphicTests-mt.28 =============== Item was added: + ValueHolder subclass: #MorphicTestTextModel + instanceVariableNames: 'flags result' + classVariableNames: '' + poolDictionaries: '' + category: 'MorphicTests-Text Support'! Item was added: + ----- Method: MorphicTestTextModel>>debugExpression: (in category 'do-its general') ----- + debugExpression: anExpression + + self flags add: #expressionDebugged. + self result: (Compiler evaluate: anExpression).! Item was added: + ----- Method: MorphicTestTextModel>>doItContext (in category 'do-its support') ----- + doItContext + + self flags add: #doItContext. + ^ nil! Item was added: + ----- Method: MorphicTestTextModel>>doItReceiver (in category 'do-its support') ----- + doItReceiver + + self flags add: #doItReceiver. + ^ self result! Item was added: + ----- Method: MorphicTestTextModel>>exploreIt:result: (in category 'do-its') ----- + exploreIt: expression result: object + + self flags add: #explored. + self result: object.! Item was added: + ----- Method: MorphicTestTextModel>>expressionEvaluated:result: (in category 'do-its general') ----- + expressionEvaluated: anExpression result: anObject + + self flags add: #expressionEvaluated. + self result: anObject.! Item was added: + ----- Method: MorphicTestTextModel>>flags (in category 'as yet unclassified') ----- + flags + + ^ flags ifNil: [flags := Bag new]! Item was added: + ----- Method: MorphicTestTextModel>>hasFlag: (in category 'as yet unclassified') ----- + hasFlag: aSymbol + + ^ self flags includes: aSymbol! Item was added: + ----- Method: MorphicTestTextModel>>inspectIt:result: (in category 'do-its') ----- + inspectIt: expression result: object + + self flags add: #inspected. + self result: object.! Item was added: + ----- Method: MorphicTestTextModel>>printIt:result: (in category 'do-its') ----- + printIt: expression result: object + + self flags add: #printed. + self result: object printString.! Item was added: + ----- Method: MorphicTestTextModel>>result (in category 'as yet unclassified') ----- + result + + ^ result! Item was added: + ----- Method: MorphicTestTextModel>>result: (in category 'as yet unclassified') ----- + result: anObject + + result := anObject.! Item was added: + MorphicTestTextModel subclass: #MorphicTestTextModelWithEvaluationSupport + instanceVariableNames: '' + classVariableNames: '' + poolDictionaries: '' + category: 'MorphicTests-Text Support'! Item was added: + ----- Method: MorphicTestTextModelWithEvaluationSupport>>evaluateExpression: (in category 'do-its general') ----- + evaluateExpression: anExpression + + self flags add: #expressionEvaluated. + self result: (Compiler evaluate: anExpression asString). + ^ self result! Item was added: + TestCase subclass: #TextEditorTest + instanceVariableNames: 'model widget' + classVariableNames: '' + poolDictionaries: '' + category: 'MorphicTests-Text Support'! Item was added: + ----- Method: TextEditorTest>>editor (in category 'running') ----- + editor + + ^ widget textMorph editor! Item was added: + ----- Method: TextEditorTest>>setUp (in category 'running') ----- + setUp + + super setUp. + model := MorphicTestTextModel new. + widget := PluggableTextMorph on: model text: #contents accept: #contents:. + + "We don't do real keyboard event handling. To be sure to set the model in the editor." + self editor model: model. + + model contents: ''.! Item was added: + ----- Method: TextEditorTest>>test01Setup (in category 'tests') ----- + test01Setup + + self assert: model dependents size = 1. + self assert: self editor model == model. + self assert: widget text isEmpty. + self assert: model contents isEmpty.! Item was added: + ----- Method: TextEditorTest>>test02EvaluateExpression (in category 'tests') ----- + test02EvaluateExpression + + model := MorphicTestTextModelWithEvaluationSupport new. + widget model: model. + + self text: '3+4'. + self editor doIt. + + self + assert: (model hasFlag: #expressionEvaluated); + assert: 7 equals: model result.! Item was added: + ----- Method: TextEditorTest>>test03DebugExpression (in category 'tests') ----- + test03DebugExpression + + self text: 'Morph new'. + self editor debugIt. + + self + assert: (model hasFlag: #expressionDebugged); + assert: (model result isKindOf: Morph).! Item was added: + ----- Method: TextEditorTest>>test04PrintIt (in category 'tests') ----- + test04PrintIt + + self text: '3+4'. + self editor printIt. + + self + assert: (model hasFlag: #printed); + assert: '7' equals: model result.! Item was added: + ----- Method: TextEditorTest>>test05ExploreIt (in category 'tests') ----- + test05ExploreIt + + self text: '1@1 corner: 20@20'. + self editor exploreIt. + + self + assert: (model hasFlag: #explored); + assert: (model result isKindOf: Rectangle).! Item was added: + ----- Method: TextEditorTest>>test06InspectIt (in category 'tests') ----- + test06InspectIt + + self text: '1@1 corner: 20@20'. + self editor inspectIt. + + self + assert: (model hasFlag: #inspected); + assert: (model result isKindOf: Rectangle).! Item was added: + ----- Method: TextEditorTest>>test07DoItReceiver (in category 'tests') ----- + test07DoItReceiver + + self text: 'self color'. + model result: (Morph new color: Color yellow). + self editor doIt. + + self + assert: (model hasFlag: #expressionEvaluated); + assert: Color yellow equals: model result.! Item was added: + ----- Method: TextEditorTest>>text: (in category 'running') ----- + text: aString + "Text editors have a short lifetime in pluggable text morphs." + + model contents: aString. + + "We don't do real keyboard event handling. To be sure to set the model in the editor." + self editor model: model.! |
Free forum by Nabble | Edit this page |