@@ -61,7 +61,10 @@ public void GenerateHeader_WithMultipleLedIndices_ComputesNeoCountFromBindings()
6161 public void GenerateHeader_WithCustomNeoPixelPin_EmitsPin ( )
6262 {
6363 var configuration = new ConfigurationDefinition (
64- Array . Empty < ButtonBinding > ( ) ,
64+ new List < ButtonBinding >
65+ {
66+ new ButtonBinding ( 1 , true , 0 , false , false , new HidSequenceBinding ( "a" , 0 ) )
67+ } ,
6568 Array . Empty < EncoderBinding > ( ) ,
6669 DebugMode : false ,
6770 NeoPixelPin : 31 ) ;
@@ -71,6 +74,25 @@ public void GenerateHeader_WithCustomNeoPixelPin_EmitsPin()
7174 Assert . That ( result , Does . Contain ( "#define PIN_NEO P31" ) ) ;
7275 }
7376
77+ [ Test ]
78+ public void GenerateHeader_WithNoAssignedLedIndices_SetsNeoCountToZero ( )
79+ {
80+ var configuration = new ConfigurationDefinition (
81+ new List < ButtonBinding >
82+ {
83+ new ButtonBinding ( 1 , true , - 1 , false , false , new HidSequenceBinding ( "a" , 0 ) )
84+ } ,
85+ Array . Empty < EncoderBinding > ( ) ,
86+ DebugMode : false ,
87+ NeoPixelPin : 34 ) ;
88+
89+ var result = Generator . GenerateHeader ( configuration ) ;
90+
91+ Assert . That ( result , Does . Contain ( "#define NEO_COUNT 0" ) ) ;
92+ Assert . That ( result , Does . Not . Contain ( "#define PIN_NEO" ) ) ;
93+ Assert . That ( result , Does . Not . Contain ( "#define NEO_GRB" ) ) ;
94+ }
95+
7496 [ Test ]
7597 public void GenerateHeader_WithDebugMode_EmitsFlag ( )
7698 {
@@ -121,33 +143,33 @@ public void GenerateSource_WithFourButtons_WritesExpectedConfiguration()
121143 var buttons = new List < ButtonBinding >
122144 {
123145 new ButtonBinding (
124- Pin : 10 ,
146+ Pin : 15 ,
125147 ActiveLow : true ,
126148 LedIndex : 0 ,
127- BootloaderOnBoot : false ,
128- BootloaderChordMember : false ,
129- Function : new HidSequenceBinding ( "x " , 0 ) ) ,
149+ BootloaderOnBoot : true ,
150+ BootloaderChordMember : true ,
151+ Function : new HidSequenceBinding ( "1 " , 0 ) ) ,
130152 new ButtonBinding (
131- Pin : 12 ,
153+ Pin : 16 ,
132154 ActiveLow : true ,
133155 LedIndex : 1 ,
134- BootloaderOnBoot : false ,
156+ BootloaderOnBoot : true ,
135157 BootloaderChordMember : true ,
136- Function : new HidSequenceBinding ( "y " , 0 ) ) ,
158+ Function : new HidSequenceBinding ( "2 " , 0 ) ) ,
137159 new ButtonBinding (
138- Pin : 14 ,
139- ActiveLow : false ,
160+ Pin : 17 ,
161+ ActiveLow : true ,
140162 LedIndex : 2 ,
141- BootloaderOnBoot : false ,
142- BootloaderChordMember : false ,
143- Function : new HidSequenceBinding ( "Enter " , 2 ) ) ,
163+ BootloaderOnBoot : true ,
164+ BootloaderChordMember : true ,
165+ Function : new HidSequenceBinding ( "3 " , 0 ) ) ,
144166 new ButtonBinding (
145- Pin : 15 ,
146- ActiveLow : false ,
147- LedIndex : - 1 ,
167+ Pin : 11 ,
168+ ActiveLow : true ,
169+ LedIndex : 3 ,
148170 BootloaderOnBoot : true ,
149171 BootloaderChordMember : true ,
150- Function : new HidFunctionBinding ( "hid_consumer_volume_down" ) )
172+ Function : new HidSequenceBinding ( "4" , 0 ) )
151173 } ;
152174
153175 var configuration = new ConfigurationDefinition ( buttons , Array . Empty < EncoderBinding > ( ) , DebugMode : false , NeoPixelPin : 34 ) ;
@@ -164,11 +186,11 @@ public void GenerateSource_WithTwoButtonModule_WritesExpectedConfiguration()
164186 {
165187 var buttons = new List < ButtonBinding >
166188 {
167- new ButtonBinding ( 32 , true , 0 , false , false , new HidSequenceBinding ( "1" , 0 ) ) ,
168- new ButtonBinding ( 14 , true , 1 , false , false , new HidSequenceBinding ( "2" , 0 ) )
189+ new ButtonBinding ( 32 , true , - 1 , true , true , new HidSequenceBinding ( "1" , 0 ) ) ,
190+ new ButtonBinding ( 14 , true , - 1 , true , true , new HidSequenceBinding ( "2" , 0 ) )
169191 } ;
170192
171- var configuration = new ConfigurationDefinition ( buttons , Array . Empty < EncoderBinding > ( ) , DebugMode : false , NeoPixelPin : 34 ) ;
193+ var configuration = new ConfigurationDefinition ( buttons , Array . Empty < EncoderBinding > ( ) , DebugMode : false , NeoPixelPin : - 1 ) ;
172194
173195 var expected = ReadExpected ( "generate_source_2_button_module.c" ) ;
174196
0 commit comments