diff options
| author | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-15 14:21:53 +0200 |
|---|---|---|
| committer | Stefan Suhren <suhren.stefan@fh-swf.de> | 2015-06-15 14:21:53 +0200 |
| commit | 9f621c337166ccb83ab9e9422444323cf6700282 (patch) | |
| tree | e86b5bea25ad6d23efece4adf83602ec10309cb8 /test/gui | |
| parent | 96b0868fb4a95ceabd4aeda992f6a90a44ae521f (diff) | |
| download | UpnFx-9f621c337166ccb83ab9e9422444323cf6700282.tar.gz UpnFx-9f621c337166ccb83ab9e9422444323cf6700282.zip | |
Add testing capabilities to the project
Diffstat (limited to 'test/gui')
| -rw-r--r-- | test/gui/CalculatorTest.java | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/test/gui/CalculatorTest.java b/test/gui/CalculatorTest.java new file mode 100644 index 0000000..77d3371 --- /dev/null +++ b/test/gui/CalculatorTest.java @@ -0,0 +1,144 @@ +/* + * $RCSFile$ + * + * Created on 07.01.2010 + * for Project: + * by steins + * + * (C) 2005-2006 by + */ +package gui; + +//import gui.CalculatorFrame; + +import static org.loadui.testfx.Assertions.verifyThat; +import static org.loadui.testfx.controls.Commons.hasText; + +import java.io.IOException; +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.scene.control.Button; + +import org.junit.Test; +import org.loadui.testfx.GuiTest; + +public class CalculatorTest extends GuiTest +{ + @Override + public Parent getRootNode() + { + try + { + return FXMLLoader + .load(CalculatorTest.class + .getResource("/de/fhswf/in/inf/upnfx/view/MainView.fxml")); + } + catch (IOException e) + { + throw new IllegalStateException(e); + } + } + + @Test + public void testNullAndComma() + { + Button button = find("#0"); + click(button); + button = find("#0"); + click(button); + button = find("#,"); + click(button); + button = find("#,"); + click(button); + button = find("#0"); + click(button); + button = find("#0"); + click(button); + button = find("#1"); + click(button); + verifyThat("#display", hasText("0.001")); + } + + @Test + public void testNumbers() + { + Button button = find("#0"); + click(button); + button = find("#1"); + click(button); + button = find("#2"); + click(button); + button = find("#3"); + click(button); + button = find("#4"); + click(button); + button = find("#5"); + click(button); + button = find("#6"); + click(button); + button = find("#7"); + click(button); + button = find("#8"); + click(button); + button = find("#9"); + click(button); + verifyThat("#display", hasText("123456789")); + } + + @Test + public void testAdd() + { + Button button = find("#1"); + click(button); + button = find("#ENT"); + click(button); + button = find("#2"); + click(button); + button = find("#+"); + click(button); + verifyThat("#display", hasText("3.0")); + } + + @Test + public void testSub() + { + Button button = find("#1"); + click(button); + button = find("#ENT"); + click(button); + button = find("#2"); + click(button); + button = find("#-"); + click(button); + verifyThat("#display", hasText("-1.0")); + } + + @Test + public void testMul() + { + Button button = find("#3"); + click(button); + button = find("#ENT"); + click(button); + button = find("#2"); + click(button); + button = find("#*"); + click(button); + verifyThat("#display", hasText("6.0")); + } + + @Test + public void testDiv() + { + Button button = find("#1"); + click(button); + button = find("#ENT"); + click(button); + button = find("#2"); + click(button); + button = find("#/"); + click(button); + verifyThat("#display", hasText("0.5")); + } + +} |
