30 lines
663 B
C++
30 lines
663 B
C++
// Copyright (2019-2022) Paul Scherrer Institute
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
#include <catch2/catch.hpp>
|
|
|
|
#include "../common/ROIFilter.h"
|
|
|
|
TEST_CASE("ROIFilter") {
|
|
size_t width = 4;
|
|
size_t height = 5;
|
|
std::vector<uint32_t> v(width * height, 1);
|
|
|
|
ROIFilter filter(width, height);
|
|
|
|
filter.SetRectangle(1, 1, 2, 3);
|
|
|
|
filter.Apply(v, (uint32_t) 55);
|
|
|
|
REQUIRE(v[0] == 55);
|
|
REQUIRE(v[2] == 55);
|
|
|
|
REQUIRE(v[width * 1 + 0] == 55);
|
|
REQUIRE(v[width * 1 + 1] == 1);
|
|
REQUIRE(v[width * 1 + 2] == 1);
|
|
REQUIRE(v[width * 1 + 3] == 55);
|
|
|
|
REQUIRE(v[width * 3 + 2] == 1);
|
|
REQUIRE(v[width * 4 + 2] == 55);
|
|
}
|