blob: 68fdd13d8b9bb52277a63a78e68bbe04932a13a4 [file] [log] [blame] [edit]
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/accessibility-helper.js"></script>
<script src="../../../resources/js-test.js"></script>
</head>
<body>
<p id="text-plain">The</p>
<p id="text-bold" style="font-weight: bold">Fox</p>
<p id="text-italic" style="font-style: italic">Jumped</p>
<p id="text-bold-italic" style="font-style: italic; font-weight: bold;">Over</p>
<script>
description("This test ensures that attributed string for text marker range includes text styling information.");
if (window.accessibilityController) {
var textPlain = accessibilityController.accessibleElementById("text-plain");
var textPlainRange = textPlain.textMarkerRangeForElement(textPlain);
var textPlainAttributes = `Attributes in range {0, 3}:
AXFont: {
AXFontFamily = Times;
AXFontName = "Times-Roman";
AXFontSize = 16;
}
AXForegroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 1 )
AXBackgroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 0 )
The`;
shouldBe("textPlain.attributedStringForTextMarkerRange(textPlainRange)", "textPlainAttributes");
var textBold = accessibilityController.accessibleElementById("text-bold");
var textBoldRange = textBold.textMarkerRangeForElement(textBold);
var textBoldAttributes = `Attributes in range {0, 3}:
AXFont: {
AXFontBold = 1;
AXFontFamily = Times;
AXFontName = "Times-Bold";
AXFontSize = 16;
}
AXForegroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 1 )
AXBackgroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 0 )
Fox`;
shouldBe("textBold.attributedStringForTextMarkerRange(textBoldRange)", "textBoldAttributes");
var textItalic = accessibilityController.accessibleElementById("text-italic");
var textItalicRange = textItalic.textMarkerRangeForElement(textItalic);
var textItalicAttributes = `Attributes in range {0, 6}:
AXFont: {
AXFontFamily = Times;
AXFontItalic = 1;
AXFontName = "Times-Italic";
AXFontSize = 16;
}
AXForegroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 1 )
AXBackgroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 0 )
Jumped`;
shouldBe("textItalic.attributedStringForTextMarkerRange(textItalicRange)", "textItalicAttributes");
var textBoldItalic = accessibilityController.accessibleElementById("text-bold-italic");
var textBoldItalicRange = textBoldItalic.textMarkerRangeForElement(textBoldItalic);
var textBoldItalicAttributes = `Attributes in range {0, 4}:
AXFont: {
AXFontBold = 1;
AXFontFamily = Times;
AXFontItalic = 1;
AXFontName = "Times-BoldItalic";
AXFontSize = 16;
}
AXForegroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 1 )
AXBackgroundColor: (kCGColorSpaceICCBased; kCGColorSpaceModelRGB; sRGB IEC61966-2.1) ( 0 0 0 0 )
Over`;
shouldBe("textBoldItalic.attributedStringForTextMarkerRange(textBoldItalicRange)", "textBoldItalicAttributes");
}
</script>
</body>
</html>