mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1559975 - Make layout/reftests/ lint with 'py2' and 'py3' r=catlee
Depends on D36094 Differential Revision: https://phabricator.services.mozilla.com/D36095 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
997253f286
commit
80b492019d
@ -27,6 +27,8 @@
|
||||
# Assumes there is no intrinsic size for the border-image-source, so uses
|
||||
# the size of the border image area.
|
||||
|
||||
from __future__ import print_function, absolute_import
|
||||
|
||||
import sys
|
||||
|
||||
class Point:
|
||||
@ -65,7 +67,7 @@ class np:
|
||||
def parse_p(tok):
|
||||
if tok[-2:] == "px":
|
||||
return float(tok[:-2])
|
||||
print "Whoops, not a pixel value " + tok
|
||||
print("Whoops, not a pixel value", tok)
|
||||
|
||||
def parse_np(tok):
|
||||
if tok[-2:] == "px":
|
||||
@ -121,47 +123,47 @@ def normalise(props):
|
||||
|
||||
def check_parse(props):
|
||||
if not hasattr(props, 'source'):
|
||||
print "missing border-image-source"
|
||||
print("missing border-image-source")
|
||||
return False
|
||||
if not hasattr(props.size, 'width'):
|
||||
print "missing width"
|
||||
print("missing width")
|
||||
return False
|
||||
if not hasattr(props.size, 'height'):
|
||||
print "missing height"
|
||||
print("missing height")
|
||||
return False
|
||||
if not hasattr(props, 'width'):
|
||||
print "missing border-width"
|
||||
print("missing border-width")
|
||||
return False
|
||||
if not hasattr(props, 'image_width'):
|
||||
print "missing border-image-width"
|
||||
print("missing border-image-width")
|
||||
return False
|
||||
if not hasattr(props, 'slice'):
|
||||
print "missing border-image-slice"
|
||||
print("missing border-image-slice")
|
||||
return False
|
||||
if not hasattr(props, 'repeat') or (props.repeat not in ["stretch", "repeat", "round"]):
|
||||
print "missing or incorrect border-image-repeat '" + props.repeat + "'"
|
||||
print("missing or incorrect border-image-repeat '" + props.repeat + "'")
|
||||
return False
|
||||
if not hasattr(props, 'outset'):
|
||||
print "missing border-image-outset"
|
||||
print("missing border-image-outset")
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def check_normalise(props):
|
||||
if not hasattr(props, 'source'):
|
||||
print "missing border-image-source"
|
||||
print("missing border-image-source")
|
||||
return False
|
||||
if not hasattr(props.size, 'width'):
|
||||
print "missing width"
|
||||
print("missing width")
|
||||
return False
|
||||
if not hasattr(props.size, 'height'):
|
||||
print "missing height"
|
||||
print("missing height")
|
||||
return False
|
||||
if not hasattr(props, 'slice'):
|
||||
print "missing border-image-slice"
|
||||
print("missing border-image-slice")
|
||||
return False
|
||||
if not hasattr(props, 'repeat') or (props.repeat not in ["stretch", "repeat", "round"]):
|
||||
print "missing or incorrect border-image-repeat '" + props.repeat + "'"
|
||||
print("missing or incorrect border-image-repeat '" + props.repeat + "'")
|
||||
return False
|
||||
|
||||
return True
|
||||
@ -239,7 +241,7 @@ def compute(props):
|
||||
for t in [tiles[i] for i in [3, 4, 5]]:
|
||||
t.scale.y = dest_tile_size.height/t.slice.height()
|
||||
else:
|
||||
print "Whoops, invalid border-image-repeat value"
|
||||
print("Whoops, invalid border-image-repeat value")
|
||||
|
||||
# catch overlapping slices. Its easier to deal with it here than to catch
|
||||
# earlier and have to avoid all the divide by zeroes above
|
||||
@ -312,34 +314,34 @@ def compute(props):
|
||||
dest_tiles[(i+1)*tiles_h-2].dest_size.width -= diff_h
|
||||
|
||||
# output the table to simulate the border
|
||||
print "<table>"
|
||||
print("<table>")
|
||||
for i in range(tiles_h):
|
||||
print "<col style=\"width: " + str(dest_tiles[i].dest_size.width) + "px;\">"
|
||||
print("<col style=\"width: " + str(dest_tiles[i].dest_size.width) + "px;\">")
|
||||
for i in range(tiles_v):
|
||||
print "<tr style=\"height: " + str(dest_tiles[i*tiles_h].dest_size.height) + "px;\">"
|
||||
print("<tr style=\"height: " + str(dest_tiles[i*tiles_h].dest_size.height) + "px;\">")
|
||||
for j in range(tiles_h):
|
||||
width = dest_tiles[i*tiles_h+j].size.width
|
||||
height = dest_tiles[i*tiles_h+j].size.height
|
||||
# catch any tiles with negative widths/heights
|
||||
# this happends when the total of the border-image-slices > borde drawing area
|
||||
if width <= 0 or height <= 0:
|
||||
print " <td style=\"background: white;\"></td>"
|
||||
print(" <td style=\"background: white;\"></td>")
|
||||
else:
|
||||
print " <td style=\"background-image: " + props.source + "; background-size: " + str(width) + "px " + str(height) + "px; background-position: " + str(dest_tiles[i*tiles_h+j].offset.x) + "px " + str(dest_tiles[i*tiles_h+j].offset.y) + "px;\"></td>"
|
||||
print "</tr>"
|
||||
print "</table>"
|
||||
print(" <td style=\"background-image: " + props.source + "; background-size: " + str(width) + "px " + str(height) + "px; background-position: " + str(dest_tiles[i*tiles_h+j].offset.x) + "px " + str(dest_tiles[i*tiles_h+j].offset.y) + "px;\"></td>")
|
||||
print("</tr>")
|
||||
print("</table>")
|
||||
|
||||
|
||||
# start here
|
||||
args = sys.argv[1:]
|
||||
if len(args) == 0:
|
||||
print "whoops: no source file"
|
||||
print("whoops: no source file")
|
||||
exit(1)
|
||||
|
||||
|
||||
props = parse(args[0])
|
||||
if not check_parse(props):
|
||||
print dir(props)
|
||||
print(dir(props))
|
||||
exit(1)
|
||||
props = normalise(props)
|
||||
if not check_normalise(props):
|
||||
|
@ -1,3 +1,4 @@
|
||||
from __future__ import print_function, absolute_import
|
||||
|
||||
import os
|
||||
import textwrap
|
||||
@ -124,7 +125,7 @@ def makeLookup1():
|
||||
if table.format == 4:
|
||||
table.cmap[cp] = glyphName
|
||||
else:
|
||||
raise NotImplementedError, "Unsupported cmap table format: %d" % table.format
|
||||
raise NotImplementedError("Unsupported cmap table format: %d" % table.format)
|
||||
cp += 1
|
||||
|
||||
# tag.fail
|
||||
@ -145,7 +146,7 @@ def makeLookup1():
|
||||
if table.format == 4:
|
||||
table.cmap[cp] = glyphName
|
||||
else:
|
||||
raise NotImplementedError, "Unsupported cmap table format: %d" % table.format
|
||||
raise NotImplementedError("Unsupported cmap table format: %d" % table.format)
|
||||
|
||||
# bump this up so that the sequence is the same as the lookup 3 font
|
||||
cp += 3
|
||||
@ -326,7 +327,7 @@ def makeLookup3():
|
||||
if table.format == 4:
|
||||
table.cmap[cp] = glyphName
|
||||
else:
|
||||
raise NotImplementedError, "Unsupported cmap table format: %d" % table.format
|
||||
raise NotImplementedError("Unsupported cmap table format: %d" % table.format)
|
||||
cp += 1
|
||||
|
||||
# tag.alt1,2,3
|
||||
@ -347,7 +348,7 @@ def makeLookup3():
|
||||
if table.format == 4:
|
||||
table.cmap[cp] = glyphName
|
||||
else:
|
||||
raise NotImplementedError, "Unsupported cmap table format: %d" % table.format
|
||||
raise NotImplementedError("Unsupported cmap table format: %d" % table.format)
|
||||
cp += 1
|
||||
|
||||
# set the glyph order
|
||||
@ -474,13 +475,13 @@ def makeJavascriptData():
|
||||
|
||||
# build fonts
|
||||
|
||||
print "Making lookup type 1 font..."
|
||||
print("Making lookup type 1 font...")
|
||||
makeLookup1()
|
||||
|
||||
print "Making lookup type 3 font..."
|
||||
print("Making lookup type 3 font...")
|
||||
makeLookup3()
|
||||
|
||||
# output javascript data
|
||||
|
||||
print "Making javascript data file..."
|
||||
print("Making javascript data file...")
|
||||
makeJavascriptData()
|
@ -15,6 +15,8 @@
|
||||
# To install what you need, on Ubuntu,
|
||||
# sudo apt-get install python-fontforge
|
||||
|
||||
from __future__ import print_function, absolute_import
|
||||
|
||||
import fontforge
|
||||
|
||||
# generate a set of fonts, each with our special glyph at one codepoint,
|
||||
|
@ -15,7 +15,7 @@
|
||||
# To install what you need, on Ubuntu,
|
||||
# sudo apt-get install python-fontforge
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import print_function, absolute_import
|
||||
import fontforge
|
||||
|
||||
em = 1000
|
||||
|
@ -2,6 +2,9 @@
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import print_function, absolute_import
|
||||
|
||||
import os
|
||||
from optparse import OptionParser
|
||||
from subprocess import Popen, PIPE
|
||||
|
@ -8,7 +8,7 @@ script outputs a list of all tests it generated in the format of Mozilla
|
||||
reftest.list to the stdout.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import unicode_literals, print_function, absolute_import
|
||||
|
||||
TEST_FILE = 'text-emphasis-line-height-{:03}{}.html'
|
||||
TEST_TEMPLATE = '''<!DOCTYPE html>
|
||||
|
@ -9,7 +9,7 @@ test files are generated by this script. It also outputs a list of all
|
||||
tests it generated in the format of Mozilla reftest.list to the stdout.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import unicode_literals, print_function, absolute_import
|
||||
|
||||
import itertools
|
||||
|
||||
|
@ -7,7 +7,7 @@ emphasis marks with ruby in four directions. It outputs a list of all
|
||||
tests it generated in the format of Mozilla reftest.list to the stdout.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import unicode_literals, print_function, absolute_import
|
||||
|
||||
TEST_FILE = 'text-emphasis-ruby-{:03}{}.html'
|
||||
TEST_TEMPLATE = '''<!DOCTYPE html>
|
||||
|
@ -8,7 +8,7 @@ and <string>, with horizontal writing mode. It outputs a list of all
|
||||
tests it generated in the format of Mozilla reftest.list to the stdout.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import unicode_literals, print_function, absolute_import
|
||||
|
||||
TEST_FILE = 'text-emphasis-style-property-{:03}{}.html'
|
||||
TEST_TEMPLATE = '''<!DOCTYPE html>
|
||||
|
@ -18,7 +18,7 @@ So there are 49 different combinations. It outputs a list of all
|
||||
tests it generated in the format of Mozilla reftest.list to the stdout.
|
||||
"""
|
||||
|
||||
from __future__ import unicode_literals
|
||||
from __future__ import unicode_literals, print_function, absolute_import
|
||||
|
||||
TEST_FILE = 'segment-break-transformation-rules-{:03}.html'
|
||||
TEST_TEMPLATE = '''<!DOCTYPE html>
|
||||
|
@ -8,7 +8,6 @@ py3:
|
||||
- dom/canvas/test
|
||||
- gfx
|
||||
- ipc/ipdl
|
||||
- layout/reftests
|
||||
- layout/style/ServoCSSPropList.mako.py
|
||||
- security/manager/ssl
|
||||
- testing/awsy
|
||||
|
Loading…
Reference in New Issue
Block a user