summaryrefslogtreecommitdiff
path: root/test/list-cameras.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/list-cameras.cpp')
-rw-r--r--test/list-cameras.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/list-cameras.cpp b/test/list-cameras.cpp
new file mode 100644
index 00000000..e2026c99
--- /dev/null
+++ b/test/list-cameras.cpp
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * Copyright (C) 2018, Google Inc.
+ *
+ * list.cpp - camera list tests
+ */
+
+#include <iostream>
+
+#include <libcamera/camera_manager.h>
+
+#include "test.h"
+
+using namespace std;
+using namespace libcamera;
+
+class ListTest : public Test
+{
+protected:
+ int init()
+ {
+ cm = CameraManager::instance();
+ cm->start();
+
+ return 0;
+ }
+
+ int run()
+ {
+ unsigned int count = 0;
+
+ for (auto name : cm->list()) {
+ cout << "- " << name << endl;
+ count++;
+ }
+
+ return count ? 0 : -ENODEV;
+ }
+
+ void cleanup()
+ {
+ cm->stop();
+ }
+
+private:
+ CameraManager *cm;
+};
+
+TEST_REGISTER(ListTest)