From 1113858df6a6b8c8c93afac0e1f788942db70c9f Mon Sep 17 00:00:00 2001 From: David Allison <62114487+david-allison@users.noreply.github.com> Date: Fri, 16 Feb 2024 14:13:41 +0000 Subject: [PATCH] test: fix OutOfMemoryError: Java heap space on macos: ``` at com.ichi2.anki.dialogs.CreateDeckDialogTest.setUp(CreateDeckDialogTest.kt:52) Caused by: java.lang.OutOfMemoryError: Java heap space at java.desktop/java.awt.image.DataBufferInt.(DataBufferInt.java:77) at java.desktop/java.awt.image.Raster.createPackedRaster(Raster.java:538) at java.desktop/java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1032) at java.desktop/java.awt.image.BufferedImage.(BufferedImage.java:333) at org.robolectric.shadows.ShadowBitmapFactory.create(ShadowBitmapFactory.java:287) at org.robolectric.shadows.ShadowBitmapFactory.decodeStream(ShadowBitmapFactory.java:189) at org.robolectric.shadows.ShadowBitmapFactory.decodeStream(ShadowBitmapFactory.java:153) ``` https://redirect.github.com/ankidroid/Anki-Android/pull/15520#issuecomment-1948416566 --- .../java/com/ichi2/anki/dialogs/CreateDeckDialogTest.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CreateDeckDialogTest.kt b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CreateDeckDialogTest.kt index 54a3d7a3c05d..9c3f2ffd4715 100644 --- a/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CreateDeckDialogTest.kt +++ b/AnkiDroid/src/test/java/com/ichi2/anki/dialogs/CreateDeckDialogTest.kt @@ -30,6 +30,7 @@ import com.ichi2.anki.dialogs.CreateDeckDialog.DeckDialogType import com.ichi2.anki.dialogs.utils.input import com.ichi2.libanki.DeckId import com.ichi2.utils.positiveButton +import okhttp3.internal.closeQuietly import org.hamcrest.CoreMatchers.equalTo import org.hamcrest.MatcherAssert.* import org.junit.Test @@ -54,6 +55,11 @@ class CreateDeckDialogTest : RobolectricTest() { } } + override fun tearDown() { + super.tearDown() + activityScenario.closeQuietly() + } + @Test fun testCreateFilteredDeckFunction() { val deckName = "filteredDeck"