summaryrefslogtreecommitdiff
path: root/test/threads.cpp
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-24 11:58:20 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-28 00:30:06 +0300
commita000a1f6e3208515200aaae6ca8128471c6ed9f3 (patch)
tree38c77e5d05d9af43f6769a8a35881bc49a014bc9 /test/threads.cpp
parentc352419371183770b6e2b5bbd183a8812062e834 (diff)
package: gentoo: Select build type through debug USE flag
Make the build type selectable between debug and plain through the debug USE flag. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'test/threads.cpp')
0 files changed, 0 insertions, 0 deletions
pan class="hl ppc">#include <iostream> #include <libcamera/geometry.h> #include <libcamera/stream.h> #include "test.h" using namespace std; using namespace libcamera; class StreamFormatsTest : public Test { protected: int testSizes(std::string name, std::vector<Size> test, std::vector<Size> valid) { bool pass = false; for (Size &size : test) { pass = false; for (Size &validSize : valid) { if (size == validSize) { pass = true; break; } } if (!pass) break; } if (!pass) { cout << "Failed " << name << endl; cout << "Sizes to test:" << endl; for (Size &size : test) cout << size.toString() << endl; cout << "Valid sizes:" << endl; for (Size &size : valid) cout << size.toString() << endl; return TestFail; } return TestPass; } int run() { /* Test discrete sizes */ StreamFormats discrete({ { PixelFormat(1), { SizeRange({ 100, 100 }), SizeRange({ 200, 200 }) } }, { PixelFormat(2), { SizeRange({ 300, 300 }), SizeRange({ 400, 400 }) } }, }); if (testSizes("discrete 1", discrete.sizes(PixelFormat(1)), { Size(100, 100), Size(200, 200) })) return TestFail; if (testSizes("discrete 2", discrete.sizes(PixelFormat(2)), { Size(300, 300), Size(400, 400) })) return TestFail; /* Test range sizes */ StreamFormats range({ { PixelFormat(1), { SizeRange({ 640, 480 }, { 640, 480 }) } }, { PixelFormat(2), { SizeRange({ 640, 480 }, { 800, 600 }, 8, 8) } }, { PixelFormat(3), { SizeRange({ 640, 480 }, { 800, 600 }, 16, 16) } }, { PixelFormat(4), { SizeRange({ 128, 128 }, { 4096, 4096 }, 128, 128) } }, }); if (testSizes("range 1", range.sizes(PixelFormat(1)), { Size(640, 480) })) return TestFail; if (testSizes("range 2", range.sizes(PixelFormat(2)), { Size(640, 480), Size(720, 480), Size(720, 576), Size(768, 480),