RegressionTests__WrongMethodCalledTest.st
author Claus Gittinger <cg@exept.de>
Tue, 25 Feb 2020 17:19:49 +0100
changeset 2586 7dc7be5a6f3d
parent 2483 6820e0ac0631
permissions -rw-r--r--
#OTHER by cg s

"{ Encoding: utf8 }"

"
 COPYRIGHT (c) 2018 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
"{ 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'!

copyright
"
 COPYRIGHT (c) 2018 by eXept Software AG
              All Rights Reserved

 This software is furnished under a license and may be used
 only in accordance with the terms of that license and with the
 inclusion of the above copyright notice.   This software may not
 be provided or otherwise made available to, or used by, any
 other person.  No title to or ownership of the software is
 hereby transferred.
"
!

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$'
! !