| {{header}} |
| {{object 1 0}} << |
| /Type /Catalog |
| /Pages 2 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 |
| /MediaBox [0 0 612 792] |
| >> |
| endobj |
| % OpenAction action |
| {{object 10 0}} << |
| /Type /Action |
| /S /JavaScript |
| /JS 11 0 R |
| >> |
| endobj |
| % JS program to exexute |
| {{object 11 0}} << |
| {{streamlen}} |
| >> |
| stream |
| {{include expect.js}} |
| |
| try { |
| expectError("color.convert()"); |
| expectError("color.convert(1)"); |
| expectError("color.convert(undefined, 'RGB')"); |
| expectError("color.convert('BOGUS', 'RGB')"); |
| expectError("color.convert('{}', 'RGB')"); |
| |
| // Can't convert transparent into anything else. |
| expect("color.convert(['T'], 'BOGUS')", "T"); |
| expect("color.convert(['T'], 'T')", "T"); |
| expect("color.convert(['T'], 'G')", "T"); |
| expect("color.convert(['T'], 'RGB')", "T"); |
| expect("color.convert(['T'], 'CMYK')", "T"); |
| |
| expect("color.convert(['G', 0.50], 'BOGUS')", "T"); |
| expect("color.convert(['G', 0.50], 'T')", "T"); |
| expect("color.convert(['G', 0.50], 'G')", "G,0.5"); |
| expect("color.convert(['G', 0.50], 'RGB')", "RGB,0.5,0.5,0.5"); |
| expect("color.convert(['G', 0.50], 'CMYK')", "CMYK,0,0,0,0.5"); |
| |
| expect("color.convert(['RGB', 0.25, 0.50, 0.75], 'BOGUS')", "T"); |
| expect("color.convert(['RGB', 0.25, 0.50, 0.75], 'T')", "T"); |
| expect("color.convert(['RGB', 1.00, 1.00, 1.00], 'G')", "G,1"); |
| expect("color.convert(['RGB', 0.25, 0.50, 0.75], 'RGB')", "RGB,0.25,0.5,0.75"); |
| expect("color.convert(['RGB', 0.25, 0.50, 0.75], 'CMYK')", "CMYK,0.75,0.5,0.25,0.25"); |
| |
| expect("color.convert(['CMYK',0.25,0.25,0.25,0.50], 'BOGUS')", "T"); |
| expect("color.convert(['CMYK',0.25,0.25,0.25,0.50], 'T')", "T"); |
| expect("color.convert(['CMYK',0.25,0.25,0.25,0.50], 'G')", "G,0.25"); |
| expect("color.convert(['CMYK',0.25,0.25,0.25,0.50], 'RGB')", "RGB,0.25,0.25,0.25"); |
| expect("color.convert(['CMYK',0.25,0.25,0.25,0.50], 'CMYK')", "CMYK,0.25,0.25,0.25,0.5"); |
| |
| expectError("color.equal()"); |
| expectError("color.equal(1)"); |
| expectError("color.equal(undefined, undefined)"); |
| expectError("color.equal(undefined, 'BOGUS')"); |
| expectError("color.equal('BOGUS', 'BOGUS')"); |
| expectError("color.equal('BOGUS', ['T'])"); |
| expectError("color.equal(['T'], 'BOGUS')"); |
| |
| expect("color.equal(['T'], ['T'])", true); |
| expect("color.equal(['T'], ['G', 0])", false); |
| expect("color.equal(['T'], ['RGB', 0, 0, 0])", false); |
| expect("color.equal(['T'], ['CMYK', 0, 0, 0, 0])", false); |
| |
| expect("color.equal(['G', 0.50], ['T'])", false); |
| expect("color.equal(['G', 0.50], ['G', 0])", false); |
| expect("color.equal(['G', 0.50], ['G', 0.50])", true); |
| expect("color.equal(['G', 0.50], ['RGB', 0, 0, 0])", false); |
| expect("color.equal(['G', 0.50], ['RGB', 0.50, 0.50, 0.50])", true); |
| expect("color.equal(['G', 0.50], ['CMYK', 0, 0, 0, 0])", false); |
| expect("color.equal(['G', 0.50], ['CMYK', 0, 0, 0, 0.50])", true); |
| |
| expect("color.equal(['RGB', 0.25, 0.25, 0.25], ['T'])", false); |
| expect("color.equal(['RGB', 0.25, 0.25, 0.25], ['G', 0])", false); |
| expect("color.equal(['RGB', 0.25, 0.25, 0.25], ['G', 0.25])", true); |
| expect("color.equal(['RGB', 0.25, 0.25, 0.25], ['RGB', 0, 0, 0])", false); |
| expect("color.equal(['RGB', 0.25, 0.25, 0.25], ['RGB', 0.25, 0.25, 0.25])", true); |
| expect("color.equal(['RGB', 0.25, 0.25, 0.25], ['CMYK', 0, 0, 0, 0])", false); |
| expect("color.equal(['RGB', 0.25, 0.25, 0.25], ['CMYK', 0.75, 0.75, 0.75, 0.75])", true); |
| |
| expect("color.equal(['CMYK', 0.25, 0.25, 0.25, 0.50], ['T'])", false); |
| expect("color.equal(['CMYK', 0.00, 0.25, 0.25, 0.50], ['G', 0])", false); |
| expect("color.equal(['CMYK', 0.00, 0.00, 0.00, 0.50], ['G', 0.50])", true); |
| expect("color.equal(['CMYK', 0.75, 0.50, 0.25, 0.25], ['RGB', 0, 0, 0])", false); |
| expect("color.equal(['CMYK', 0.75, 0.50, 0.25, 0.25], ['RGB', 0.25, 0.50, 0.75])", true); |
| expect("color.equal(['CMYK', 0.25, 0.25, 0.25, 0.50], ['CMYK', 0, 0, 0, 0])", false); |
| expect("color.equal(['CMYK', 0.25, 0.25, 0.25, 0.50], ['CMYK', 0.25, 0.25, 0.25, 0.50])", true); |
| } catch (e) { |
| app.alert("Truly unexpected error: " + e); |
| } |
| endstream |
| endobj |
| {{xref}} |
| {{trailer}} |
| {{startxref}} |
| %%EOF |