| 1286 | // ------------------------------------------------------------------------------------------------- |
| 1287 | |
| 1288 | void sanitizationTest(DeviceRef& device, bool hdr, float value) |
| 1289 | { |
| 1290 | const int W = 191; |
| 1291 | const int H = 347; |
| 1292 | |
| 1293 | FilterRef filter = device.newFilter("RT"); |
| 1294 | REQUIRE(bool(filter)); |
| 1295 | |
| 1296 | auto input = makeConstImage(device, W, H, 3, DataType::Float32, value); |
| 1297 | auto output = makeConstImage(device, W, H, 3, DataType::Float32, -1000.f); |
| 1298 | setFilterImage(filter, "color", input); |
| 1299 | setFilterImage(filter, "albedo", input); |
| 1300 | setFilterImage(filter, "normal", input); |
| 1301 | setFilterImage(filter, "output", output); |
| 1302 | filter.set("hdr", hdr); |
| 1303 | |
| 1304 | filter.commit(); |
| 1305 | REQUIRE(device.getError() == Error::None); |
| 1306 | |
| 1307 | filter.execute(); |
| 1308 | REQUIRE(device.getError() == Error::None); |
| 1309 | |
| 1310 | REQUIRE(isBetween(output, 0.f, hdr ? std::numeric_limits<float>::max() : 1.f)); |
| 1311 | } |
| 1312 | |
| 1313 | TEST_CASE("image sanitization", "[sanitization]") |
| 1314 | { |
no test coverage detected