summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/filter-effects/animation/backdrop-filter-interpolation-003.html
blob: a8508bb4451305d7b07e7e3e10ff95dd79476cec (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>backdrop-filter interpolation</title>
    <link rel="help" href="https://drafts.fxtf.org/filter-effects-2/#BackdropFilterProperty">
    <meta name="assert" content="lacuna matches spec.">
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/css/support/interpolation-testcommon.js"></script>
    <style>
      body {
        color: blue;
      }
    </style>
  </head>
  <body>
    <script>
      'use strict';

      test_interpolation({
        property: 'backdrop-filter',
        from: 'none', // lacuna is 0px
        to: 'blur(10px)'
      }, [
        {at: -1, expect: 'blur(0px)'}, // Negative values are not allowed.
        {at: 0.5, expect: 'blur(5px)'},
        {at: 1, expect: 'blur(10px)'},
        {at: 1.5, expect: 'blur(15px)'}
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'brightness(0)',
        to: 'none' // lacuna is 1
      }, [
        {at: -1, expect: 'brightness(0)'}, // Negative values are not allowed.
        {at: 0, expect: 'brightness(0)'},
        {at: 0.5, expect: 'brightness(0.5)'},
        {at: 1.5, expect: 'brightness(1.5)'}
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'contrast(0)',
        to: 'none' // lacuna is 1
      }, [
        {at: -1, expect: 'contrast(0)'}, // Negative values are not allowed.
        {at: 0, expect: 'contrast(0)'},
        {at: 0.5, expect: 'contrast(0.5)'},
        {at: 1.5, expect: 'contrast(1.5)'}
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'none', // lacuna is drop-shadow(0px 0px 0px transparent)
        to: 'drop-shadow(20px 10px green)'
      }, [
        {at: -1, expect: 'drop-shadow(-20px -10px transparent)'},
        {at: 0.5, expect: 'drop-shadow(10px 5px rgba(0, 128, 0, 0.5))'},
        {at: 1, expect: 'drop-shadow(20px 10px green)'},
        {at: 1.5, expect: 'drop-shadow(30px 15px #00C000)'}
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'none', // lacuna is 0
        to: 'grayscale(1)'
      }, [
        {at: -1, expect: 'grayscale(0)'}, // Negative values are not allowed.
        {at: 0.5, expect: 'grayscale(0.5)'},
        {at: 1, expect: 'grayscale(1)'},
        {at: 1.5, expect: 'grayscale(1)'} // Should clamp values to 1.
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'none', // lacuna is 0deg
        to: 'hue-rotate(360deg)'
      }, [
        {at: -1, expect: 'hue-rotate(-360deg)'},
        {at: 0.5, expect: 'hue-rotate(180deg)'},
        {at: 1, expect: 'hue-rotate(360deg)'},
        {at: 1.5, expect: 'hue-rotate(540deg)'}
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'none', // lacuna is 0
        to: 'invert(1)'
      }, [
        {at: -1, expect: 'invert(0)'}, // Negative values are not allowed.
        {at: 0.5, expect: 'invert(0.5)'},
        {at: 1, expect: 'invert(1)'},
        {at: 1.5, expect: 'invert(1)'} // Should clamp values to 1.
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'opacity(0)',
        to: 'none' // lacuna is 1
      }, [
        {at: -1, expect: 'opacity(0)'}, // Negative values are not allowed.
        {at: 0, expect: 'opacity(0)'},
        {at: 0.5, expect: 'opacity(0.5)'},
        {at: 1.5, expect: 'opacity(1)'} // Should clamp values to 1.
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'saturate(0)',
        to: 'none' // lacuna is 1
      }, [
        {at: -1, expect: 'saturate(0)'}, // Negative values are not allowed.
        {at: 0, expect: 'saturate(0)'},
        {at: 0.5, expect: 'saturate(0.5)'},
        {at: 1.5, expect: 'saturate(1.5)'}
      ]);

      test_interpolation({
        property: 'backdrop-filter',
        from: 'none', // lacuna is 0
        to: 'sepia(1)'
      }, [
        {at: -1, expect: 'sepia(0)'}, // Negative values are not allowed.
        {at: 0.5, expect: 'sepia(0.5)'},
        {at: 1, expect: 'sepia(1)'},
        {at: 1.5, expect: 'sepia(1)'} // Should clamp values to 1.
      ]);

      test_no_interpolation({
        property: 'backdrop-filter',
        from: 'url("#svgfilter")',
        to: 'none', // lacuna is not defined
      });
    </script>
  </body>
</html>