The Trunk: ST80-eem.226.mcz

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

The Trunk: ST80-eem.226.mcz

commits-2
Eliot Miranda uploaded a new version of ST80 to project The Trunk:
http://source.squeak.org/trunk/ST80-eem.226.mcz

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

Name: ST80-eem.226
Author: eem
Time: 30 March 2017, 6:06:51.771911 pm
UUID: ababcf44-ca33-4ee1-854d-f2bbf4707f6f
Ancestors: ST80-eem.225

Replace mention of MethodContext with Context in class comments as appropriate.

=============== Diff against ST80-eem.225 ===============

Item was changed:
  TestCase subclass: #ST80MenusTest
  instanceVariableNames: ''
  classVariableNames: ''
  poolDictionaries: ''
  category: 'ST80-Menus-Tests'!
 
+ !ST80MenusTest commentStamp: 'eem 3/30/2017 17:33' prior: 0!
- !ST80MenusTest commentStamp: 'tlk 5/2/2006 22:41' prior: 0!
  I am an SUnit Test of PopUpMenu and FillInTheBlank.  The original motivation for my creation was the regression of functionality associated with allowing the non-interactive testing of these menus.  
 
  My fixtures are: None
 
  NOTES ABOUT AUTOMATING USER INPUTS (See MethodContextTest also for a discussion of this functionality.)
 
  When executing non-interactive programs you will inevitably run into programs  that require user input during their execution and these sort of problems shoot the whole non-interactiveness of your enclosing program. This is particularly true in doing Sunit tests.
 
+ PopUpMenu and FillInTheBlankMorph were modified to first signal a ProvideAnswerNotification and if someone handles that (e.g. the enclosing block) then the user interaction will be avoided and a answer provided by an array will be used instead. PopUpMenu and FillInTheBlankMorph take advantage of BlockClosure helper methods have been made available and tests of these helpers are provided in this class to demonstrate that it can intercept  requests for user interaction.  Of course,
- PopUpMenu and FillInTheBlankMorph were modified to first signal a ProvideAnswerNotification and if someone handles that (e.g. the enclosing block) then the user interaction will be avoided and a answer provided by an array will be used instead. PopUpMenu and FillInTheBlankMorph take advantage of BlockContext helper methods have been made available and tests of these helpers are provided in this class to demonstrate that it can intercept  requests for user interaction.  Of course,
 
   The basic syntax looks like:
 
  [self confirm: 'Install spyware?'] valueSupplyingAnswer: #('Install spyware?' false)
 
  There a few variants on this theme making it easy to provide a literal list of answers for the block so that you can handle a bunch of questions in a block with appropriate answers.
 
  Additionally, it is possible to suppress Object>>inform: modal dialog boxes as these get in the way of automating anything.  After applying this changeset you should be able to tryout the following code snippets to see the variants on this theme that are available.
 
  Examples:
 
  So you don't need any introduction here -- this one works like usual.
  [self inform: 'hello'. #done] value.
 
  Now let's suppress all inform: messages.
  [self inform: 'hello'; inform: 'there'. #done] valueSuppressingAllMessages.
 
  Here we can just suppress a single inform: message.
  [self inform: 'hi'; inform: 'there'. #done] valueSuppressingMessages: #('there')
 
  Here you see how you can suppress a list of messages.
  [self inform: 'hi'; inform: 'there'; inform: 'bill'. #done] valueSuppressingMessages: #('hi' 'there')
 
  Enough about inform:, let's look at confirm:. As you see this one works as expected.
  [self confirm: 'You like Squeak?'] value
 
  Let's supply answers to one of the questions -- check out the return value.
  [{self confirm: 'You like Smalltalk?'. self confirm: 'You like Squeak?'}]
  valueSupplyingAnswer: #('You like Smalltalk?' true)
 
  Here we supply answers using only substrings of the questions (for simplicity).
  [{self confirm: 'You like Squeak?'. self confirm: 'You like MVC?'}]
  valueSupplyingAnswers: #( ('Squeak' true) ('MVC' false) )
 
  This time let's answer all questions exactly the same way.
  [{self confirm: 'You like Squeak?'. self confirm: 'You like Morphic?'}]
  valueSupplyingAnswer: true
 
  And, of course, we can answer FillInTheBlank questions in the same manner.
  [FillInTheBlank request: 'What day is it?']
  valueSupplyingAnswer: 'the first day of the rest of your life'
 
  We can also return whatever the initialAnswer of the FillInTheBlank was by using the #default answer.
  [FillInTheBlank request: 'What day is it?' initialAnswer: DateAndTime now dayOfWeekName]
  valueSupplyingAnswer: #default
 
  Finally, you can also do regex matches on any of the question text (or inform text) (should you have VB-Regex enhancements in your image).
  [FillInTheBlank request: 'What day is it?']
  valueSupplyingAnswers: { {'What day.*\?'. DateAndTime now dayOfWeekName} }!