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_Plategroupeditor_122ChangeTiltAngle_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("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();
		windowFrame.tabbedPane("jTabs").selectTab("Scatterers");
		windowFrame.button("jButOpenSGEditor").click();
		windowFrame = findFrame(SGEditor.class).using(robot());
		windowFrame.focus();
		windowFrame.radioButton("jRdoVORPlate").click();
		windowFrame.radioButton("jRdoModelOffset").click();
		windowFrame.button("jButAddPlate").click();
		windowFrame.maximize();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("N1(ft)"))).enterValue("500");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("E1(ft)"))).enterValue("100");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("N2(ft)"))).enterValue("200");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("E2(ft)"))).enterValue("500");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("Gnd Elevation(ft)"))).enterValue("0");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("Base Height(ft)"))).enterValue("0");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("Height(ft)"))).enterValue("50");
		this.setDefaultDelayBetweenEvents();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("Tilt Angle(deg)"))).enterValue("0");
		this.setDefaultDelayBetweenEvents();
		windowFrame.button("jButSaveScatterer").click();
		TargetFileChooserAtFile(windowFrame, "1997.Test_plate_1_VOR.dat", true);
		windowFrame.close();
		windowFrame = findFrame(FrameMatchers.containsTitle("OU Navaids Performance Prediction Model,")).withTimeout(10000).using(robot());
		windowFrame.focus();
		windowFrame.button("jButOpenScattererGroup").click();
		TargetFileChooserAtFile(windowFrame, "Test_plate_1_VOR.PSC", "para", false);
	}
	@Test
	public void test122ChangeTiltAngle(){
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatGrpED").cell(TableCell.row(0).column(windowFrame.table("jTableScatGrpED").columnIndexFor("Type"))).click();
		this.setDefaultDelayBetweenEvents();
		windowFrame.button("jButEditSelectedScattererGroup").click();
		windowFrame = findFrame(SGEditor.class).using(robot());
		windowFrame.focus();
		windowFrame.maximize();
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatED").cell(TableCell.row(0).column(windowFrame.table("jTableScatED").columnIndexFor("Tilt Angle(deg)"))).enterValue("30");
		this.setDefaultDelayBetweenEvents();
		windowFrame.button("jButSaveScatterer").click();
		TargetFileChooserAtFile(windowFrame, "1997.Test_plate_1i_VOR.PSC:false", true);
		windowFrame.close();
		windowFrame = findFrame(FrameMatchers.containsTitle("OU Navaids Performance Prediction Model,")).withTimeout(10000).using(robot());
		windowFrame.focus();
		windowFrame.button("jButOpenScattererGroup").click();
		TargetFileChooserAtFile(windowFrame, "Test_plate_1i_VOR.PSC", "para", false);
		this.robot().settings().delayBetweenEvents(10);
		windowFrame.table("jTableScatGrpED").cell(TableCell.row(0).column(windowFrame.table("jTableScatGrpED").columnIndexFor("Type"))).click();
		this.setDefaultDelayBetweenEvents();
		windowFrame.button("jButRemoveScattererGroup").click();
		windowFrame.button("jButSaveModel").click();
		TargetFileChooserAtFile(windowFrame, "1997.122ChangeTiltAngle.dat", true);
		windowFrame.button("jButRunSimulation").click();
	}
}
