From bfab86a03acaa8b59e42d4182d689c757d49d640 Mon Sep 17 00:00:00 2001 From: strangelookingnerd <49242855+strangelookingnerd@users.noreply.github.com> Date: Mon, 12 Aug 2024 08:34:57 +0200 Subject: [PATCH] Upgrade to template 2.0.1 --- build.gradle.kts | 31 ++++++++------- gradle.properties | 4 +- .../PedroProgressBarListenerTest.java | 39 +++++++++++++++++-- 3 files changed, 55 insertions(+), 19 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c9e30c4..f5878d4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,6 +1,5 @@ import org.jetbrains.changelog.Changelog import org.jetbrains.changelog.markdownToHTML -import org.jetbrains.intellij.platform.gradle.Constants.Constraints import org.jetbrains.intellij.platform.gradle.TestFrameworkType plugins { @@ -145,19 +144,23 @@ tasks { } } -val runIdeForUiTests by intellijPlatformTesting.runIde.registering { - task { - jvmArgumentProviders += CommandLineArgumentProvider { - listOf( - "-Drobot-server.port=8082", - "-Dide.mac.message.dialogs.as.sheets=false", - "-Djb.privacy.policy.text=", - "-Djb.consents.confirmation.enabled=false", - ) - } - } +intellijPlatformTesting { + runIde { + register("runIdeForUiTests") { + task { + jvmArgumentProviders += CommandLineArgumentProvider { + listOf( + "-Drobot-server.port=8082", + "-Dide.mac.message.dialogs.as.sheets=false", + "-Djb.privacy.policy.text=", + "-Djb.consents.confirmation.enabled=false", + ) + } + } - plugins { - robotServerPlugin(Constraints.LATEST_VERSION) + plugins { + robotServerPlugin() + } + } } } diff --git a/gradle.properties b/gradle.properties index 68e9071..161d2fd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,12 +7,12 @@ pluginRepositoryUrl = https://github.com/strangelookingnerd/pedro-progress-bar-p pluginVersion = 0.0.5 # Supported build number ranges and IntelliJ Platform versions -> https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html -pluginSinceBuild = 232 +pluginSinceBuild = 233 pluginUntilBuild = 242.* # IntelliJ Platform Properties -> https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#configuration-intellij-extension platformType = IC -platformVersion = 2023.2.7 +platformVersion = 2023.3.7 # Plugin Dependencies -> https://plugins.jetbrains.com/docs/intellij/plugin-dependencies.html # Example: platformPlugins = com.jetbrains.php:203.4449.22, org.intellij.scala:2023.3.27@EAP diff --git a/src/test/java/com/github/strangelookingnerd/PedroProgressBarListenerTest.java b/src/test/java/com/github/strangelookingnerd/PedroProgressBarListenerTest.java index f1e64b8..3d249d6 100644 --- a/src/test/java/com/github/strangelookingnerd/PedroProgressBarListenerTest.java +++ b/src/test/java/com/github/strangelookingnerd/PedroProgressBarListenerTest.java @@ -29,6 +29,9 @@ import com.intellij.openapi.wm.IdeFrame; import com.intellij.openapi.wm.StatusBar; import com.intellij.ui.BalloonLayout; +import kotlin.coroutines.CoroutineContext; +import kotlin.jvm.functions.Function2; +import kotlinx.coroutines.CoroutineScope; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.jupiter.api.Test; @@ -61,7 +64,7 @@ void testUpdateProgressBar() { assertNull(UIManager.getDefaults().get(PedroProgressBarUI.class.getName())); // applicationActivated - listener.applicationActivated(new TestFrame()); + listener.applicationActivated(new TestIdeFrame()); assertEquals(PedroProgressBarUI.class.getName(), UIManager.get("ProgressBarUI")); assertEquals(PedroProgressBarUI.class, UIManager.getDefaults().get(PedroProgressBarUI.class.getName())); @@ -72,12 +75,12 @@ void testUpdateProgressBar() { assertNull(UIManager.getDefaults().get(PedroProgressBarUI.class.getName())); // lookAndFeelChanged - listener.lookAndFeelChanged(new LafManagerImpl()); + listener.lookAndFeelChanged(new LafManagerImpl(new TestCoroutineScope())); assertEquals(PedroProgressBarUI.class.getName(), UIManager.get("ProgressBarUI")); assertEquals(PedroProgressBarUI.class, UIManager.getDefaults().get(PedroProgressBarUI.class.getName())); } - private static class TestFrame implements IdeFrame { + private static class TestIdeFrame implements IdeFrame { @Override public @Nullable StatusBar getStatusBar() { @@ -110,4 +113,34 @@ public JComponent getComponent() { } } + private static class TestCoroutineScope implements CoroutineScope { + + @Override + public @NotNull CoroutineContext getCoroutineContext() { + return new TestCoroutineContext(); + } + } + + private static class TestCoroutineContext implements CoroutineContext { + + @Override + public @Nullable E get(@NotNull CoroutineContext.Key key) { + return null; + } + + @Override + public R fold(R r, @NotNull Function2 function2) { + return null; + } + + @Override + public @NotNull CoroutineContext plus(@NotNull CoroutineContext coroutineContext) { + return this; + } + + @Override + public @NotNull CoroutineContext minusKey(@NotNull CoroutineContext.Key key) { + return this; + } + } } \ No newline at end of file