forked from web-platform-tests/wpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidlharness.html
185 lines (151 loc) · 4.99 KB
/
idlharness.html
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8>
<title>Image Capture IDL test</title>
<link rel="help" href="https://w3c.github.io/mediacapture-image">
<link rel="idl" href="https://w3c.github.io/mediacapture-image/#idl-index">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/WebIDLParser.js"></script>
<script src="/resources/idlharness.js"></script>
</head>
<body>
<canvas id='canvas' width=10 height=10/>
<pre id="untested_idl" style="display: none">
interface Event {};
interface EventHandler {};
interface EventTarget {};
interface MediaStreamTrack {};
</pre>
<pre id="idl" style="display: none">
// https://w3c.github.io/mediacapture-image
[Constructor(MediaStreamTrack videoTrack)]
interface ImageCapture {
Promise<Blob> takePhoto(optional PhotoSettings photoSettings);
Promise<PhotoCapabilities> getPhotoCapabilities();
Promise<ImageBitmap> grabFrame();
readonly attribute MediaStreamTrack track;
};
interface PhotoCapabilities {
readonly attribute RedEyeReduction redEyeReduction;
readonly attribute MediaSettingsRange imageHeight;
readonly attribute MediaSettingsRange imageWidth;
readonly attribute FrozenArray<FillLightMode> fillLightMode;
};
dictionary PhotoSettings {
FillLightMode fillLightMode;
double imageHeight;
double imageWidth;
boolean redEyeReduction;
};
interface MediaSettingsRange {
readonly attribute double max;
readonly attribute double min;
readonly attribute double step;
};
enum RedEyeReduction {
"never",
"always",
"controllable",
};
enum FillLightMode {
"auto",
"off",
"flash",
};
// Partial dictionaries are unsupported, see
// https://github.com/w3c/testharness.js/issues/84
partial dictionary MediaTrackSupportedConstraints {
boolean whiteBalanceMode = true;
boolean exposureMode = true;
boolean focusMode = true;
boolean pointsOfInterest = true;
boolean exposureCompensation = true;
boolean colorTemperature = true;
boolean iso = true;
boolean brightness = true;
boolean contrast = true;
boolean saturation = true;
boolean sharpness = true;
boolean zoom = true;
boolean torch = true;
};
partial dictionary MediaTrackCapabilities {
sequence<DOMString> whiteBalanceMode;
sequence<DOMString> exposureMode;
sequence<DOMString> focusMode;
MediaSettingsRange exposureCompensation;
MediaSettingsRange colorTemperature;
MediaSettingsRange iso;
MediaSettingsRange brightness;
MediaSettingsRange contrast;
MediaSettingsRange saturation;
MediaSettingsRange sharpness;
MediaSettingsRange zoom;
boolean torch;
};
partial dictionary MediaTrackConstraintSet {
ConstrainDOMString whiteBalanceMode;
ConstrainDOMString exposureMode;
ConstrainDOMString focusMode;
ConstrainPoint2D pointsOfInterest;
ConstrainDouble exposureCompensation;
ConstrainDouble colorTemperature;
ConstrainDouble iso;
ConstrainDouble brightness;
ConstrainDouble contrast;
ConstrainDouble saturation;
ConstrainDouble sharpness;
ConstrainDouble zoom;
ConstrainBoolean torch;
};
partial dictionary MediaTrackSettings {
DOMString whiteBalanceMode;
DOMString exposureMode;
DOMString focusMode;
sequence<Point2D> pointsOfInterest;
double exposureCompensation;
double colorTemperature;
double iso;
double brightness;
double contrast;
double saturation;
double sharpness;
double zoom;
boolean torch;
};
dictionary ConstrainPoint2DParameters {
sequence<Point2D> exact;
sequence<Point2D> ideal;
};
typedef (sequence<Point2D> or ConstrainPoint2DParameters) ConstrainPoint2D;
enum MeteringMode {
"none",
"manual",
"single-shot",
"continuous"
};
dictionary Point2D {
double x = 0.0;
double y = 0.0;
};
</pre>
<script>
var canvas = document.getElementById('canvas');
var context = canvas.getContext("2d");
context.fillStyle = "red";
context.fillRect(0, 0, 10, 10);
var track = canvas.captureStream().getVideoTracks()[0];
var idl_array = new IdlArray();
idl_array.add_untested_idls(
document.getElementById("untested_idl").textContent);
idl_array.add_idls(document.getElementById("idl").textContent);
idl_array.add_objects({
ImageCapturer : [new ImageCapture(track)]
});
idl_array.test();
</script>
<div id="log"></div>
</body>
</html>