Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 from string import Template | |
|
jsbell
2015/06/03 16:43:26
Following https://codereview.chromium.org/11677230
tkent
2015/06/05 01:38:06
Done.
| |
| 2 import os | |
| 3 import sys | |
| 4 | |
| 5 template = Template("""<!DOCTYPE html> | |
| 6 <!-- This file is generated by $generator --> | |
| 7 <html> | |
| 8 <head> | |
| 9 <title>SVG sizing: <$placeholder></title> | |
| 10 <meta name=timeout content=long> | |
| 11 <script src="/resources/testharness.js"></script> | |
| 12 <script src="/resources/testharnessreport.js"></script> | |
| 13 <script src="../resources/svg-sizing.js"></script> | |
| 14 <style> | |
| 15 #testContainer { | |
| 16 position: absolute; | |
| 17 left: 0; | |
| 18 top: 0; | |
| 19 width: 800px; | |
| 20 height: 600px | |
| 21 } | |
| 22 iframe { border: 0 } | |
| 23 </style> | |
| 24 <link rel="help" href="http://www.w3.org/TR/CSS2/visudet.html#inline-replace d-width"> | |
| 25 <link rel="help" href="http://www.w3.org/TR/CSS2/visudet.html#inline-replace d-height"> | |
| 26 <link rel="help" href="https://html.spec.whatwg.org/multipage/#replaced-elem ents"> | |
| 27 <link rel="help" href="https://html.spec.whatwg.org/multipage/#attr-dim-widt h"> | |
| 28 <link rel="help" href="http://www.w3.org/TR/SVG/coords.html#ViewportSpace"> | |
| 29 </head> | |
| 30 <body> | |
| 31 <div id="log"></div> | |
| 32 <div id="testContainer"></div> | |
| 33 <div id="demo"></div> | |
| 34 <script src="svg-embedded-sizing.js"></script> | |
| 35 <script>testPlaceholderWithHeight("$placeholder", $placeholderHeightAttr)</s cript> | |
| 36 </body> | |
| 37 </html> | |
| 38 """) | |
| 39 | |
| 40 placeholders = [ "object", "iframe", "img" ] | |
| 41 placeholderHeightAttrs = [ "null", "'100px'", "'100%'" ] | |
| 42 placeholderHeightAttrsDescriptions = [ "auto", "fixed", "percentage" ] | |
| 43 | |
| 44 try: | |
| 45 os.makedirs("../svg-embedded-sizing") | |
| 46 except OSError: | |
| 47 pass | |
| 48 | |
| 49 for placeholder in placeholders: | |
| 50 for i, placeholderHeightAttr in enumerate(placeholderHeightAttrs): | |
| 51 testContent = template.substitute(placeholder=placeholder, placeholderHe ightAttr=placeholderHeightAttr, generator=sys.argv[0]) | |
| 52 filename = "../svg-embedded-sizing/svg-in-%s-%s.html" % (placeholder, pl aceholderHeightAttrsDescriptions[i]) | |
| 53 f = open(filename, "w") | |
| 54 f.write(testContent) | |
| 55 f.close() | |
| OLD | NEW |