Commit c5bd8ead authored by Piotr Gawron's avatar Piotr Gawron
Browse files

Font colour of text area was preserved in Empty view

parent c4dcf825
Pipeline #17300 failed with stage
in 22 minutes and 8 seconds
......@@ -10,6 +10,7 @@ minerva (14.0.5) stable; urgency=medium
present (#1025)
* Bug fix: search for NADH drug resulted in drug with empty name (#1018)
* Bug fix: export to SBML didn't handle properly arrows (#1015)
* Bug fix: Font colour of text area was preserved in Empty view (#1014)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 02 Dec 2019 16:00:00 +0200
......
package lcsb.mapviewer.commands;
import java.awt.*;
import java.awt.Color;
import java.util.ArrayList;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.species.Element;
/**
* This {@link ModelCommand} clear info about colors in a model.
......@@ -43,5 +44,8 @@ public class ClearColorModelCommand extends ModelCommand {
@Override
protected void executeImplementation() throws CommandExecutionException {
colorModelCommand.execute();
for (Element element : colorModelCommand.getModel().getElements()) {
element.setFontColor(Color.BLACK);
}
}
}
......@@ -10,6 +10,7 @@ import lcsb.mapviewer.commands.properties.AllPropertyCommandTests;
@RunWith(Suite.class)
@SuiteClasses({ AllLayoutTests.class,
AllPropertyCommandTests.class,
ClearColorModelCommandTest.class,
ColorModelCommandTest.class,
CopyCommandTest.class,
CreateHierarchyCommandTest.class,
......
package lcsb.mapviewer.commands;
import static org.junit.Assert.assertEquals;
import java.awt.Color;
import org.junit.Test;
import lcsb.mapviewer.model.map.compartment.PathwayCompartment;
import lcsb.mapviewer.model.map.model.Model;
import lcsb.mapviewer.model.map.species.Element;
import lcsb.mapviewer.modelutils.map.ElementUtils;
public class ClearColorModelCommandTest extends CommandTestFunctions {
ElementUtils eu = new ElementUtils();
@Test
public void test() throws CommandExecutionException {
Model model = super.createSimpleModel();
PathwayCompartment compartment = new PathwayCompartment("id");
compartment.setColor(Color.BLUE);
compartment.setFontColor(Color.YELLOW);
model.addElement(compartment);
new ClearColorModelCommand(model).execute();
for (Element e : model.getElements()) {
assertEquals(Color.WHITE, e.getColor());
assertEquals(eu.getElementTag(e) + "Invalid font color ", Color.BLACK, e.getFontColor());
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment