Beispiel #1
0
def srcset():
    values = [image_url()]
    if Random.bool():
        values.append("{}w".format(Random.integer()))
    if Random.bool():
        values.append("{}x".format(Random.integer()))
    return cat(values)
Beispiel #2
0
def length(relative=False):
    if (not relative) or Random.bool():
        if Random.bool():
            return "{}px".format(Random.integer())
        else:
            return "{}em".format(Random.number())
    else:
        return "{}{}".format(Random.integer(),
                             Random.choice(["vw", "vh", "vmin", "vmax"]))
Beispiel #3
0
def line_to():
    if Random.bool():
        cmd = Random.choice(["L", "l"])
        x = Random.integer()
        y = Random.integer()
        return "{} {},{}".format(cmd, x, y)
    else:
        cmd = Random.choice(["H", "h", "V", "v"])
        x = Random.integer()
        return "{} {}".format(cmd, x)
Beispiel #4
0
def arc_curve():
    cmd = Random.choice(["A", "a"])
    rx = Random.integer()
    ry = Random.integer()
    _angle = Random.integer()
    large_arc_flag = Random.range(0, 1)
    sweep_flag = Random.range(0, 1)
    dx = Random.integer()
    dy = Random.integer()
    return "{} {} {} {} {} {} {},{}".format(cmd, rx, ry, _angle,
                                            large_arc_flag, sweep_flag, dx, dy)
Beispiel #5
0
def tab_index():
    c = Random.selector(3)
    if c == 0:
        return "-1"
    elif c == 1:
        return str(Random.range(0, 5))
    else:
        return Random.integer()
Beispiel #6
0
 def generate(self, _):
     c = Random.selector(3)
     if c == 0:
         self.value = "auto"
     elif c == 1:
         self.value = "auto-reverse"
     else:
         self.value = Random.integer()
Beispiel #7
0
 def generate(self, _):
     if Random.bool():
         self.value = "accumulate"
     else:
         values = ["new"]
         if Random.bool():
             values.extend([Random.integer() for _ in range(4)])
         self.value = cat(values)
Beispiel #8
0
def coords():
    c = Random.selector(3)
    if c == 0:
        n = 4
    elif c == 1:
        n = 3
    else:
        n = Random.range(3, 5) * 2
    return seq([Random.integer() for _ in range(n)])
Beispiel #9
0
 def generate_rel1(self, context):
     self.abs = None
     self.action = None
     self.repeat_num = None
     self.event = None
     self.elem = context.get_object(docs.svg_animation_elements)
     if self.elem is None:
         self.generate_abs()
         return
     self.action = Random.choice(["begin", "end", "repeat"])
     if self.action == "repeat":
         self.repeat_num = Random.integer()
Beispiel #10
0
def media_query():
    media_type = Random.choice(["all", "print", "screen"])
    if Random.bool():
        return media_type

    media_feature = Random.choice(
        ["min-width", "max-width", "min-height", "max-height", "orientation"])
    if media_feature == "orientation":
        media_feature_value = Random.choice(["portrait", "landscape"])
    else:
        media_feature_value = "{}px".format(Random.integer())
    return "{} and ({}:{})".format(media_type, media_feature,
                                   media_feature_value)
Beispiel #11
0
 def single():
     values = [
         "'{}'".format(
             Random.choice([
                 "smcp", "c2sc", "zero", "hist", "liga", "tnum", "frac",
                 "swsh", "ss07", "dlig", "vert", "hwid", "twid", "qwid",
                 "kern", "onum"
             ]))
     ]
     if Random.bool():
         if Random.bool():
             values.append(Random.choice(["on", "off"]))
         else:
             values.append(Random.integer())
     return cat(values)
Beispiel #12
0
 def generate(self, _):
     self.value = Random.integer() if Random.bool() else "indefinite"
Beispiel #13
0
 def generate(self, _):
     self.value = cat([Random.integer() for _ in range(10)])
Beispiel #14
0
 def generate(self, _):
     self.value = seq([Random.integer() for _ in range(4)])
Beispiel #15
0
 def generate(self, _):
     if Random.bool():
         self.value = dv.length_percentage()
     else:
         self.value = Random.integer()
Beispiel #16
0
def coordinate():
    return seq([Random.integer(), Random.integer()])
Beispiel #17
0
def index():
    if Random.selector(5) == 0:
        return Random.integer()
    else:
        return str(Random.range(0, 8))
Beispiel #18
0
 def generate(self, _):
     self.value = Random.integer()
Beispiel #19
0
 def generate(self, _):
     if Random.bool():
         self.value = "infinite"
     else:
         self.value = Random.integer()
Beispiel #20
0
 def generate(self, _):
     self.value = "{} x {}".format(Random.integer(), Random.integer())
Beispiel #21
0
def nth():
    if Random.bool():
        return Random.choice(["even", "odd"])
    else:
        return Random.integer()
Beispiel #22
0
def move_to():
    cmd = Random.choice(["M", "m"])
    x = Random.integer()
    y = Random.integer()
    return "{} {},{}".format(cmd, x, y)
Beispiel #23
0
def bezier_curve():
    c = Random.selector(3)
    if c == 0:
        cmd = Random.choice(["C", "c"])
        x1 = Random.integer()
        y1 = Random.integer()
        x2 = Random.integer()
        y2 = Random.integer()
        x = Random.integer()
        y = Random.integer()
        return "{} {},{} {},{} {},{}".format(cmd, x1, y1, x2, y2, x, y)
    elif c == 1:
        cmd = Random.choice(["Q", "q", "S", "s"])
        x2 = Random.integer()
        y2 = Random.integer()
        x = Random.integer()
        y = Random.integer()
        return "{} {},{} {},{}".format(cmd, x2, y2, x, y)
    else:
        cmd = Random.choice(["T", "t"])
        x = Random.integer()
        y = Random.integer()
        return "{} {},{}".format(cmd, x, y)
Beispiel #24
0
 def generate(self, _):
     values = [dv.angle()]
     if Random.bool():
         values.extend([Random.integer(), Random.integer()])
     self.value = cat(values)
Beispiel #25
0
def marquee_loop():
    if Random.bool():
        return "-1"
    else:
        return Random.integer()
Beispiel #26
0
 def generate(self, _):
     order = Random.range(0, 2)
     self.value = cat([Random.integer() for _ in range(order**2)])
Beispiel #27
0
def font_weight():
    if Random.bool():
        return Random.choice(["normal", "bold", "bolder", "lighter"])
    else:
        return Random.integer()
Beispiel #28
0
 def generate(self, _):
     self.value = "{{ delay: {}, direction: \"{}\", duration: {}, easing: \"{}\", endDelay: {}, fill: \"{}\", " \
                  "iterationStart: {}, iterations: {} }}".format(
         dv.clock_in_ms(), dv.animation_direction(), dv.clock_in_ms(), dv.animation_easing(),
         dv.clock_in_ms(), dv.animation_fill_mode(), Random.number(), Random.integer())
Beispiel #29
0
 def single():
     return "{}x{}".format(Random.integer(), Random.integer())