fix sdl_test test that failed in CI cpp mode (#10314)
* fix sdl_test test that failed in CI cpp mode * preserve old code for NimInAction in `nim c` mode
This commit is contained in:
parent
1d7e3a84fd
commit
fbd6743ea1
2 changed files with 20 additions and 8 deletions
|
|
@ -352,13 +352,13 @@ proc testNimInAction(r: var TResults, cat: Category, options: string) =
|
||||||
"8b5d28e985c0542163927d253a3e4fc9",
|
"8b5d28e985c0542163927d253a3e4fc9",
|
||||||
"783299b98179cc725f9c46b5e3b5381f",
|
"783299b98179cc725f9c46b5e3b5381f",
|
||||||
"1a2b3fba1187c68d6a9bfa66854f3318",
|
"1a2b3fba1187c68d6a9bfa66854f3318",
|
||||||
"80f9c3e594a798225046e8a42e990daf"
|
"391ff57b38d9ea6f3eeb3fe69ab539d3"
|
||||||
]
|
]
|
||||||
|
|
||||||
for i, test in tests:
|
for i, test in tests:
|
||||||
let filename = testsDir / test.addFileExt("nim")
|
let filename = testsDir / test.addFileExt("nim")
|
||||||
let testHash = getMD5(readFile(filename).string)
|
let testHash = getMD5(readFile(filename).string)
|
||||||
doAssert testHash == refHashes[i], "Nim in Action test " & filename & " was changed."
|
doAssert testHash == refHashes[i], "Nim in Action test " & filename & " was changed: " & $(i: i, testHash: testHash, refHash: refHashes[i])
|
||||||
# Run the tests.
|
# Run the tests.
|
||||||
for testfile in tests:
|
for testfile in tests:
|
||||||
test "tests/" & testfile & ".nim"
|
test "tests/" & testfile & ".nim"
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,24 @@ discard pollEvent(nil)
|
||||||
renderer.setDrawColor 29, 64, 153, 255
|
renderer.setDrawColor 29, 64, 153, 255
|
||||||
renderer.clear
|
renderer.clear
|
||||||
renderer.setDrawColor 255, 255, 255, 255
|
renderer.setDrawColor 255, 255, 255, 255
|
||||||
|
|
||||||
|
when defined(c):
|
||||||
|
# just to ensure code from NimInAction still works, but
|
||||||
|
# the `else` branch would work as well in C mode
|
||||||
var points = [
|
var points = [
|
||||||
(260'i32, 320'i32),
|
(260'i32, 320'i32),
|
||||||
(260'i32, 110'i32),
|
(260'i32, 110'i32),
|
||||||
(360'i32, 320'i32),
|
(360'i32, 320'i32),
|
||||||
(360'i32, 110'i32)
|
(360'i32, 110'i32)
|
||||||
]
|
]
|
||||||
|
else:
|
||||||
|
var points = [
|
||||||
|
(260.cint, 320.cint),
|
||||||
|
(260.cint, 110.cint),
|
||||||
|
(360.cint, 320.cint),
|
||||||
|
(360.cint, 110.cint)
|
||||||
|
]
|
||||||
|
|
||||||
renderer.drawLines(addr points[0], points.len.cint)
|
renderer.drawLines(addr points[0], points.len.cint)
|
||||||
|
|
||||||
renderer.present
|
renderer.present
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue