# HG changeset patch
# User Jan Vrany <jan.vrany@fit.cvut.cz>
# Date 1480192711 0
# Sat Nov 26 20:38:31 2016 +0000
# Branch jv
# Node ID 618f2a37eee2dddf2ee897744f96e316af42cb68
# Parent 3dba89415c91a00fdf36d78a0517ad70ccd70691
Issue #88: Added tests check that bitmaps/pixmaps can be recreated properly.
diff -r 3dba89415c91 -r 618f2a37eee2 tests/FormTests.st
a
|
b
|
|
31 | 31 | self assert: (f bits allSatisfy:[:byte | byte = 0 ]) |
32 | 32 | |
33 | 33 | "Created: / 25-04-2016 / 20:04:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 34 | |
| 35 | ! |
| 36 | |
| 37 | test_issue_88a |
| 38 | " |
| 39 | https://swing.fit.cvut.cz/projects/stx-jv/ticket/88 |
| 40 | " |
| 41 | | f | |
| 42 | f := Form width:8 height:8 depth:1. |
| 43 | f colorMap:(Array with:Screen current blackColor with: Screen current whiteColor). |
| 44 | f paint:(Color colorId:0) on: (Color colorId:1). |
| 45 | f clear. |
| 46 | f displayPointX: 1 y: 0. |
| 47 | f displayPointX: 3 y: 0. |
| 48 | f displayPointX: 5 y: 0. |
| 49 | f displayPointX: 7 y: 0. |
| 50 | f displayPointX: 1 y: 2. |
| 51 | f displayPointX: 1 y: 4. |
| 52 | f displayPointX: 1 y: 6. |
| 53 | f getBits. |
| 54 | self assert: f bits = #[ 2r10101010 2r11111111 2r10111111 2r11111111 2r10111111 2r11111111 2r10111111 2r11111111]. |
| 55 | |
| 56 | f releaseFromDevice. |
| 57 | f setDevice:Screen current id:nil gcId:nil. |
| 58 | f recreate. |
| 59 | |
| 60 | self assert: f bits = #[ 2r10101010 2r11111111 2r10111111 2r11111111 2r10111111 2r11111111 2r10111111 2r11111111]. |
| 61 | |
| 62 | "Created: / 05-05-2016 / 22:59:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
| 63 | ! |
| 64 | |
| 65 | test_issue_88b |
| 66 | " |
| 67 | https://swing.fit.cvut.cz/projects/stx-jv/ticket/88 |
| 68 | " |
| 69 | | f b | |
| 70 | f := Form width:8 height:8 depth:24. |
| 71 | f paint: Color black on: Color white. |
| 72 | f clear. |
| 73 | b := f bits. |
| 74 | self assert: (b copyFrom: 1 to: 12) = #[ 16rFF 16rFF 16rFF 16r00 16rFF 16rFF 16rFF 16r00 16rFF 16rFF 16rFF 16r00]. |
| 75 | |
| 76 | f displayPointX: 1 y: 0. |
| 77 | f displayPointX: 3 y: 0. |
| 78 | f displayPointX: 5 y: 0. |
| 79 | f displayPointX: 7 y: 0. |
| 80 | f displayPointX: 1 y: 2. |
| 81 | f displayPointX: 1 y: 4. |
| 82 | f displayPointX: 1 y: 6. |
| 83 | f getBits. |
| 84 | b := f bits. |
| 85 | self assert: (b copyFrom: 1 to: 12) = #[ 16rFF 16rFF 16rFF 16r00 16r00 16r00 16r00 16r00 16rFF 16rFF 16rFF 16r00]. |
| 86 | |
| 87 | f releaseFromDevice. |
| 88 | f setDevice:Screen current id:nil gcId:nil. |
| 89 | f recreate. |
| 90 | |
| 91 | b := f bits. |
| 92 | self assert: (b copyFrom: 1 to: 12) = #[ 16rFF 16rFF 16rFF 16r00 16r00 16r00 16r00 16r00 16rFF 16rFF 16rFF 16r00]. |
| 93 | |
| 94 | "Created: / 05-05-2016 / 23:02:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
34 | 95 | ! ! |
35 | | |