Skip to content

Commit e991ade

Browse files
committed
support 'à' char, set default value of params
Same default value as the javascript test processor
1 parent 58277c3 commit e991ade

File tree

2 files changed

+19
-8
lines changed

2 files changed

+19
-8
lines changed

autotest/AutoTestContentHandler.java

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import java.io.BufferedWriter;
1919
import java.io.BufferedReader;
20+
import java.io.ByteArrayOutputStream;
2021
import java.io.File;
2122
import java.io.FileWriter;
2223
import java.io.IOException;
@@ -204,15 +205,17 @@ public void startElement(String nameSpaceURI, String localName,
204205
desc = "";
205206
result = new Result();
206207

207-
// Set default value of warning to Zero, because
208+
// Set default value of warning to 1, because
209+
// - The test suite ran by upstream uses the javasript at autotest/client/buildtest.js,
210+
// and the default value of warning is 1.
208211
// - if the GET request to the servlet doesn't define a warning, it will be 0 (as per the
209212
// ApplContext class default values).
210213
// - on the contrary, the default value for the warning of the CLI is 2.
211-
// So we have to set he default value to 0 here, so that when the warning is not defined
212-
// it means 0. This is required to harmonize test result between call to jar and call to servlet.
213-
warning = "0";
214-
profile = null;
215-
medium = null;
214+
// So we have to set the default value to 1 here, so that when the warning is not defined
215+
// it means 1. This is required to harmonize test result between call to jar and call to servlet.
216+
warning = "1"; // Set to same default value as in autotest/client/buildtest.js
217+
profile = "css21"; // Set to same default value as in autotest/client/buildtest.js
218+
medium = "all"; // Set to same default value as in autotest/client/buildtest.js
216219
for (int i = 0; i < attributs.getLength(); i++) {
217220
String currentAttr = attributs.getLocalName(i);
218221
if (currentAttr.equals("warning")) {
@@ -351,8 +354,13 @@ public void endElement(String nameSpaceURI, String localName, String rawName)
351354
.getClassLoader()
352355
.getResourceAsStream(urlString);
353356
byte[] textBytes = new byte[content.available()];
354-
content.read(textBytes, 0, textBytes.length);
355-
text = createValidURL(new String(textBytes));
357+
ByteArrayOutputStream result = new ByteArrayOutputStream();
358+
for (int length; (length = content.read(textBytes)) != -1; ) {
359+
result.write(textBytes, 0, length);
360+
}
361+
// Files are encoded in ISO-8859-1
362+
// ie. "testsuite/properties/positive/content/css3/001.css"
363+
text = createValidURL(result.toString("ISO-8859-1"));
356364
} catch (IOException e) {
357365
System.err.println(e.getMessage());
358366
}
@@ -761,6 +769,8 @@ public String createValidURL(String url) {
761769
res = res.replaceAll("~'", "%7E");
762770
res = res.replaceAll("\\\n", "");
763771
res = res.replaceAll("\\\r", "");
772+
// 'à' character is present in 'testsuite/properties/positive/content/css2/001.css'
773+
res = res.replaceAll("à", "%C3%A0");
764774
return res;
765775
}
766776

build.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@
164164
classpathref="build.class.path"
165165
classpath="."
166166
debug="yes"
167+
encoding="UTF-8"
167168
includeantruntime="false"/>
168169
</target>
169170

0 commit comments

Comments
 (0)