From 7fc65e9680f604099d5d4f294b37fe7eb93acb03 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Thu, 25 Jun 2020 04:23:30 +0300 Subject: libcamera: geometry: Add isNull() function to Size class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's common for code to check if a size is null. Add a helper function to do so. Signed-off-by: Laurent Pinchart Reviewed-by: Umang Jain Reviewed-by: Jacopo Mondi Reviewed-by: Niklas Söderlund Signed-off-by: Niklas Söderlund --- test/geometry.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test/geometry.cpp') diff --git a/test/geometry.cpp b/test/geometry.cpp index 27e65565..904ad92c 100644 --- a/test/geometry.cpp +++ b/test/geometry.cpp @@ -36,6 +36,16 @@ protected: int run() { + if (!Size().isNull() || !Size(0, 0).isNull()) { + cout << "Null size incorrectly reported as not null" << endl; + return TestFail; + } + + if (Size(0, 100).isNull() || Size(100, 0).isNull() || Size(100, 100).isNull()) { + cout << "Non-null size incorrectly reported as null" << endl; + return TestFail; + } + /* Test Size equality and inequality. */ if (!compare(Size(100, 100), Size(100, 100), &operator==, "==", true)) return TestFail; -- cgit v1.2.1