-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/331-cobigen-urls
- Loading branch information
Showing
15 changed files
with
285 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...c/test/java/com/devonfw/tools/ide/completion/CompletionCandidateCollectorDefaultTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.devonfw.tools.ide.completion; | ||
|
||
import com.devonfw.tools.ide.commandlet.Commandlet; | ||
import com.devonfw.tools.ide.commandlet.VersionCommandlet; | ||
import com.devonfw.tools.ide.context.AbstractIdeContextTest; | ||
import com.devonfw.tools.ide.context.IdeContext; | ||
import com.devonfw.tools.ide.context.IdeTestContextMock; | ||
import com.devonfw.tools.ide.property.Property; | ||
import com.devonfw.tools.ide.property.VersionProperty; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class CompletionCandidateCollectorDefaultTest extends AbstractIdeContextTest { | ||
|
||
/** | ||
* Test of {@link CompletionCandidateCollectorDefault#addAllMatches(String, String[], Property, Commandlet)} | ||
*/ | ||
@Test | ||
public void testAddAllMatches() { | ||
|
||
String[] sortedCandidates = { "1", "2.0", "2.1", "3" }; | ||
String input = "2"; | ||
String[] expectedCandidates = { "2.0", "2.1" }; | ||
|
||
VersionProperty versionProperty = new VersionProperty("", false, "version"); | ||
IdeContext context = IdeTestContextMock.get(); | ||
CompletionCandidateCollector collector = new CompletionCandidateCollectorDefault(context); | ||
|
||
int matches = collector.addAllMatches(input, sortedCandidates, versionProperty, new VersionCommandlet(context)); | ||
|
||
assertThat(matches).isEqualTo(2); | ||
assertThat(collector.getCandidates().stream().map(CompletionCandidate::text)).containsExactly(expectedCandidates); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>com.devonfw.tools.IDEasy.dev</groupId> | ||
<artifactId>ide</artifactId> | ||
<version>dev-SNAPSHOT</version> | ||
<relativePath>../pom.xml</relativePath> | ||
</parent> | ||
<groupId>com.devonfw.tools.IDEasy</groupId> | ||
<artifactId>gui</artifactId> | ||
<version>${revision}</version> | ||
<name>gui</name> | ||
|
||
<properties> | ||
<mainClass>com.devonfw.ide.gui.AppLauncher</mainClass> | ||
<javafx.version>21</javafx.version> | ||
<testfx.version>4.0.18</testfx.version> | ||
<javafx.maven.plugin.version>0.0.8</javafx.maven.plugin.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>ide-cli</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openjfx</groupId> | ||
<artifactId>javafx-controls</artifactId> | ||
<version>${javafx.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.openjfx</groupId> | ||
<artifactId>javafx-fxml</artifactId> | ||
<version>${javafx.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testfx</groupId> | ||
<artifactId>testfx-core</artifactId> | ||
<version>${testfx.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testfx</groupId> | ||
<artifactId>testfx-junit5</artifactId> | ||
<version>${testfx.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.testfx</groupId> | ||
<artifactId>openjfx-monocle</artifactId> | ||
<version>17.0.10</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.openjfx</groupId> | ||
<artifactId>javafx-maven-plugin</artifactId> | ||
<version>${javafx.maven.plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<configuration> | ||
<mainClass>${mainClass}</mainClass> | ||
<launcher>app</launcher> | ||
<jlinkZipName>app</jlinkZipName> | ||
<jlinkImageName>app</jlinkImageName> | ||
<noManPages>true</noManPages> | ||
<stripDebug>true</stripDebug> | ||
<noHeaderFiles>true</noHeaderFiles> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.devonfw.ide.gui; | ||
|
||
import com.devonfw.tools.ide.version.IdeVersion; | ||
import javafx.application.Application; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.geometry.Rectangle2D; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
import javafx.stage.Screen; | ||
import javafx.stage.Stage; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* GUI Application for IDEasy | ||
*/ | ||
public class App extends Application { | ||
|
||
Parent root; | ||
|
||
@Override | ||
public void start(Stage primaryStage) throws IOException { | ||
|
||
root = FXMLLoader.load(App.class.getResource("main-view.fxml")); | ||
|
||
Rectangle2D bounds = Screen.getPrimary().getVisualBounds(); | ||
Scene scene = new Scene(root, bounds.getWidth() / 2, bounds.getHeight() / 2); | ||
|
||
primaryStage.setTitle("IDEasy - version " + IdeVersion.get()); | ||
primaryStage.setScene(scene); | ||
primaryStage.show(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
|
||
launch(args); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.devonfw.ide.gui; | ||
|
||
/** | ||
* Launcher class for the App. | ||
* Workaround for "Error: JavaFX runtime components are missing, and are required to run this application." | ||
* Inspired by | ||
* <ahref=https://stackoverflow.com/questions/56894627/how-to-fix-error-javafx-runtime-components-are-missing-and-are-required-to-ru>StackOverflow</a> | ||
*/ | ||
public class AppLauncher { | ||
public static void main(final String[] args) { | ||
|
||
App.main(args); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.geometry.Insets?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.layout.VBox?> | ||
<VBox alignment="CENTER" spacing="20.0" xmlns:fx="http://javafx.com/fxml"> | ||
<padding> | ||
<Insets bottom="20.0" left="20.0" right="20.0" top="20.0"/> | ||
</padding> | ||
|
||
<Label text="welcome to IDEasy" fx:id="hellomessage"/> | ||
<!--Button text="Hello!" onAction="#onHelloButtonClick"/--> | ||
</VBox> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package com.devonfw.ide.gui; | ||
|
||
import javafx.stage.Stage; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.Test; | ||
import org.testfx.framework.junit5.ApplicationTest; | ||
import org.testfx.matcher.base.NodeMatchers; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.testfx.api.FxAssert.verifyThat; | ||
|
||
/** | ||
* Base Test | ||
*/ | ||
public class AppBaseTest extends ApplicationTest { | ||
|
||
@Override | ||
public void start(Stage stage) throws IOException { | ||
|
||
new App().start(stage); | ||
} | ||
|
||
/** | ||
* Set up headless testing | ||
* | ||
* @throws IOException | ||
*/ | ||
@BeforeAll | ||
public static void setupHeadlessMode() { | ||
|
||
//Enable headless testing. Should be moved as a system property "-Dheadless=true" into workflows to only affect CI | ||
System.setProperty("headless", "true"); | ||
|
||
if (Boolean.getBoolean("headless")) { | ||
System.setProperty("testfx.robot", "glass"); | ||
System.setProperty("glass.platform", "Monocle"); | ||
System.setProperty("testfx.headless", "true"); | ||
System.setProperty("prism.order", "sw"); | ||
System.setProperty("java.awt.headless", "true"); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* Test if welcome message is shown when GUI is started | ||
*/ | ||
@Test | ||
public void ensureHelloMessageIsShownOnStartUp() { | ||
|
||
verifyThat("#hellomessage", NodeMatchers.isNotNull()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters