private TestResult RunTestButtons() { int mpValue; int numKeys = 12; TestResult outputResult = new TestResult(resultList.Count, TestType.UserInterface, "Tests the input buttons"); //Test each individual key can be pressed for (int i = 0; i < numKeys; i++) { outputResult.AddCondition("Button " + i.ToString(), Operation.Equal, Math.Pow(2, i)); } //Iterate through key presses for (int i = 0; i < numKeys; i++) { DigitalOutput.OutputSignals nextButton = GetNextButton(i); //Simulate button press fixture.outputController.EnableOutput(nextButton, true); //Wait for signals to settle Thread.Sleep(DigitalOutput.SwitchingMs * 4); //Check MP value mpValue = fixture.device.GetMpValue("Which keys are pressed"); //Simulate button release fixture.outputController.EnableOutput(nextButton, false); //Save result outputResult.SetOutcome("Button " + i.ToString(), mpValue); } return(outputResult); }
private DigitalOutput.OutputSignals GetNextButton(int idx) { DigitalOutput.OutputSignals button = DigitalOutput.OutputSignals.ButtonDownSim; //Button order determined by firmware switch (idx) { case 0: button = DigitalOutput.OutputSignals.Button1Sim; break; case 1: button = DigitalOutput.OutputSignals.Button2Sim; break; case 2: button = DigitalOutput.OutputSignals.Button3Sim; break; case 3: button = DigitalOutput.OutputSignals.Button4Sim; break; case 4: button = DigitalOutput.OutputSignals.Button5Sim; break; case 5: button = DigitalOutput.OutputSignals.ButtonISim; break; case 6: button = DigitalOutput.OutputSignals.ButtonDownSim; break; case 7: button = DigitalOutput.OutputSignals.ButtonPlusSim; break; case 8: button = DigitalOutput.OutputSignals.ButtonMinusSim; break; case 9: button = DigitalOutput.OutputSignals.ButtonUpSim; break; case 10: button = DigitalOutput.OutputSignals.ButtonStartSim; break; case 11: button = DigitalOutput.OutputSignals.ButtonMuteSim; break; default: break; } return(button); }