RegressionTests__WrongMethodCalledTest.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 1447 2351db93aa5b
child 1500 d406a10b2965
child 2483 6820e0ac0631
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

ApplicationModel subclass:#WrongMethodCalledTest
	instanceVariableNames:'vh1 vh2 updateProcess'
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression'
!

View subclass:#GraphicTestView
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	privateIn:WrongMethodCalledTest
!

!WrongMethodCalledTest class methodsFor:'documentation'!

documentation
"
    Run this multiple times with JIT turned off.

    In ST/X rel < 5.1.2, Sooner or later, the paint method
    will be invoked (illegally) via the fillRectangle selector
    and vice versa.
"
! !

!WrongMethodCalledTest class methodsFor:'interface specs'!

windowSpec
    "This resource specification was automatically generated
     by the UIPainter of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the UIPainter may not be able to read the specification."

    "
     UIPainter new openOnClass:NewApplication1 andSelector:#windowSpec
     NewApplication1 new openInterface:#windowSpec
     NewApplication1 open
    "

    <resource: #canvas>

    ^
     #(FullSpec
	name: windowSpec
	window:
       (WindowSpec
	  label: 'NewApplication1'
	  name: 'NewApplication1'
	  min: (Point 10 10)
	  max: (Point 1024 768)
	  bounds: (Rectangle 12 22 312 322)
	  menu: mainMenu
	)
	component:
       (SpecCollection
	  collection: (
	   (NonScrollableArbitraryComponentSpec
	      name: 'NonScrollableArbitraryComponent1'
	      layout: (LayoutFrame 6 0 4 0 285 0 93 0)
	      model: vh2
	      component: GraphicTestView
	    )
	   (InputFieldSpec
	      name: 'EntryField1'
	      layout: (LayoutFrame 14 0 181 0 219 0 203 0)
	      model: vh1
	      type: number
	      acceptOnReturn: true
	      acceptOnTab: true
	      acceptOnLostFocus: true
	      acceptOnPointerLeave: false
	    )
	   (InputFieldSpec
	      name: 'EntryField2'
	      layout: (LayoutFrame 14 0 144 0 219 0 166 0)
	      model: vh1
	      type: number
	      acceptOnReturn: true
	      acceptOnTab: true
	      acceptOnLostFocus: true
	      acceptOnPointerLeave: false
	    )
	   (InputFieldSpec
	      name: 'EntryField3'
	      layout: (LayoutFrame 14 0 107 0 219 0 129 0)
	      model: vh1
	      type: number
	      acceptOnReturn: true
	      acceptOnTab: true
	      acceptOnLostFocus: true
	      acceptOnPointerLeave: false
	    )
	   (InputFieldSpec
	      name: 'EntryField4'
	      layout: (LayoutFrame 14 0 218 0 219 0 240 0)
	      model: vh1
	      type: number
	      acceptOnReturn: true
	      acceptOnTab: true
	      acceptOnLostFocus: true
	      acceptOnPointerLeave: false
	    )
	   (InputFieldSpec
	      name: 'EntryField5'
	      layout: (LayoutFrame 14 0 255 0 219 0 277 0)
	      model: vh1
	      type: number
	      acceptOnReturn: true
	      acceptOnTab: true
	      acceptOnLostFocus: true
	      acceptOnPointerLeave: false
	    )
	   )

	)
      )
! !

!WrongMethodCalledTest class methodsFor:'menu specs'!

mainMenu
    "This resource specification was automatically generated
     by the MenuEditor of ST/X."

    "Do not manually edit this!! If it is corrupted,
     the MenuEditor may not be able to read the specification."

    "
     MenuEditor new openOnClass:RegressionTests::WrongMethodCalledTest andSelector:#mainMenu
     (Menu new fromLiteralArrayEncoding:(RegressionTests::WrongMethodCalledTest mainMenu)) startUp
    "

    <resource: #menu>

    ^
     #(Menu
	(
	 (MenuItem
	    label: 'File'
	    translateLabel: true
	    submenu:
	   (Menu
	      (
	       (MenuItem
		  label: 'Exit'
		  itemValue: closeRequest
		  translateLabel: true
		)
	       )
	      nil
	      nil
	    )
	  )
	 )
	nil
	nil
      )
! !

!WrongMethodCalledTest class methodsFor:'others'!

version_CVS
    ^ '$Header$'
! !

!WrongMethodCalledTest methodsFor:'aspects'!

vh1
    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    vh1 isNil ifTrue:[
	vh1 := 1 asValue
    ].
    ^ vh1.
!

vh2
    "automatically generated by UIPainter ..."

    "*** the code below creates a default model when invoked."
    "*** (which may not be the one you wanted)"
    "*** Please change as required and accept it in the browser."
    "*** (and replace this comment by something more useful ;-)"

    vh2 isNil ifTrue:[
	vh2 := 1 asValue
    ].
    ^ vh2.
! !

!WrongMethodCalledTest methodsFor:'initialization & release'!

closeRequest
    updateProcess terminate.
    super closeRequest.
!

postBuildWith:aBuilder
    |val|

    super postBuildWith:aBuilder.

    updateProcess := [
	[self window realized] whileTrue:[
	    val := self vh1 value.
	    val := (val + 1) \\ 100.
	    self vh1 value:val.

	    val := self vh2 value.
	    val := (val + 1) \\ 100.
	    self vh2 value:val.
	].
    ] forkAt:4.
! !

!WrongMethodCalledTest::GraphicTestView methodsFor:'change & update'!

redraw
    self paint:Color red.
    self fillRectangle:(Rectangle origin:0@0 corner:30@40).
!

update:something with:aParameter from:where
    self redraw
! !

!WrongMethodCalledTest class methodsFor:'documentation'!

version
    ^ '$Header$'
! !