Commit 0709752f authored by Piotr Gawron's avatar Piotr Gawron
Browse files

complex name is escaped against xml characters

parent 33767395
......@@ -500,7 +500,7 @@ public class ModelToGPML {
for (Complex ca : model.getComplexList()) {
if (ca.getElements().size() == 0) {
dataNodes.append(
" <DataNode TextLabel=\"" + ca.getName() + "\" GraphId=\"" + ca.getElementId() + "\" Type=\"Complex\"");
" <DataNode TextLabel=\"" + XmlParser.escapeXml(ca.getName()) + "\" GraphId=\"" + ca.getElementId() + "\" Type=\"Complex\"");
if (ca.getComplex() != null) {
dataNodes.append(" GroupRef=\"" + ca.getComplex().getElementId() + "\"");
}
......
......@@ -331,6 +331,10 @@ public class ModelToGPMLTest extends WikipathwaysTestFunctions {
complex.setX(1);
complex.setY(1);
complex.setZ(15);
complex.setNamePoint(6, 9);
complex.setNameVerticalAlign(VerticalAlign.BOTTOM);
complex.setNameHorizontalAlign(HorizontalAlign.CENTER);
complex.setHypothetical(true);
return complex;
}
......@@ -435,9 +439,9 @@ public class ModelToGPMLTest extends WikipathwaysTestFunctions {
model.setHeight(1000);
return model;
}
@Test
public void specialCharacterInComaprtmentName() throws Exception {
public void specialCharacterInCompartmentName() throws Exception {
Model model = createModel();
Compartment compartment = createCompartment();
compartment.setName("hello&by");
......@@ -447,4 +451,16 @@ public class ModelToGPMLTest extends WikipathwaysTestFunctions {
assertEquals(0, new ModelComparator().compare(model, model2));
}
@Test
public void specialCharacterInComplexName() throws Exception {
Model model = createModel();
Element element = createComplex();
element.setName("hello&by");
model.addElement(element);
Model model2 = serializeOverGpml(model);
assertEquals(0, new ModelComparator().compare(model, model2));
}
}
Markdown is supported
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