Skip to content

Commit

Permalink
Merge pull request #29 from strangelookingnerd/upgrade_template
Browse files Browse the repository at this point in the history
Upgrade to template 2.0.1
  • Loading branch information
strangelookingnerd committed Aug 12, 2024
2 parents 754935d + bfab86a commit b8873bd
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 19 deletions.
31 changes: 17 additions & 14 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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=<!--999.999-->",
"-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=<!--999.999-->",
"-Djb.consents.confirmation.enabled=false",
)
}
}

plugins {
robotServerPlugin(Constraints.LATEST_VERSION)
plugins {
robotServerPlugin()
}
}
}
}
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));

Expand All @@ -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() {
Expand Down Expand Up @@ -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 extends Element> E get(@NotNull CoroutineContext.Key<E> key) {
return null;
}

@Override
public <R> R fold(R r, @NotNull Function2<? super R, ? super Element, ? extends R> function2) {
return null;
}

@Override
public @NotNull CoroutineContext plus(@NotNull CoroutineContext coroutineContext) {
return this;
}

@Override
public @NotNull CoroutineContext minusKey(@NotNull CoroutineContext.Key<?> key) {
return this;
}
}
}

0 comments on commit b8873bd

Please sign in to comment.