From d002d8597a8a6eef63bbe429e754e60faab8d8b0 Mon Sep 17 00:00:00 2001
From: Florian Lugou <florian.lugou@telecom-paristech.fr>
Date: Tue, 13 Feb 2018 14:56:11 +0100
Subject: [PATCH] added icons to tests

---
 src/main/java/ui/util/IconManager.java     | 6 +++---
 ttool/src/main/java/Main.java              | 3 +--
 ttool/src/test/java/ui/AbstractUITest.java | 2 ++
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/main/java/ui/util/IconManager.java b/src/main/java/ui/util/IconManager.java
index 77134d062b..b15b9490b9 100755
--- a/src/main/java/ui/util/IconManager.java
+++ b/src/main/java/ui/util/IconManager.java
@@ -658,8 +658,8 @@ public class IconManager {
 
     }
 
-    public ImageIcon getIcon(String s) {
-        URL url = this.getClass().getResource(s);
+    public static ImageIcon getIcon(String s) {
+        URL url = IconManager.class.getResource(s);
 
         if (url != null) {
             return new ImageIcon(url);
@@ -680,7 +680,7 @@ public class IconManager {
         }
     }
 
-    public void loadImg() {
+    public static void loadImg() {
         imgic8 = getIcon(icon8);
         imgic9 = getIcon(icon9);
         if (imgic8 != null) {
diff --git a/ttool/src/main/java/Main.java b/ttool/src/main/java/Main.java
index 25ce697c95..c1eba3d541 100755
--- a/ttool/src/main/java/Main.java
+++ b/ttool/src/main/java/Main.java
@@ -242,8 +242,7 @@ public class Main implements ActionListener {
         if (splashFrame != null) {
             splashFrame.setMessage("Loading images");
         }
-        IconManager icma = new IconManager();
-        icma.loadImg();
+        IconManager.loadImg();
 
         // Loading configuration
         if (splashFrame != null) {
diff --git a/ttool/src/test/java/ui/AbstractUITest.java b/ttool/src/test/java/ui/AbstractUITest.java
index 3d64e22481..6c5356c5d3 100644
--- a/ttool/src/test/java/ui/AbstractUITest.java
+++ b/ttool/src/test/java/ui/AbstractUITest.java
@@ -4,12 +4,14 @@ import static org.junit.Assert.fail;
 
 import myutil.PluginManager;
 import test.AbstractTest;
+import ui.util.IconManager;
 
 public abstract class AbstractUITest extends AbstractTest {
 	
 	protected final MainGUI mainGui;
 	
 	protected AbstractUITest() {
+		IconManager.loadImg();
 		mainGui = new MainGUI(false, false, false, false, false, false, false, false, false, true, false, false);
 		mainGui.build();
 		PluginManager.pluginManager = new PluginManager();
-- 
GitLab