Skip to content

Commit e211bc2

Browse files
committed
Merge branch 'master' of git@github.com:eclipse-rcptt/org.eclipse.rcptt.git
2 parents d00893a + 7f2f61e commit e211bc2

2 files changed

Lines changed: 44 additions & 3 deletions

File tree

launching/org.eclipse.rcptt.reporting.html/src/org/eclipse/rcptt/reporting/html/FullSingleTestHtmlRenderer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,12 +315,12 @@ private void renderNode(InfoNode infoNode) {
315315
// Out properties
316316
if (list.size() != 0) {
317317
for (NodeProperty nodeProperty : list) {
318-
writer.println(nodeProperty.getName() + "=" + nodeProperty.getValue() + " <br>");
318+
writer.println(escape(nodeProperty.getName()) + "=" + escape(nodeProperty.getValue()) + " <br>");
319319
}
320320
}
321321
if (childs.size() != 0) {
322322
for (InfoNode child : childs) {
323-
writer.println(child.getName());
323+
writer.println(escape(child.getName()));
324324
renderNode(child);
325325
}
326326
}

launching/tests/org.eclipse.rcptt.reporting.html.tests/src/org/eclipse/rcptt/reporting/html/tests/FullSingleTestHtmlRendererTest.java

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
*******************************************************************************/
1111
package org.eclipse.rcptt.reporting.html.tests;
1212

13+
import static org.hamcrest.CoreMatchers.not;
1314
import static org.hamcrest.MatcherAssert.assertThat;
15+
import static org.hamcrest.Matchers.containsString;
16+
import static org.hamcrest.Matchers.stringContainsInOrder;
1417

1518
import java.io.PrintWriter;
1619
import java.io.StringWriter;
@@ -28,6 +31,10 @@
2831
import org.eclipse.rcptt.sherlock.core.model.sherlock.report.Screenshot;
2932
import org.eclipse.rcptt.sherlock.core.model.sherlock.report.Snaphot;
3033
import org.eclipse.rcptt.tesla.core.Q7WaitUtils;
34+
import org.eclipse.rcptt.tesla.core.info.AdvancedInformation;
35+
import org.eclipse.rcptt.tesla.core.info.InfoFactory;
36+
import org.eclipse.rcptt.tesla.core.info.InfoNode;
37+
import org.eclipse.rcptt.tesla.core.info.NodeProperty;
3138
import org.eclipse.rcptt.verifications.status.EVerificationStatus;
3239
import org.eclipse.rcptt.verifications.status.StatusFactory;
3340
import org.eclipse.rcptt.verifications.status.VerificationStatusData;
@@ -183,13 +190,47 @@ public void escapeExecutionStatus() {
183190

184191
String result = generate(report);
185192

186-
assertThat(result, Matchers.stringContainsInOrder(
193+
assertThat(result, stringContainsInOrder(
187194
"Failure Reason",
188195
"expected:&lt;wait 200\\n&gt; but was:&lt;wait 200&gt;",
189196
"Details",
190197
"expected:&lt;wait 200\\n&gt; but was:&lt;wait 200&gt;"
191198
));
192199
}
200+
201+
@Test
202+
public void escapeSwtSnapshot() {
203+
Report report = createReport("2", IStatus.ERROR);
204+
Snaphot sn = ReportFactory.eINSTANCE.createSnaphot();
205+
report.getRoot().getSnapshots().add(sn);
206+
AdvancedInformation information = InfoFactory.eINSTANCE.createAdvancedInformation();
207+
sn.setData(information);
208+
InfoNode node = InfoFactory.eINSTANCE.createInfoNode();
209+
information.getNodes().add(node);
210+
node.setName("swt.info");
211+
InfoNode node2 = InfoFactory.eINSTANCE.createInfoNode();
212+
node.getChildren().add(node2);
213+
node2.setName("Text(502<html><head><title>502 Bad Gateway...)");
214+
NodeProperty property = InfoFactory.eINSTANCE.createNodeProperty();
215+
node2.getProperties().add(property);
216+
property.setName("<propertyName>");
217+
property.setValue("<propertyValue>");
218+
219+
String result = generate(report);
220+
assertThat(result, stringContainsInOrder(
221+
"Text",
222+
"502",
223+
"502 Bad Gateway..."
224+
));
225+
assertThat(result, not(containsString("502<")));
226+
assertThat(result, not(containsString(">502")));
227+
assertThat(result, containsString("502&lt;"));
228+
assertThat(result, containsString("&gt;502"));
229+
assertThat(result, not(containsString("<propertyName>")));
230+
assertThat(result, not(containsString("<propertyValue>")));
231+
assertThat(result, containsString("&lt;propertyName&gt;"));
232+
assertThat(result, containsString("&lt;propertyValue&gt;"));
233+
}
193234

194235

195236

0 commit comments

Comments
 (0)