summaryrefslogtreecommitdiff
path: root/testing/resources
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-01-13 15:42:25 -0800
committerTom Sepez <tsepez@chromium.org>2016-01-13 15:42:25 -0800
commit15367cbbb7b8bea2549212b3c9c1f01727c6ccb5 (patch)
tree6d5dbc3264d893331b18bf0ebfa90971910e7d46 /testing/resources
parente02f30bb59b01c159b010fc5c6bb55e677aba8ce (diff)
downloadpdfium-15367cbbb7b8bea2549212b3c9c1f01727c6ccb5.tar.xz
test cast for bug_361
R=thestig@chromium.org, tombergan@chromium.org Review URL: https://codereview.chromium.org/1588733003 .
Diffstat (limited to 'testing/resources')
-rw-r--r--testing/resources/javascript/bug_361.in91
-rw-r--r--testing/resources/javascript/bug_361_expected.txt31
2 files changed, 122 insertions, 0 deletions
diff --git a/testing/resources/javascript/bug_361.in b/testing/resources/javascript/bug_361.in
new file mode 100644
index 0000000000..34fde70fe2
--- /dev/null
+++ b/testing/resources/javascript/bug_361.in
@@ -0,0 +1,91 @@
+{{header}}
+{{object 1 0}} <<
+ /Type /Catalog
+ /Pages 2 0 R
+ /AcroForm 4 0 R
+ /OpenAction 10 0 R
+>>
+endobj
+{{object 2 0}} <<
+ /Type /Pages
+ /Count 1
+ /Kids [
+ 3 0 R
+ ]
+>>
+endobj
+% Page number 0.
+{{object 3 0}} <<
+ /Type /Page
+ /Parent 2 0 R
+ /Resources <<
+ /Font <</F1 15 0 R>>
+ >>
+ /Contents [21 0 R]
+ /MediaBox [0 0 612 792]
+>>
+% Forms
+{{object 4 0}} <<
+ /Fields [5 0 R]
+>>
+% Field
+{{object 5 0}} <<
+ /FT /Tx
+ /T (MyField)
+>>
+% OpenAction action
+{{object 10 0}} <<
+ /Type /Action
+ /S /JavaScript
+ /JS 11 0 R
+>>
+endobj
+% JS program to exexute
+{{object 11 0}} <<
+>>
+stream
+function testField(x) {
+ var field = this.getField("MyField");
+ field.value = x;
+ var y = field.value;
+ app.alert("Answer for \"" + x + "\" is: " + typeof(y) + " " + y);
+}
+testField("goats");
+testField("b4");
+testField("b4.5");
+testField("4x");
+testField("4.5x");
+testField("4");
+testField(" 4");
+testField("4 ");
+testField(" 4 ");
+testField("4 3 2 1");
+testField("-4");
+testField("23.00000001");
+testField("23.00000000000000001");
+testField("25,5");
+testField("1e+5");
+testField("1e5");
+testField("1e-5");
+testField("-1e-5");
+testField("1.2e5");
+testField("NAN");
+testField("INF");
+testField("0x100");
+testField("123x6");
+testField("123xy6");
+testField("123.y6");
+testField("1,000,000");
+testField("1.2.3");
+testField("1-3");
+testField("1+3");
+testField("1.-3");
+testField("1.+3");
+endstream
+endobj
+{{xref}}
+trailer <<
+ /Root 1 0 R
+>>
+{{startxref}}
+%%EOF
diff --git a/testing/resources/javascript/bug_361_expected.txt b/testing/resources/javascript/bug_361_expected.txt
new file mode 100644
index 0000000000..a7fd795477
--- /dev/null
+++ b/testing/resources/javascript/bug_361_expected.txt
@@ -0,0 +1,31 @@
+Alert: Answer for "goats" is: string goats
+Alert: Answer for "b4" is: string b4
+Alert: Answer for "b4.5" is: string b4.5
+Alert: Answer for "4x" is: string 4x
+Alert: Answer for "4.5x" is: string 4.5x
+Alert: Answer for "4" is: number 4
+Alert: Answer for " 4" is: number 4
+Alert: Answer for "4 " is: number 4
+Alert: Answer for " 4 " is: number 4
+Alert: Answer for "4 3 2 1" is: string 4 3 2 1
+Alert: Answer for "-4" is: number -4
+Alert: Answer for "23.00000001" is: number 23.00000001
+Alert: Answer for "23.00000000000000001" is: number 0
+Alert: Answer for "25,5" is: number 25.5
+Alert: Answer for "1e+5" is: number 100000
+Alert: Answer for "1e5" is: number 1
+Alert: Answer for "1e-5" is: number 0.00001
+Alert: Answer for "-1e-5" is: number -0.00001
+Alert: Answer for "1.2e5" is: number 1.2
+Alert: Answer for "NAN" is: string NAN
+Alert: Answer for "INF" is: string INF
+Alert: Answer for "0x100" is: string 0x100
+Alert: Answer for "123x6" is: string 123x6
+Alert: Answer for "123xy6" is: string 123xy6
+Alert: Answer for "123.y6" is: string 123.y6
+Alert: Answer for "1,000,000" is: number 1
+Alert: Answer for "1.2.3" is: number 1.2
+Alert: Answer for "1-3" is: string 1-3
+Alert: Answer for "1+3" is: string 1+3
+Alert: Answer for "1.-3" is: string 1.-3
+Alert: Answer for "1.+3" is: string 1.+3