tests/FormTests.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Sat, 26 Nov 2016 20:38:31 +0000
branchjv
changeset 7764 618f2a37eee2
parent 7315 aed1314a2448
child 7775 27321d1dfbc4
permissions -rw-r--r--
Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7315
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"{ Package: 'stx:libview/tests' }"
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
"{ NameSpace: Smalltalk }"
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
TestCase subclass:#FormTests
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
	instanceVariableNames:''
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
	classVariableNames:''
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
	poolDictionaries:''
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
	category:'Compatibility-ST80-Graphics-Display Objects-Tests'
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
!
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
!FormTests methodsFor:'running'!
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
setUp
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
    self skipIf: Display isNil description: 'Display connection not available'
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
    "Created: / 25-04-2016 / 20:30:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
! !
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
!FormTests methodsFor:'tests - regression'!
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
test_issue_82
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
    "
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
    https://swing.fit.cvut.cz/projects/stx-jv/ticket/82
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
    "
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
    | f |
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
    f := Form width:8 height:8 depth:1.
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
    f colorMap:(Array with:Screen current blackColor with: Screen current whiteColor).
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
    f clear.
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
    f paint:(Color colorId:1).  
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
    self assert: (f bits allSatisfy:[:byte | byte = 0 ])
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    32
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    33
    "Created: / 25-04-2016 / 20:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7764
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    34
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    35
!
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    36
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    37
test_issue_88a
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    38
    "
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    39
    https://swing.fit.cvut.cz/projects/stx-jv/ticket/88
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    40
    "
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    41
    | f |
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    42
    f := Form width:8 height:8 depth:1.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    43
    f colorMap:(Array with:Screen current blackColor with: Screen current whiteColor).
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    44
    f paint:(Color colorId:0) on: (Color colorId:1).
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    45
    f clear.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    46
    f displayPointX: 1 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    47
    f displayPointX: 3 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    48
    f displayPointX: 5 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    49
    f displayPointX: 7 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    50
    f displayPointX: 1 y: 2.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    51
    f displayPointX: 1 y: 4.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    52
    f displayPointX: 1 y: 6.  
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    53
    f getBits.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    54
    self assert: f bits = #[ 2r10101010 2r11111111 2r10111111  2r11111111 2r10111111  2r11111111 2r10111111 2r11111111].
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    55
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    56
    f releaseFromDevice.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    57
    f setDevice:Screen current id:nil gcId:nil.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    58
    f recreate.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    59
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    60
    self assert: f bits = #[ 2r10101010 2r11111111 2r10111111  2r11111111 2r10111111  2r11111111 2r10111111 2r11111111].
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    61
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    62
    "Created: / 05-05-2016 / 22:59:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    63
!
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    64
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    65
test_issue_88b
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    66
    "
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    67
    https://swing.fit.cvut.cz/projects/stx-jv/ticket/88
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    68
    "
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    69
    | f b |
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    70
    f := Form width:8 height:8 depth:24.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    71
    f paint: Color black on: Color white.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    72
    f clear.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    73
    b := f bits.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    74
    self assert: (b copyFrom: 1 to: 12) = #[ 16rFF 16rFF 16rFF 16r00 16rFF 16rFF 16rFF 16r00 16rFF 16rFF 16rFF 16r00].
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    75
    
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    76
    f displayPointX: 1 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    77
    f displayPointX: 3 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    78
    f displayPointX: 5 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    79
    f displayPointX: 7 y: 0.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    80
    f displayPointX: 1 y: 2.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    81
    f displayPointX: 1 y: 4.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    82
    f displayPointX: 1 y: 6.  
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    83
    f getBits.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    84
    b := f bits.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    85
    self assert: (b copyFrom: 1 to: 12) = #[ 16rFF 16rFF 16rFF 16r00 16r00 16r00 16r00 16r00 16rFF 16rFF 16rFF 16r00].
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    86
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    87
    f releaseFromDevice.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    88
    f setDevice:Screen current id:nil gcId:nil.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    89
    f recreate.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    90
    
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    91
    b := f bits.
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    92
    self assert: (b copyFrom: 1 to: 12) = #[ 16rFF 16rFF 16rFF 16r00 16r00 16r00 16r00 16r00 16rFF 16rFF 16rFF 16r00].
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    93
618f2a37eee2 Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 7315
diff changeset
    94
    "Created: / 05-05-2016 / 23:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
7315
aed1314a2448 Issue #82: UIPainterView does not understand: #deviceClippingRectangle
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
! !