summaryrefslogtreecommitdiff
path: root/test/camera-sensor.cpp
diff options
context:
space:
mode:
authorPaul Elder <paul.elder@ideasonboard.com>2020-07-04 17:56:11 +0900
committerPaul Elder <paul.elder@ideasonboard.com>2020-07-10 16:11:29 +0900
commit99b926bd124565aa98d7d47a40d8830813b7209e (patch)
treea4d99804b099d37751504061ce21777f7d0e8b60 /test/camera-sensor.cpp
parent7ed827e0a09bffabf4b2c4bc2a506e9563207a93 (diff)
libcamera: rkisp1: Fill stride and frameSize at config validation
Fill the stride and frameSize fields of the StreamConfiguration at configuration validation time instead of at camera configuration time. This allows applications to get the stride when trying a configuration without modifying the active configuration of the camera. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test/camera-sensor.cpp')
0 files changed, 0 insertions, 0 deletions
sts */ #include <iostream> #include <libcamera/geometry.h> #include "test.h" using namespace std; using namespace libcamera; class GeometryTest : public Test { protected: bool compare(const Size &lhs, const Size &rhs, bool (*op)(const Size &lhs, const Size &rhs), const char *opName, bool expect) { bool result = op(lhs, rhs); if (result != expect) { cout << "Size(" << lhs.width << ", " << lhs.height << ") " << opName << " " << "Size(" << rhs.width << ", " << rhs.height << ") " << "test failed" << std::endl; return false; } return true; } int run() { /* Test Size equality and inequality. */ if (!compare(Size(100, 100), Size(100, 100), &operator==, "==", true)) return TestFail; if (!compare(Size(100, 100), Size(100, 100), &operator!=, "!=", false)) return TestFail; if (!compare(Size(100, 100), Size(200, 100), &operator==, "==", false)) return TestFail; if (!compare(Size(100, 100), Size(200, 100), &operator!=, "!=", true)) return TestFail; if (!compare(Size(100, 100), Size(100, 200), &operator==, "==", false)) return TestFail; if (!compare(Size(100, 100), Size(100, 200), &operator!=, "!=", true)) return TestFail; /* Test Size ordering based on combined with and height. */ if (!compare(Size(100, 100), Size(200, 200), &operator<, "<", true)) return TestFail; if (!compare(Size(100, 100), Size(200, 200), &operator<=, "<=", true)) return TestFail; if (!compare(Size(100, 100), Size(200, 200), &operator>, ">", false)) return TestFail; if (!compare(Size(100, 100), Size(200, 200), &operator>=, ">=", false)) return TestFail; if (!compare(Size(200, 200), Size(100, 100), &operator<, "<", false)) return TestFail; if (!compare(Size(200, 200), Size(100, 100), &operator<=, "<=", false)) return TestFail; if (!compare(Size(200, 200), Size(100, 100), &operator>, ">", true)) return TestFail; if (!compare(Size(200, 200), Size(100, 100), &operator>=, ">=", true)) return TestFail; /* Test Size ordering based on area (with overlapping sizes). */ if (!compare(Size(200, 100), Size(100, 400), &operator<, "<", true)) return TestFail; if (!compare(Size(200, 100), Size(100, 400), &operator<=, "<=", true)) return TestFail; if (!compare(Size(200, 100), Size(100, 400), &operator>, ">", false)) return TestFail; if (!compare(Size(200, 100), Size(100, 400), &operator>=, ">=", false)) return TestFail; if (!compare(Size(100, 400), Size(200, 100), &operator<, "<", false)) return TestFail; if (!compare(Size(100, 400), Size(200, 100), &operator<=, "<=", false)) return TestFail; if (!compare(Size(100, 400), Size(200, 100), &operator>, ">", true)) return TestFail; if (!compare(Size(100, 400), Size(200, 100), &operator>=, ">=", true)) return TestFail; /* Test Size ordering based on width (with identical areas). */ if (!compare(Size(100, 200), Size(200, 100), &operator<, "<", true)) return TestFail; if (!compare(Size(100, 200), Size(200, 100), &operator<=, "<=", true)) return TestFail; if (!compare(Size(100, 200), Size(200, 100), &operator>, ">", false)) return TestFail; if (!compare(Size(100, 200), Size(200, 100), &operator>=, ">=", false)) return TestFail; if (!compare(Size(200, 100), Size(100, 200), &operator<, "<", false)) return TestFail; if (!compare(Size(200, 100), Size(100, 200), &operator<=, "<=", false)) return TestFail; if (!compare(Size(200, 100), Size(100, 200), &operator>, ">", true)) return TestFail; if (!compare(Size(200, 100), Size(100, 200), &operator>=, ">=", true)) return TestFail; return TestPass; } }; TEST_REGISTER(GeometryTest)