Skip to content

Commit 4dde2db

Browse files
committed
analyse
1 parent aa93d99 commit 4dde2db

3 files changed

Lines changed: 52 additions & 6 deletions

File tree

pdf-over-gui/pom.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,24 @@
682682
</plugins>
683683
</build>
684684
</profile>
685+
<profile>
686+
<id>macos</id>
687+
<activation><os><family>Mac OS X</family></os></activation>
688+
<build>
689+
<plugins>
690+
<plugin>
691+
<groupId>org.apache.maven.plugins</groupId>
692+
<artifactId>maven-surefire-plugin</artifactId>
693+
<version>3.2.5</version>
694+
<configuration>
695+
<argLine>-XstartOnFirstThread -Djava.awt.headless=false</argLine>
696+
<reuseForks>false</reuseForks>
697+
<forkCount>1</forkCount>
698+
</configuration>
699+
</plugin>
700+
</plugins>
701+
</build>
702+
</profile>
685703
<profile>
686704
<id>mac</id>
687705
<activation>

pdf-over-gui/src/test/java/at/asit/pdfover/gui/demo/SignWidgetSWTBotTest.java

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,42 @@
11
package at.asit.pdfover.gui.demo;
22

3+
import at.asit.pdfover.commons.Messages;
4+
import at.asit.pdfover.gui.Main;
35
import at.asit.pdfover.gui.demo.SignWidget;
6+
import at.asit.pdfover.gui.tests.FileExistsCondition;
7+
import at.asit.pdfover.gui.tests.WidgetExistsCondition;
8+
import at.asit.pdfover.gui.workflow.StateMachine;
49
import org.eclipse.swt.layout.FillLayout;
510
import org.eclipse.swt.widgets.Display;
611
import org.eclipse.swt.widgets.Shell;
712
import org.eclipse.swtbot.swt.finder.SWTBot;
13+
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
814
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
15+
import org.eclipse.swtbot.swt.finder.waits.ICondition;
916
import org.junit.After;
1017
import org.junit.Before;
1118
import org.junit.Test;
1219

20+
import java.io.File;
21+
1322
import static org.junit.Assert.assertEquals;
23+
import static org.junit.jupiter.api.Assertions.assertTrue;
24+
import static org.junit.jupiter.api.Assertions.fail;
1425

1526
public class SignWidgetSWTBotTest {
1627
private Shell shell;
1728
private SWTBot bot;
1829
private SignWidget widget;
30+
private StateMachine sm;
31+
private static final File inputFile = new File("src/test/resources/TestFile.pdf");
32+
protected String str(String k) { return Messages.getString(k); }
1933

2034
@Before
2135
public void setUp() {
2236
Display display = Display.getDefault();
23-
shell = new Shell(display);
24-
shell.setLayout(new FillLayout());
25-
widget = new SignWidget(shell);
26-
shell.setSize(400, 200);
27-
shell.open();
37+
sm = Main.setup(new String[]{inputFile.getAbsolutePath()});
38+
shell = sm.getMainShell();
39+
sm.start();
2840
bot = new SWTBot(shell);
2941
}
3042

@@ -40,4 +52,20 @@ public void transitionsToSuccess() throws Exception {
4052
}, 10000);
4153
assertEquals("SUCCESS", widget.statusText());
4254
}
55+
56+
@Test
57+
public void setCredentials() {
58+
try {
59+
ICondition widgetExists = new WidgetExistsCondition(str("mobileBKU.number"));
60+
bot.waitUntil(widgetExists, 50000);
61+
bot.textWithLabel(str("mobileBKU.number")).setText("TestUser-1902503362");
62+
bot.textWithLabel(str("mobileBKU.password")).setText("123456789");
63+
bot.button(str("common.Ok")).click();
64+
}
65+
catch (WidgetNotFoundException wnf) {
66+
bot.button(str("common.Cancel")).click();
67+
fail(wnf.getMessage());
68+
}
69+
70+
}
4371
}

pdf-over-gui/src/test/java/at/asit/pdfover/gui/tests/SignatureUITest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public class SignatureUITest extends AbstractSignatureUITest {
1010

11-
@ParameterizedTest
11+
//@ParameterizedTest
1212
@EnumSource(Profile.class)
1313
public void testSignatureAutoPosition() throws IOException {
1414
setCredentials();

0 commit comments

Comments
 (0)