From 139453822b8a2f9a3ffcfa745e84652ac5f244d8 Mon Sep 17 00:00:00 2001 From: Dieter Tschanz Date: Thu, 3 Jul 2025 20:26:10 +0200 Subject: [PATCH] Add compile-time test to verify Camera interface implementation. --- tests/components/camera/common.yaml | 18 ++++++++++++++++++ tests/components/camera/test.esp32-ard.yaml | 1 + tests/components/camera/test.esp32-idf.yaml | 1 + 3 files changed, 20 insertions(+) create mode 100644 tests/components/camera/common.yaml create mode 100644 tests/components/camera/test.esp32-ard.yaml create mode 100644 tests/components/camera/test.esp32-idf.yaml diff --git a/tests/components/camera/common.yaml b/tests/components/camera/common.yaml new file mode 100644 index 0000000000..b4ebb2caf0 --- /dev/null +++ b/tests/components/camera/common.yaml @@ -0,0 +1,18 @@ +esphome: + includes: + - ..\..\..\esphome\components\camera\ + +script: + - id: interface_compile_check + then: + - lambda: |- + using namespace esphome::camera; + class MockCamera : public Camera { + public: + void add_image_callback(std::function)> &&callback) override {} + CameraImageReader *create_image_reader() override { return 0; } + void request_image(CameraRequester requester) override {} + void start_stream(CameraRequester requester) override {} + void stop_stream(CameraRequester requester) override {} + }; + MockCamera* camera = new MockCamera(); diff --git a/tests/components/camera/test.esp32-ard.yaml b/tests/components/camera/test.esp32-ard.yaml new file mode 100644 index 0000000000..dade44d145 --- /dev/null +++ b/tests/components/camera/test.esp32-ard.yaml @@ -0,0 +1 @@ +<<: !include common.yaml diff --git a/tests/components/camera/test.esp32-idf.yaml b/tests/components/camera/test.esp32-idf.yaml new file mode 100644 index 0000000000..dade44d145 --- /dev/null +++ b/tests/components/camera/test.esp32-idf.yaml @@ -0,0 +1 @@ +<<: !include common.yaml