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

Function FL_TEST_FILE

tests/fastled_core.cpp:58–1899  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56#include "fl/channels/cled_controller.h"
57
58FL_TEST_FILE(FL_FILEPATH) {
59
60#undef NUM_LEDS // Avoid redefinition in unity builds
61#define NUM_LEDS 1000
62#define DATA_PIN 2
63#define CLOCK_PIN 3
64
65FL_TEST_CASE("Simple") {
66 static CRGB leds[NUM_LEDS]; // Use static to avoid global constructor warning
67 FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, BGR>(leds, NUM_LEDS);
68}
69
70FL_TEST_CASE("Fill Gradient SHORTEST_HUES") {
71 static CRGB leds[NUM_LEDS];
72 fill_gradient(leds, 0, CHSV(0, 255, 255), NUM_LEDS - 1, CHSV(96, 255, 255), SHORTEST_HUES);
73}
74
75FL_TEST_CASE("Legacy aliases resolve to FastLED instance") {
76 // Verify that all legacy aliases point to the same object
77 // These aliases provide backward compatibility for code written for
78 // FastSPI_LED and FastSPI_LED2 (the original library names)
79
80 FL_SUBCASE("FastSPI_LED alias") {
81 CFastLED* pFastLED = &FastLED;
82 CFastLED* pFastSPI_LED = &FastSPI_LED;
83 FL_CHECK(pFastLED == pFastSPI_LED);
84 }
85
86 FL_SUBCASE("FastSPI_LED2 alias") {
87 CFastLED* pFastLED = &FastLED;
88 CFastLED* pFastSPI_LED2 = &FastSPI_LED2;
89 FL_CHECK(pFastLED == pFastSPI_LED2);
90 }
91
92 FL_SUBCASE("LEDS alias") {
93 CFastLED* pFastLED = &FastLED;
94 CFastLED* pLEDS = &LEDS;
95 FL_CHECK(pFastLED == pLEDS);
96 }
97
98 FL_SUBCASE("All aliases access same brightness setting") {
99 static CRGB leds[NUM_LEDS];
100 FastLED.clear();
101 FastLED.addLeds<APA102, DATA_PIN, CLOCK_PIN, BGR>(leds, NUM_LEDS);
102
103 // Set brightness using FastLED
104 FastLED.setBrightness(128);
105
106 // Verify all aliases see the same brightness
107 FL_CHECK(FastLED.getBrightness() == 128);
108 FL_CHECK(FastSPI_LED.getBrightness() == 128);
109 FL_CHECK(FastSPI_LED2.getBrightness() == 128);
110 FL_CHECK(LEDS.getBrightness() == 128);
111
112 // Change brightness using legacy alias
113 FastSPI_LED.setBrightness(64);
114
115 // Verify all aliases see the new brightness

Callers

nothing calls this directly

Calls 15

fill_gradientFunction · 0.85
createFunction · 0.85
makeChannelFunction · 0.85
controllerInListFunction · 0.85
RgbwClass · 0.85
maxFunction · 0.85
roundFunction · 0.85
radiansFunction · 0.85
degreesFunction · 0.85
addDriverMethod · 0.80
getDriverByNameMethod · 0.80
isInDrawListMethod · 0.80

Tested by

no test coverage detected