MCPcopy Create free account
hub / github.com/FastLED/FastLED / FL_TEST_FILE

Function FL_TEST_FILE

tests/fl/channels/driver.cpp:33–727  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31#include "fl/chipsets/spi.h"
32
33FL_TEST_FILE(FL_FILEPATH) {
34
35namespace channel_engine_test {
36
37using namespace fl;
38
39/// Mock IChannelDriver for testing
40class MockEngine : public IChannelDriver {
41public:
42 explicit MockEngine(const char* name = "MOCK") : mName(name) {}
43
44 int transmitCount = 0;
45 int lastChannelCount = 0;
46 int enqueueCount = 0;
47 int showCount = 0;
48 fl::vector<ChannelDataPtr> mEnqueuedChannels;
49 fl::vector<ChannelDataPtr> mTransmittingChannels;
50
51 bool canHandle(const ChannelDataPtr& data) const override {
52 (void)data;
53 return true; // Test driver accepts all channel types
54 }
55
56 void enqueue(ChannelDataPtr channelData) override {
57 if (channelData) {
58 enqueueCount++;
59 mEnqueuedChannels.push_back(channelData);
60 }
61 }
62
63 void show() override {
64 showCount++;
65 if (!mEnqueuedChannels.empty()) {
66 mTransmittingChannels = fl::move(mEnqueuedChannels);
67 mEnqueuedChannels.clear();
68 beginTransmission(mTransmittingChannels);
69 }
70 }
71
72 DriverState poll() override {
73 // Mock implementation: always return READY after transmission
74 if (!mTransmittingChannels.empty()) {
75 mTransmittingChannels.clear();
76 }
77 return DriverState::READY;
78 }
79
80 fl::string getName() const override { return mName; }
81
82 Capabilities getCapabilities() const override {
83 return Capabilities(true, true); // Mock accepts both clockless and SPI
84 }
85
86private:
87 void beginTransmission(fl::span<const ChannelDataPtr> channels) {
88 transmitCount++;
89 lastChannelCount = channels.size();
90 }

Callers

nothing calls this directly

Calls 15

createFunction · 0.85
addListenerFunction · 0.85
addDriverMethod · 0.80
showLedsMethod · 0.80
asControllerMethod · 0.80
removeDriverMethod · 0.80
clearLedsMethod · 0.80
getDataMethod · 0.80
getDiameterMethod · 0.80
fill_solidFunction · 0.50
getPinMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected