mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
LibWeb: Implement or stub FontFace interface's attribute getters/setters
We only support parsing half of these, so the ones we don't recognize get a friendly exception thrown.
This commit is contained in:
committed by
Sam Atkins
parent
de98c122d1
commit
2bc51f08d9
Notes:
sideshowbarker
2024-07-17 07:43:05 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/2bc51f08d9 Pull-request: https://github.com/SerenityOS/serenity/pull/24278 Reviewed-by: https://github.com/AtkinsSJ ✅ Reviewed-by: https://github.com/kalenikaliaksandr
58
Tests/LibWeb/Text/input/css/FontFace.html
Normal file
58
Tests/LibWeb/Text/input/css/FontFace.html
Normal file
@@ -0,0 +1,58 @@
|
||||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let face = new FontFace("Some font family", "url(some_font_family.ttf)");
|
||||
|
||||
println(`face.family: ${face.family}`);
|
||||
println(`face.style: ${face.style}`);
|
||||
println(`face.weight: ${face.weight}`);
|
||||
println(`face.stretch: ${face.stretch}`);
|
||||
|
||||
// FIXME: Implement setters for the following props:
|
||||
println(`face.unicodeRange: ${face.unicodeRange}`);
|
||||
println(`face.featureSettings: ${face.featureSettings}`);
|
||||
println(`face.variationSettings: ${face.variationSettings}`);
|
||||
println(`face.display: ${face.display}`);
|
||||
println(`face.ascentOverride: ${face.ascentOverride}`);
|
||||
println(`face.descentOverride: ${face.descentOverride}`);
|
||||
println(`face.lineGapOverride: ${face.lineGapOverride}`);
|
||||
|
||||
// Set valid values
|
||||
face.family = "Another font family";
|
||||
face.style = "italic";
|
||||
face.weight = "bold";
|
||||
face.stretch = "condensed";
|
||||
|
||||
println(`face.family: ${face.family}`);
|
||||
println(`face.style: ${face.style}`);
|
||||
println(`face.weight: ${face.weight}`);
|
||||
println(`face.stretch: ${face.stretch}`);
|
||||
|
||||
// Set invalid values and expect exception
|
||||
try {
|
||||
face.family = 1;
|
||||
} catch (e) {
|
||||
println(`face.family = 1: ${e}`);
|
||||
}
|
||||
|
||||
try {
|
||||
face.style = 1;
|
||||
} catch (e) {
|
||||
println(`face.style = 1: ${e}`);
|
||||
}
|
||||
|
||||
try {
|
||||
face.weight = "500kg";
|
||||
} catch (e) {
|
||||
println(`face.weight = 500kg: ${e}`);
|
||||
}
|
||||
|
||||
try {
|
||||
face.stretch = "super stretched";
|
||||
} catch (e) {
|
||||
println(`face.stretch = super stretched: ${e}`);
|
||||
}
|
||||
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user