package navaid;
import OUNPPMTest.TestFramework.*;
import org.junit.Test;
import javax.swing.JFrame;
import static org.assertj.swing.launcher.ApplicationLauncher.application;
import static OUNPPMTest.SwingElements.Finder.JMWindowFinder.findFrame;
import OUNPPMTest.SwingElements.Matcher.FrameMatchers;
import java.io.File;
import OUNPPMTest.SwingElements.Matcher.ButtonMatchers;
import OUNPPMTest.SwingElements.Matcher.DialogMatchers;
import static OUNPPMTest.TestFramework.OperatorHelpers.TargetFileChooserAtFile;
import org.assertj.swing.data.TableCell;
public class NAVAIDView_VOR_111ChangeEPosition_Test extends SwingJUnitTestCase{
	@Override
	protected void prepare(){
		application(NAVAIDApp.class).withArgs(new String[]{"SINGLE_THREAD_MODE"}).start();
		windowFrame = findFrame(FrameMatchers.containsTitle("OU Navaids Performance Prediction Model,")).withTimeout(10000).using(robot());
		windowFrame.focus();
		windowFrame.menuItem("fileMenu").click();
		windowFrame.menuItem("jNewModel").click();
		windowFrame.menuItem("jMnuNewVOR").click();
		windowFrame.tabbedPane("jTabs").selectTab("VOR Model");
		windowFrame.comboBox("jCboVORType").selectItem("Conventional");
		windowFrame.comboBox("jCboVORFreq").selectItem("108.0");
		windowFrame.textBox("jtxtVORPosNorth").enterText("0 ft");
		windowFrame.textBox("jtxtVORPosEast").enterText("0 ft");
		windowFrame.textBox("jtxtVORGroundElevation").enterText("0 ft");
		windowFrame.textBox("jtxtVORAntennaHeight").enterText("4 ft");
		windowFrame.textBox("jtxtVORCounterpoisePosHeight").enterText("12 ft");
		windowFrame.textBox("jtxtVORCounterpoisePosRadius").enterText("26 ft");
		windowFrame.textBox("jtxtVORMagneticVariation").enterText("0 deg");
		windowFrame.tabbedPane("jTabs").selectTab("Scatterers");
		windowFrame.button("jButOpenScattererGroup").click();
		TargetFileChooserAtFile(windowFrame, "A380_VOR.PSC", "para", false);
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatGrpED").cell(TableCell.row(0).column(windowFrame.table("jTableScatGrpED").columnIndexFor("N Offset (ft)"))).enterValue("0");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatGrpED").cell(TableCell.row(0).column(windowFrame.table("jTableScatGrpED").columnIndexFor("E Offset (ft)"))).enterValue("1000");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatGrpED").cell(TableCell.row(0).column(windowFrame.table("jTableScatGrpED").columnIndexFor("Ground Elevation (ft)"))).enterValue("0");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatGrpED").cell(TableCell.row(0).column(windowFrame.table("jTableScatGrpED").columnIndexFor("Base Elevation (ft)"))).enterValue("0");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatGrpED").cell(TableCell.row(0).column(windowFrame.table("jTableScatGrpED").columnIndexFor("Angle(deg)"))).enterValue("0");
		this.setDefaultDelayBetweenEvents();
		windowFrame.tabbedPane("jTabs").selectTab("Flight Editor");
		windowFrame.list("jListFPVORFlightList").selectItem(0);
		windowFrame.textBox("jtxtFPVOROrbitalStartRadial").enterText("0 deg");
		windowFrame.textBox("jtxtFPVOROrbitalStartRange").enterText("10 nmi");
		windowFrame.textBox("jtxtFPVOROrbitalStepSize").enterText("0.1 deg");
		windowFrame.textBox("jtxtFPVOROrbitalStopRadial").enterText("360 deg");
		windowFrame.textBox("jtxtFPVOROrbitalStartAlt").enterText("3000 ft");
		windowFrame.textBox("jtxtFPVORSpeed").enterText("140 knots");
		windowFrame.tabbedPane("jTabs").selectTab("Traces");
		windowFrame.radioButton("jRadioButtonOrbital").click();
		windowFrame.radioButton("jRadioButtonFilterFAA").click();
	}
	@Test
	public void test111ChangeEPosition(){
		windowFrame.tabbedPane("jTabs").selectTab("VOR Model");
		windowFrame.textBox("jtxtVORPosEast").enterText("600 ft");
		windowFrame.button("jButSaveModel").click();
		TargetFileChooserAtFile(windowFrame, "1997.111ChangeEPosition.dat", true);
		windowFrame.button("jButRunSimulation").click();
	}
}
