[Enhancement] Improvements for debounce test coverage + bug fixes for sym_defer_g and sym_eager_pr (#21667)
Co-authored-by: Nebuleon <2391500+Nebuleon@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									dd94877ec6
								
							
						
					
					
						commit
						960d6e0d7d
					
				
					 15 changed files with 458 additions and 23 deletions
				
			
		| 
						 | 
				
			
			@ -392,3 +392,32 @@ TEST_F(DebounceTest, OneKeyDelayedScan8) {
 | 
			
		|||
    time_jumps_ = true;
 | 
			
		||||
    runEvents();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TEST_F(DebounceTest, AsyncTickOneKeyShort1) {
 | 
			
		||||
    addEvents({
 | 
			
		||||
        /* Time, Inputs, Outputs */
 | 
			
		||||
        {0, {{0, 1, DOWN}}, {{0, 1, DOWN}}},
 | 
			
		||||
        /* Release key after 1ms delay */
 | 
			
		||||
        {1, {{0, 1, UP}}, {}},
 | 
			
		||||
 | 
			
		||||
        /*
 | 
			
		||||
         * Until the eager timer on DOWN is observed to finish, the defer timer
 | 
			
		||||
         * on UP can't start. There's no workaround for this because it's not
 | 
			
		||||
         * possible to debounce an event that isn't being tracked.
 | 
			
		||||
         *
 | 
			
		||||
         * sym_defer_pk has the same problem but the test has to track that the
 | 
			
		||||
         * key changed state so the DOWN timer is always allowed to finish
 | 
			
		||||
         * before starting the UP timer.
 | 
			
		||||
         */
 | 
			
		||||
        {5, {}, {}},
 | 
			
		||||
 | 
			
		||||
        {10, {}, {{0, 1, UP}}}, /* 5ms+5ms after DOWN at time 0 */
 | 
			
		||||
        /* Press key again after 1ms delay */
 | 
			
		||||
        {11, {{0, 1, DOWN}}, {{0, 1, DOWN}}},
 | 
			
		||||
    });
 | 
			
		||||
    /*
 | 
			
		||||
     * Debounce implementations should never read the timer more than once per invocation
 | 
			
		||||
     */
 | 
			
		||||
    async_time_jumps_ = DEBOUNCE;
 | 
			
		||||
    runEvents();
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue