Skip to content
Snippets Groups Projects
Commit a81228d9 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

name of the transcription factor is drawn

parent 8b405df4
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!491Resolve "change arrows for Transcription Starting Sites"
Pipeline #7266 passed
......@@ -695,6 +695,10 @@ public abstract class SpeciesConverter<T extends Species> extends ElementConvert
arrowTransformation.drawLine(line, graphics);
y = transcriptionSite.getPosition().getY() - DEFAULT_MODIFICATION_DIAMETER - DEFAULT_SPECIES_FONT_SIZE / 2;
if (transcriptionSite.getName() != null && !transcriptionSite.getName().isEmpty()) {
drawText(new Point2D.Double(x, y), transcriptionSite.getName(), graphics, true, false);
}
}
public ArrowTransformation getArrowTransformation() {
......
......@@ -4,6 +4,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.argThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
......@@ -323,6 +325,7 @@ public class SpeciesConverterTest {
transcriptionSite.setPosition(new Point2D.Double(10, 10));
transcriptionSite.setWidth(100);
transcriptionSite.setHeight(20);
transcriptionSite.setDirection("LEFT");
ArrowTransformation arrowTransformation = Mockito.spy(new ArrowTransformation());
......@@ -341,6 +344,31 @@ public class SpeciesConverterTest {
}
}
@Test
public void testDrawTranscriptionSiteDescription() throws Exception {
try {
BufferedImage bi = new BufferedImage(200, 200, BufferedImage.TYPE_INT_ARGB);
Graphics2D graphics = Mockito.spy(bi.createGraphics());
TranscriptionSite transcriptionSite = new TranscriptionSite();
transcriptionSite.setPosition(new Point2D.Double(10, 10));
transcriptionSite.setWidth(100);
transcriptionSite.setHeight(20);
transcriptionSite.setActive(true);
transcriptionSite.setDirection("LEFT");
transcriptionSite.setName("x");
ProteinConverter converter = new ProteinConverter(colorExtractor);
converter.drawModification(transcriptionSite, graphics, false);
verify(graphics, times(1)).drawString(anyString(), anyInt(), anyInt());
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}
private GenericProtein createProtein() {
GenericProtein protein = new GenericProtein("id");
protein.setName("NAME_OF_THE_ELEMENT");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment