summaryrefslogtreecommitdiff
path: root/src/lc-compliance/environment.h
diff options
context:
space:
mode:
authorNícolas F. R. A. Prado <nfraprado@collabora.com>2021-07-02 09:21:12 -0300
committerJacopo Mondi <jacopo@jmondi.org>2021-07-06 12:40:53 +0200
commite5c51e1fcf8cf5de6d5bce1da7a2b3d95019f06e (patch)
tree7cd8b1a54c7ee8462f888ab918472fba84aee2d1 /src/lc-compliance/environment.h
parent034e0e81a2884c456eb191753ffb023fb8107062 (diff)
lc-compliance: Add Environment singleton
Add a singleton Environment class in order to make the camera available inside all tests. This is needed for the Googletest refactor, otherwise the tests, which are statically declared, won't be able to access the camera. Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/lc-compliance/environment.h')
-rw-r--r--src/lc-compliance/environment.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/lc-compliance/environment.h b/src/lc-compliance/environment.h
new file mode 100644
index 00000000..1c7d9a55
--- /dev/null
+++ b/src/lc-compliance/environment.h
@@ -0,0 +1,31 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2021, Collabora Ltd.
+ *
+ * environment.h - Common environment for tests
+ */
+#ifndef __LC_COMPLIANCE_ENVIRONMENT_H__
+#define __LC_COMPLIANCE_ENVIRONMENT_H__
+
+#include <libcamera/libcamera.h>
+
+using namespace libcamera;
+
+class Environment
+{
+public:
+ static Environment *get();
+
+ void setup(CameraManager *cm, std::string cameraId);
+
+ const std::string &cameraId() const { return cameraId_; }
+ CameraManager *cm() const { return cm_; }
+
+private:
+ Environment() = default;
+
+ std::string cameraId_;
+ CameraManager *cm_;
+};
+
+#endif /* __LC_COMPLIANCE_ENVIRONMENT_H__ */