| 56 | #include "fl/channels/cled_controller.h" |
| 57 | |
| 58 | FL_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 | |
| 65 | FL_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 | |
| 70 | FL_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 | |
| 75 | FL_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 |
nothing calls this directly
no test coverage detected