diff --git a/app/src/test/java/org/fdroid/fdroid/updater/AppIconsTest.java b/app/src/test/java/org/fdroid/fdroid/updater/AppIconsTest.java
new file mode 100644
index 000000000..e659549a6
--- /dev/null
+++ b/app/src/test/java/org/fdroid/fdroid/updater/AppIconsTest.java
@@ -0,0 +1,74 @@
+package org.fdroid.fdroid.updater;
+
+import android.content.ContentValues;
+import org.fdroid.fdroid.BuildConfig;
+import org.fdroid.fdroid.IndexUpdater;
+import org.fdroid.fdroid.data.App;
+import org.fdroid.fdroid.data.AppProvider;
+import org.fdroid.fdroid.data.Repo;
+import org.fdroid.fdroid.data.RepoProvider;
+import org.fdroid.fdroid.data.Schema;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.annotation.Config;
+
+import static org.junit.Assert.assertEquals;
+
+/**
+ * Check whether app icons are loaded from the correct repository. The repository with the
+ * highest priority should be where we decide to load icons from.
+ */
+@Config(constants = BuildConfig.class)
+@RunWith(RobolectricTestRunner.class)
+@SuppressWarnings("LineLength")
+public class AppIconsTest extends MultiIndexUpdaterTest {
+
+    private static final int HIGH_PRIORITY = 2;
+    private static final int LOW_PRIORITY = 1;
+
+    @Before
+    public void setupMainAndArchiveRepo() {
+        createRepo(REPO_MAIN, REPO_MAIN_URI, context);
+        createRepo(REPO_ARCHIVE, REPO_ARCHIVE_URI, context);
+    }
+
+    @Test
+    public void mainRepo() throws IndexUpdater.UpdateException {
+        setRepoPriority(REPO_MAIN_URI, HIGH_PRIORITY);
+        setRepoPriority(REPO_ARCHIVE_URI, LOW_PRIORITY);
+
+        updateMain();
+        updateArchive();
+
+        assertIconUrl("https://f-droid.org/repo/icons/org.adaway.54.png");
+    }
+
+    @Test
+    public void archiveRepo() throws IndexUpdater.UpdateException {
+        setRepoPriority(REPO_MAIN_URI, LOW_PRIORITY);
+        setRepoPriority(REPO_ARCHIVE_URI, HIGH_PRIORITY);
+
+        updateMain();
+        updateArchive();
+
+        assertIconUrl("https://f-droid.org/archive/icons/org.adaway.54.png");
+    }
+
+    private void setRepoPriority(String repoUri, int priority) {
+        ContentValues values = new ContentValues(1);
+        values.put(Schema.RepoTable.Cols.PRIORITY, priority);
+
+        Repo repo = RepoProvider.Helper.findByAddress(context, repoUri);
+        RepoProvider.Helper.update(context, repo, values);
+    }
+
+    private void assertIconUrl(String expectedUrl) {
+        App app = AppProvider.Helper.findHighestPriorityMetadata(context.getContentResolver(),
+                "org.adaway", new String[] {Schema.AppMetadataTable.Cols.ICON_URL});
+
+        assertEquals(app.iconUrl, expectedUrl);
+    }
+
+}