Testing optical encoders