File: random-serialize.tentative.html

package info (click to toggle)
firefox 149.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,767,760 kB
  • sloc: cpp: 7,416,064; javascript: 6,752,859; ansic: 3,774,850; python: 1,250,473; xml: 641,578; asm: 439,191; java: 186,617; sh: 56,634; makefile: 18,856; objc: 13,092; perl: 12,763; pascal: 5,960; yacc: 4,583; cs: 3,846; lex: 1,720; ruby: 1,002; php: 436; lisp: 258; awk: 105; sql: 66; sed: 53; csh: 10; exp: 6
file content (61 lines) | stat: -rw-r--r-- 3,233 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-values-5/#random">
<link rel="author" title="sam@webkit.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../support/parsing-testcommon.js"></script>
<div id=target></div>
<script>

test_valid_value('width', 'random(0px, 100px)');
test_valid_value('width', 'random(0px, 100px, 50px)');
test_valid_value('width', 'random(--foo, 0px, 100px)');
test_valid_value('width', 'random(auto, 0px, 100px)', 'random(0px, 100px)');
test_valid_value('width', 'random(--foo element-shared, 0px, 100px)');
test_valid_value('width', 'random(auto element-shared, 0px, 100px)', 'random(element-shared, 0px, 100px)');
test_valid_value('width', 'random(element-shared --foo, 0px, 100px)', 'random(--foo element-shared, 0px, 100px)');
test_valid_value('width', 'random(element-shared auto, 0px, 100px)', 'random(element-shared, 0px, 100px)');
test_valid_value('width', 'random(fixed 0.5, 0px, 100px)');
test_valid_value('width', 'random(--foo, 0px, 100px, 50px)');
test_valid_value('width', 'random(auto, 0px, 100px, 50px)', 'random(0px, 100px, 50px)');
test_valid_value('width', 'random(--foo element-shared, 0px, 100px, 50px)');
test_valid_value('width', 'random(auto element-shared, 0px, 100px, 50px)', 'random(element-shared, 0px, 100px, 50px)');
test_valid_value('width', 'random(element-shared --foo, 0px, 100px, 50px)', 'random(--foo element-shared, 0px, 100px, 50px)');
test_valid_value('width', 'random(element-shared auto, 0px, 100px, 50px)', 'random(element-shared, 0px, 100px, 50px)');
test_valid_value('width', 'random(fixed 0.5, 0px, 100px, 50px)');

// Test consistent types
test_valid_value('width', 'random(10px, 20%)');

// Test out of order.
test_valid_value('width', 'random(100px, 0px)');

// Test negative values
test_valid_value('width', 'random(-100px, -10px)');
test_valid_value('width', 'random(-100px, -10px, -5px)');

// Test mixed units.
test_valid_value('width', 'random(1em, 200rem)');

// Test nested expressions
test_valid_value('width', 'random(10 * 100px, 200em / 2)', 'random(1000px, 100em)');
test_valid_value('width', 'random(fixed calc(2 / 4), 0px, 100px)', 'random(fixed calc(0.5), 0px, 100px)');

// Test nested in expressions
test_valid_value('width', 'calc(2 * random(0px, 100px))');
test_valid_value('math-depth', 'add(random(0, 3))');
test_valid_value('color', 'rgb(random(0, 255) random(0, 255) random(0, 255))');
test_valid_value('color', 'rgb(from blue r g random(b, (150 + b)))');
test_valid_value('color', 'color-mix(in srgb, rgb(random(0, 255) 0 random(0, 255)), rgb(0 random(0, 255) 0))');

// Test other types
test_valid_value('max-lines', 'random(25, 50)');
test_valid_value('max-lines', 'random(25, 50, 5)');
test_valid_value('scale', 'random(0.5, 2.5)');
test_valid_value('scale', 'random(0.5, 2.5, 0.1)');
test_valid_value('rotate', 'random(25deg, 1turn)', 'random(25deg, 360deg)');
test_valid_value('rotate', 'random(25deg, 1turn, 5deg)', 'random(25deg, 360deg, 5deg)');
test_valid_value('transition-delay', 'random(25ms, 50s)', 'random(0.025s, 50s)');
test_valid_value('transition-delay', 'random(25ms, 50s, 5s)', 'random(0.025s, 50s, 5s)');

</script>