From 4e978c60cc8a1439774b3bfa8e3e2a68bcb6b8db Mon Sep 17 00:00:00 2001 From: Niklas von Hertzen Date: Thu, 27 Dec 2012 23:53:27 +0200 Subject: [PATCH] formatted tests into smaller units --- src/plugins/bookmarklet.js | 76 -------- tests/{ => assets}/image.jpg | Bin tests/{ => assets}/image.svg | 0 tests/{ => assets}/image2.jpg | Bin .../assets}/jquery.plugin.html2canvas.js | 0 tests/cases/background/encoded.html | 52 +++++ tests/cases/background/linear-gradient.html | 105 ++++++++++ tests/cases/background/multi.html | 50 +++++ tests/cases/background/position.html | 66 +++++++ .../background/radial-gradient.html} | 114 +---------- tests/cases/background/repeat.html | 57 ++++++ tests/cases/images/canvas.html | 27 +++ .../images/cross-origin.html} | 10 +- tests/cases/images/empty.html | 13 ++ tests/cases/images/images.html | 26 +++ tests/cases/images/svg.html | 12 ++ tests/cases/list/decimal-leading-zero.html | 57 ++++++ tests/cases/list/decimal.html | 59 ++++++ tests/cases/list/lower-alpha.html | 59 ++++++ tests/cases/list/upper-roman.html | 59 ++++++ tests/{ => cases}/overflow.html | 17 +- tests/{ => cases/text}/text.html | 27 +-- .../text/underline-lineheight.html} | 17 +- .../visibility.html} | 13 +- tests/cases/zindex/z-index1.html | 81 ++++++++ tests/cases/zindex/z-index2.html | 103 ++++++++++ tests/cases/zindex/z-index3.html | 109 +++++++++++ tests/external-content.html | 14 -- tests/images.html | 72 ------- tests/lists.html | 80 -------- tests/origin.html | 182 ------------------ tests/test.js | 4 +- tests/z-index1.html | 87 --------- tests/z-index2.html | 109 ----------- tests/z-index3.html | 115 ----------- 35 files changed, 970 insertions(+), 902 deletions(-) delete mode 100644 src/plugins/bookmarklet.js rename tests/{ => assets}/image.jpg (100%) rename tests/{ => assets}/image.svg (100%) rename tests/{ => assets}/image2.jpg (100%) rename {src/plugins => tests/assets}/jquery.plugin.html2canvas.js (100%) create mode 100644 tests/cases/background/encoded.html create mode 100644 tests/cases/background/linear-gradient.html create mode 100644 tests/cases/background/multi.html create mode 100644 tests/cases/background/position.html rename tests/{background.html => cases/background/radial-gradient.html} (50%) create mode 100644 tests/cases/background/repeat.html create mode 100644 tests/cases/images/canvas.html rename tests/{proxy.html => cases/images/cross-origin.html} (84%) create mode 100644 tests/cases/images/empty.html create mode 100644 tests/cases/images/images.html create mode 100644 tests/cases/images/svg.html create mode 100644 tests/cases/list/decimal-leading-zero.html create mode 100644 tests/cases/list/decimal.html create mode 100644 tests/cases/list/lower-alpha.html create mode 100644 tests/cases/list/upper-roman.html rename tests/{ => cases}/overflow.html (92%) rename tests/{ => cases/text}/text.html (92%) rename tests/{text-underline-lineheight.html => cases/text/underline-lineheight.html} (76%) rename tests/{visible-elements.html => cases/visibility.html} (74%) create mode 100644 tests/cases/zindex/z-index1.html create mode 100644 tests/cases/zindex/z-index2.html create mode 100644 tests/cases/zindex/z-index3.html delete mode 100644 tests/external-content.html delete mode 100644 tests/images.html delete mode 100644 tests/lists.html delete mode 100644 tests/origin.html delete mode 100644 tests/z-index1.html delete mode 100644 tests/z-index2.html delete mode 100644 tests/z-index3.html diff --git a/src/plugins/bookmarklet.js b/src/plugins/bookmarklet.js deleted file mode 100644 index 63d14e0..0000000 --- a/src/plugins/bookmarklet.js +++ /dev/null @@ -1,76 +0,0 @@ -(function() { - /* options, customize to your needs */ - var server = '//html2canvas.hertzen.com/js', - proxy = '//html2canvas.appspot.com', - debug = false, - profile = false; - //DEBUG: server = 'http://localhost/html2canvas'; debug = true; - var debugFiles = [ - 'external/jquery-1.6.2.min', - 'src/Core', - 'src/Generate', - 'src/Parse', - 'src/Preload', - 'src/Queue', - 'src/Renderer', - 'src/Util', - 'src/renderers/Canvas', - 'src/plugins/jquery.plugin.html2canvas' - ], - relFiles = [ - '//code.jquery.com/jquery-1.6.4.js', - 'html2canvas', - 'jquery.plugin.html2canvas' - ]; - var loader = { - index: 0, - head: document.getElementsByTagName('head')[0], - statusline: document.createElement('div'), - files: (debug ? debugFiles : relFiles), - onload: function () { - var _ = this; - if (_.index < _.files.length) { - var el = document.createElement('script'); - el.type = 'text/javascript'; - el.onload = function() { - _.onload(); - }; - el.onerror = function() { - _.statusline.style.color = 'red'; - _.statusline.innerHTML = _.statusline.innerHTML + ' failed'; - _.statusline.onclick = function() { - _.statusline.parentNode.removeChild(_.statusline); - }; - }; - if (_.files[_.index].substr(0, 2) === '//') { - el.src = _.files[_.index]; - } - else { - el.src = server + '/' + _.files[_.index] + '.js'; - } - _.head.appendChild(el); - ++_.index; - _.statusline.innerHTML = 'html2canvas: loading "' + el.src + '" ' + _.index + ' / ' + _.files.length + '...'; - } - else { - _.statusline.parentNode.removeChild(_.statusline); - delete _.statusline; - $(document.documentElement).html2canvas({ - logging: debug, - profile: profile, - proxy: proxy - }); - } - } - }, statusline = loader.statusline; - statusline.style.position = 'fixed'; - statusline.style.bottom = '0px'; - statusline.style.right = '20px'; - statusline.style.backgroundColor = 'white'; - statusline.style.border = '1px solid black'; - statusline.style.borderBottomWidth = '0px'; - statusline.style.padding = '2px 5px'; - statusline.style.zIndex = 9999999; - document.body.appendChild(statusline); - loader.onload(); -}()); diff --git a/tests/image.jpg b/tests/assets/image.jpg similarity index 100% rename from tests/image.jpg rename to tests/assets/image.jpg diff --git a/tests/image.svg b/tests/assets/image.svg similarity index 100% rename from tests/image.svg rename to tests/assets/image.svg diff --git a/tests/image2.jpg b/tests/assets/image2.jpg similarity index 100% rename from tests/image2.jpg rename to tests/assets/image2.jpg diff --git a/src/plugins/jquery.plugin.html2canvas.js b/tests/assets/jquery.plugin.html2canvas.js similarity index 100% rename from src/plugins/jquery.plugin.html2canvas.js rename to tests/assets/jquery.plugin.html2canvas.js diff --git a/tests/cases/background/encoded.html b/tests/cases/background/encoded.html new file mode 100644 index 0000000..0c49250 --- /dev/null +++ b/tests/cases/background/encoded.html @@ -0,0 +1,52 @@ + + + + Background attribute tests + + + + + + + +
+
+
+ + + diff --git a/tests/cases/background/linear-gradient.html b/tests/cases/background/linear-gradient.html new file mode 100644 index 0000000..86756df --- /dev/null +++ b/tests/cases/background/linear-gradient.html @@ -0,0 +1,105 @@ + + + + Background attribute tests + + + + + + +
+
 
+
 
+
 
+
 
+
 
+
+ + diff --git a/tests/cases/background/multi.html b/tests/cases/background/multi.html new file mode 100644 index 0000000..e5093c5 --- /dev/null +++ b/tests/cases/background/multi.html @@ -0,0 +1,50 @@ + + + + Background attribute tests + + + + + + + +
+
+
+
+
+ + + diff --git a/tests/cases/background/position.html b/tests/cases/background/position.html new file mode 100644 index 0000000..f48e3bb --- /dev/null +++ b/tests/cases/background/position.html @@ -0,0 +1,66 @@ + + + + Background attribute tests + + + + + + + +
+
+
+
+
+
+ + +
+
+
+
+
+
+ +
+
+
+
+
+
+ + + diff --git a/tests/background.html b/tests/cases/background/radial-gradient.html similarity index 50% rename from tests/background.html rename to tests/cases/background/radial-gradient.html index 7ad8618..b09abc8 100644 --- a/tests/background.html +++ b/tests/cases/background/radial-gradient.html @@ -3,7 +3,7 @@ Background attribute tests - + + + + + +
+
+
+
+
+
+
+
+
+
+
+
+ + + diff --git a/tests/cases/images/canvas.html b/tests/cases/images/canvas.html new file mode 100644 index 0000000..2a876c4 --- /dev/null +++ b/tests/cases/images/canvas.html @@ -0,0 +1,27 @@ + + + + Image tests + + + + + + + + + diff --git a/tests/proxy.html b/tests/cases/images/cross-origin.html similarity index 84% rename from tests/proxy.html rename to tests/cases/images/cross-origin.html index ca55b11..10343c3 100644 --- a/tests/proxy.html +++ b/tests/cases/images/cross-origin.html @@ -3,19 +3,19 @@ External content tests - + - +

External image

- +

External image (using <base> href)

- +

External image (CORS)

- + diff --git a/tests/cases/images/empty.html b/tests/cases/images/empty.html new file mode 100644 index 0000000..a559161 --- /dev/null +++ b/tests/cases/images/empty.html @@ -0,0 +1,13 @@ + + + + Image tests + + + + + Image without src attribute, should not crash: + + + + diff --git a/tests/cases/images/images.html b/tests/cases/images/images.html new file mode 100644 index 0000000..3b02599 --- /dev/null +++ b/tests/cases/images/images.html @@ -0,0 +1,26 @@ + + + + Image tests + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/cases/images/svg.html b/tests/cases/images/svg.html new file mode 100644 index 0000000..5abacd5 --- /dev/null +++ b/tests/cases/images/svg.html @@ -0,0 +1,12 @@ + + + + Image tests + + + + + SVG taints image:
+ + + diff --git a/tests/cases/list/decimal-leading-zero.html b/tests/cases/list/decimal-leading-zero.html new file mode 100644 index 0000000..7704a42 --- /dev/null +++ b/tests/cases/list/decimal-leading-zero.html @@ -0,0 +1,57 @@ + + + + List tests + + + + + + + + + +
    + + diff --git a/tests/cases/list/decimal.html b/tests/cases/list/decimal.html new file mode 100644 index 0000000..b92a401 --- /dev/null +++ b/tests/cases/list/decimal.html @@ -0,0 +1,59 @@ + + + + List tests + + + + + + + + + + +
      + + + diff --git a/tests/cases/list/lower-alpha.html b/tests/cases/list/lower-alpha.html new file mode 100644 index 0000000..7343393 --- /dev/null +++ b/tests/cases/list/lower-alpha.html @@ -0,0 +1,59 @@ + + + + List tests + + + + + + + + + + +
        + + + diff --git a/tests/cases/list/upper-roman.html b/tests/cases/list/upper-roman.html new file mode 100644 index 0000000..8eb3ddc --- /dev/null +++ b/tests/cases/list/upper-roman.html @@ -0,0 +1,59 @@ + + + + List tests + + + + + + + + + + +
          + + + diff --git a/tests/overflow.html b/tests/cases/overflow.html similarity index 92% rename from tests/overflow.html rename to tests/cases/overflow.html index 21b18fc..f757a1d 100644 --- a/tests/overflow.html +++ b/tests/cases/overflow.html @@ -3,8 +3,7 @@ Overflow tests - - + - +

          Overflow: visible

          Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.

          Overflow: hidden

          - Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s - + Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s + with the release of
          a
          Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. - - + +
          position:relative within a overflow:hidden element

          - + Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. - +
          diff --git a/tests/text.html b/tests/cases/text/text.html similarity index 92% rename from tests/text.html rename to tests/cases/text/text.html index e4f83c9..4fcc083 100644 --- a/tests/text.html +++ b/tests/cases/text/text.html @@ -1,16 +1,9 @@ - Text tests - - - + - + Creating content through JavaScript diff --git a/tests/visible-elements.html b/tests/cases/visibility.html similarity index 74% rename from tests/visible-elements.html rename to tests/cases/visibility.html index 90e5ca0..9c09a63 100644 --- a/tests/visible-elements.html +++ b/tests/cases/visibility.html @@ -1,16 +1,9 @@ - Visible elements tests - - - + - +

          Display:none and visible:hidden tests

          This should be visible
          display:none, This should be hidden
          @@ -26,6 +19,6 @@
          display:none, This should be hidden
          visibility:hidden, This should be hidden
          - + diff --git a/tests/cases/zindex/z-index1.html b/tests/cases/zindex/z-index1.html new file mode 100644 index 0000000..075ded7 --- /dev/null +++ b/tests/cases/zindex/z-index1.html @@ -0,0 +1,81 @@ + + + + z-index tests #1 + + + + + + + +
          +
          + + No z-indexed content +
          +
          DIV #1 +
          position: relative; +
          +
          DIV #2 +
          position: absolute; +
          z-index: 1; +
          +
          + +
          + +
          +
          DIV #3 +
          position: relative; +
          +
          DIV #4 +
          position: absolute; +
          z-index: 2; +
          +
          + Some more non-zindexed content +
          + + diff --git a/tests/cases/zindex/z-index2.html b/tests/cases/zindex/z-index2.html new file mode 100644 index 0000000..2dabb11 --- /dev/null +++ b/tests/cases/zindex/z-index2.html @@ -0,0 +1,103 @@ + + + + z-index tests #2 + + + + + + +
          + +
          +
          DIV #1 +
          position: relative; +
          +
          DIV #2 +
          position: absolute; +
          z-index: 2; +
          +
          + +
          + +
          +
          DIV #3 +
          position: relative; +
          z-index: 1; +
          +
          DIV #4 +
          position: absolute; +
          z-index: 10; +
          +
          + +

          DIV #5
          position:relative;
          + +

          DIV #6
          position:static;
          + + + diff --git a/tests/cases/zindex/z-index3.html b/tests/cases/zindex/z-index3.html new file mode 100644 index 0000000..b9147f4 --- /dev/null +++ b/tests/cases/zindex/z-index3.html @@ -0,0 +1,109 @@ + + + + z-index tests #3 + + + + + + +
          + +
          + LEVEL #1 + +
          + +
          +
          LEVEL #2 +
          z-index: 1; + +
          + +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          +
          LEVEL #3
          + +
          + +
          + +
          +
          LEVEL #2 +
          z-index: 1; +
          + +
          +
          + +
          + LEVEL #1 +
          + +
          + LEVEL #1 +
          + +
          + LEVEL #1 +
          + + diff --git a/tests/external-content.html b/tests/external-content.html deleted file mode 100644 index 62173f4..0000000 --- a/tests/external-content.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - External content tests - - - - - - -

          Iframe

          - - - diff --git a/tests/images.html b/tests/images.html deleted file mode 100644 index 3aa0f33..0000000 --- a/tests/images.html +++ /dev/null @@ -1,72 +0,0 @@ - - - - Image tests - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
          - Image without src attribute, should not crash: - - - SVG taints image:
          - - - diff --git a/tests/lists.html b/tests/lists.html deleted file mode 100644 index 2a0f871..0000000 --- a/tests/lists.html +++ /dev/null @@ -1,80 +0,0 @@ - - - - - List tests - - - - - - - - - - - -
            -
          1. First
          2. -
          3. Second
            new line
          4. -
          5. -
          6. Third
          7. - -
          - -
            - -
          - - - diff --git a/tests/origin.html b/tests/origin.html deleted file mode 100644 index 4f83d43..0000000 --- a/tests/origin.html +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - display/box/float/clear test - - - - -
          -
          - toggle -
          -
          -
            -
          • - the way -
          • -
          • -

            - the world ends -

            -
            -

            - bang - -

            -

            - whimper - -

            -
            -
          • -
          • - i grow old -
          • -
          • - pluot? -
          • -
          -
          -
          - bar maids, -
          -
          -

          - sing to me, erbarme dich -

          -
          -
          -

          - This is a nonsensical document, but syntactically valid HTML 4.0. All 100% conformant CSS1 agents should be able to render the document elements above this paragraph indistinguishably (to the pixel) from this reference rendering, (except font rasterization and form widgets). All discrepancies should be traceable to CSS1 implementation shortcomings. Once you have finished evaluating this test, you can return to the parent page. -

          - - diff --git a/tests/test.js b/tests/test.js index 8ffcd79..7d1ac19 100644 --- a/tests/test.js +++ b/tests/test.js @@ -10,7 +10,8 @@ var h2cSelector, h2cOptions; var srcStart = ''; document.write(srcStart + '/external/jquery-1.6.2.js' + scrEnd); - var html2canvas = ['Core', 'Generate', 'Parse', 'Preload', 'Queue', 'Renderer', 'Util', 'renderers/Canvas', 'plugins/jquery.plugin.html2canvas'], i; + document.write(srcStart + '/tests/assets/jquery.plugin.html2canvas.js' + scrEnd); + var html2canvas = ['Core', 'Generate', 'Parse', 'Preload', 'Queue', 'Renderer', 'Util', 'renderers/Canvas'], i; for (i = 0; i < html2canvas.length; ++i) { document.write(srcStart + '/src/' + html2canvas[i] + '.js' + scrEnd); } @@ -27,6 +28,7 @@ var h2cSelector, h2cOptions; flashcanvas: "../external/flashcanvas.min.js", logging: true, profile: true, + proxy: "http://html2canvas.appspot.com/query", useCORS: true }, h2cOptions)); }, 100); diff --git a/tests/z-index1.html b/tests/z-index1.html deleted file mode 100644 index ac00d78..0000000 --- a/tests/z-index1.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - - z-index tests #1 - - - - - - - - -
          -
          - - No z-indexed content -
          -
          DIV #1 -
          position: relative; -
          -
          DIV #2 -
          position: absolute; -
          z-index: 1; -
          -
          - -
          - -
          -
          DIV #3 -
          position: relative; -
          -
          DIV #4 -
          position: absolute; -
          z-index: 2; -
          -
          - Some more non-zindexed content -
          - - diff --git a/tests/z-index2.html b/tests/z-index2.html deleted file mode 100644 index 0622d7b..0000000 --- a/tests/z-index2.html +++ /dev/null @@ -1,109 +0,0 @@ - - - - - z-index tests #2 - - - - - - - -
          - -
          -
          DIV #1 -
          position: relative; -
          -
          DIV #2 -
          position: absolute; -
          z-index: 2; -
          -
          - -
          - -
          -
          DIV #3 -
          position: relative; -
          z-index: 1; -
          -
          DIV #4 -
          position: absolute; -
          z-index: 10; -
          -
          - -

          DIV #5
          position:relative;
          - -

          DIV #6
          position:static;
          - - - diff --git a/tests/z-index3.html b/tests/z-index3.html deleted file mode 100644 index b9189bc..0000000 --- a/tests/z-index3.html +++ /dev/null @@ -1,115 +0,0 @@ - - - - - z-index tests #3 - - - - - - - -
          - -
          - LEVEL #1 - -
          - -
          -
          LEVEL #2 -
          z-index: 1; - -
          - -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          -
          LEVEL #3
          - -
          - -
          - -
          -
          LEVEL #2 -
          z-index: 1; -
          - -
          -
          - -
          - LEVEL #1 -
          - -
          - LEVEL #1 -
          - -
          - LEVEL #1 -
          - -