Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support GUI test #964

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/gradle-build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
name: Setup Gradle
id: setup-gradle
- name: Run gradle build
run: xvfb-run -a --server-args='-screen 0, 1024x768x24' ./gradlew -PenvIsCi --scan build
run: xvfb-run -a --server-args='-screen 0, 1024x768x24' ./gradlew -PenvIsCi --scan build testAcceptance
id: gradle
- name: "Add Build Scan URL as PR comment"
uses: actions/github-script@v7
Expand Down
4 changes: 2 additions & 2 deletions src/org/omegat/convert/ConvertConfigs.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import java.io.File;

import org.omegat.convert.v20to21.Convert20to21;
import org.omegat.gui.main.MainWindowUI;
import org.omegat.gui.main.MainWindow;
import org.omegat.util.Log;
import org.omegat.util.StaticUtils;

Expand All @@ -53,7 +53,7 @@ public static void convert() {
}
}

File newUI = new File(StaticUtils.getConfigDir(), MainWindowUI.UI_LAYOUT_FILE);
File newUI = new File(StaticUtils.getConfigDir(), MainWindow.UI_LAYOUT_FILE);
if (!newUI.exists()) {
try {
ConvertTo213.convertUIConfig(newUI);
Expand Down
46 changes: 30 additions & 16 deletions src/org/omegat/core/Core.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,12 @@ public static void setSegmenter(Segmenter newSegmenter) {
* <p>
* An interface that was introduced in v5.6.0 when supporting theme plugin.
*
* @param cl class loader.
* @param params CLI parameters.
* @throws Exception when error occurred.
* @param cl
* class loader.
* @param params
* CLI parameters.
* @throws Exception
* when error occurred.
*/
@Deprecated(since = "6.1.0")
@SuppressWarnings("unused")
Expand All @@ -252,14 +255,29 @@ public static void initializeGUI(final Map<String, String> params) throws Except
// 3. Initialize application frame
MainWindow me = new MainWindow();
mainWindow = me;
initializeGUIimpl(me);

SaveThread th = new SaveThread();
saveThread = th;
th.start();

new VersionCheckThread(10).start();
}

/**
* initialize GUI for test.
*
* @throws Exception
*/
static void initializeGUIimpl(IMainWindow me) throws Exception {
MarkerController.init();
LanguageToolWrapper.init();

segmenter = new Segmenter(Preferences.getSRX());
filterMaster = new FilterMaster(Preferences.getFilters());

// 4. Initialize other components. They add themselves to the main window.
// 4. Initialize other components.
// They add themselves to the main window.
editor = new EditorController(me);
tagValidation = new TagValidationTool();
issuesWindow = new IssuesPanelController(me.getApplicationFrame());
Expand All @@ -274,12 +292,6 @@ public static void initializeGUI(final Map<String, String> params) throws Except
multiple = new MultipleTransPane(me);
new SegmentPropertiesArea(me);
projWin = new ProjectFilesListController();

SaveThread th = new SaveThread();
saveThread = th;
th.start();

new VersionCheckThread(10).start();
}

/**
Expand Down Expand Up @@ -346,7 +358,9 @@ public static void registerTokenizerClass(Class<? extends ITokenizer> clazz) {

/**
* Register spellchecker plugin.
* @param clazz spellchecker class.
*
* @param clazz
* spellchecker class.
*/
public static void registerSpellCheckClass(Class<? extends ISpellChecker> clazz) {
PluginUtils.getSpellCheckClasses().add(clazz);
Expand All @@ -369,18 +383,18 @@ public static void pluginLoadingError(String errorText) {
/**
* Use this to perform operations that must not be run concurrently.
* <p>
* For instance project load/save/compile/autosave operations must not be executed in parallel because it will break
* project files, especially during team synchronization. For guaranteed non-parallel execution, all such operations
* must be executed via this method.
* For instance project load/save/compile/autosave operations must not be
* executed in parallel because it will break project files, especially
* during team synchronization. For guaranteed non-parallel execution, all
* such operations must be executed via this method.
*
* @param waitForUnlock
* should execution wait for unlock 3 minutes
* @param run
* code for execute
* @throws Exception
*/
public static void executeExclusively(boolean waitForUnlock, RunnableWithException run)
throws Exception {
public static void executeExclusively(boolean waitForUnlock, RunnableWithException run) throws Exception {
if (!EXCLUSIVE_RUN_LOCK.tryLock(waitForUnlock ? 180000 : 1, TimeUnit.MILLISECONDS)) {
Exception ex = new TimeoutException("Timeout waiting for previous exclusive execution");
Exception cause = new Exception("Previous exclusive execution");
Expand Down
2 changes: 1 addition & 1 deletion src/org/omegat/core/data/RealProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ private void loadSourceFiles() throws IOException {

findNonUniqueSegments();

if (errorSrcList.size() > 0) {
if (!errorSrcList.isEmpty()) {
Core.getMainWindow().showStatusMessageRB("CT_LOAD_SRC_SKIP_FILES");
} else {
Core.getMainWindow().showStatusMessageRB("CT_LOAD_SRC_COMPLETE");
Expand Down
1 change: 1 addition & 0 deletions src/org/omegat/gui/dialogs/AboutDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
import javax.swing.JDialog;

import org.apache.commons.io.IOUtils;

import org.omegat.help.Help;
import org.omegat.util.MemoryUtils;
import org.omegat.util.OConsts;
Expand Down
3 changes: 2 additions & 1 deletion src/org/omegat/gui/dialogs/LicenseDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
import java.nio.charset.StandardCharsets;

import org.apache.commons.io.IOUtils;
import org.openide.awt.Mnemonics;

import org.omegat.help.Help;
import org.omegat.util.OConsts;
import org.omegat.util.OStrings;
import org.omegat.util.gui.StaticUIUtils;
import org.openide.awt.Mnemonics;

/**
* Dialog showing GNU Public License.
Expand Down
Loading
Loading