Bug 1783133: Don't report unexpected test passes when CTW is enabled for bugs that CTW fixes. r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D153718
This commit is contained in:
James Teh 2022-08-08 23:41:41 +00:00
parent 51b7446d62
commit 01e1aa0df7
5 changed files with 34 additions and 32 deletions

View File

@ -18,6 +18,15 @@ const EndPoint_End = nsIAccessibleTextRange.EndPoint_End;
const kTodo = 1; // a test is expected to fail
const kOk = 2; // a test doesn't fail
// Flag to pass to testTextAtOffset for tests fixed by TextLeafPoint.
// if TextLeafPoint is enabled, those tests should pass. If not, they
// should be expected failures.
const kOkIfCache = Services.prefs.getBoolPref(
"accessibility.cache.enabled",
false
)
? kOk
: kTodo;
/**
* Test characterCount for the given array of accessibles.

View File

@ -379,8 +379,10 @@
] );
var line4 = [ // "riend "
[ "TextBeforeOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ],
[ "TextAfterOffset", BOUNDARY_WORD_END, kTodo, kTodo, kTodo ],
[ "TextBeforeOffset", BOUNDARY_WORD_END,
kOkIfCache, kOkIfCache, kOkIfCache],
[ "TextAfterOffset", BOUNDARY_WORD_END,
kOkIfCache, kOkIfCache, kOkIfCache ],
];
traverseTextByLines(gQueue, "ta_wrapped",
[ [ "hi ", "", 0, 3, { words: [ 0, 2 ] } ],

View File

@ -61,7 +61,7 @@
// XXX: see bug 634202.
testTextAtOffset(0, BOUNDARY_LINE_START, "line ", 0, 5,
"hypertext4", kTodo, kOk, kTodo);
"hypertext4", kOkIfCache, kOk, kOkIfCache);
// ////////////////////////////////////////////////////////////////////////
// list

View File

@ -11,25 +11,16 @@
src="../text.js"></script>
<script type="application/javascript">
function doTest() {
const isCacheEnabled = Services.prefs.getBoolPref(
"accessibility.cache.enabled",
false
);
// Flag to pass to testTextAtOffset for tests fixed by TextLeafPoint.
// if TextLeafPoint is enabled, those tests should pass. If not, they
// should be expected failures.
const okIfCache = isCacheEnabled ? kOk : kTodo;
testTextAtOffset("line_test_1", BOUNDARY_LINE_START,
[[0, 6, "Line 1 ", 0, 7],
// See the okIfCache test below.
// See the kOkIfCache test below.
// [7, 7, kEmbedChar, 7, 8],
[8, 15, "Line 3 ", 8, 15]]);
testTextAtOffset(/* aOffset */ 7, BOUNDARY_LINE_START,
kEmbedChar, /* aStartOffset */ 7, /* aEndOffset */ 8,
"line_test_1",
/* returned text */ okIfCache,
/* returned start offset */ kOk, /* returned end offset */ okIfCache);
/* returned text */ kOkIfCache,
/* returned start offset */ kOk, /* returned end offset */ kOkIfCache);
// ////////////////////////////////////////////////////////////////////////
// __h__e__l__l__o__ __m__y__ __f__r__i__e__n__d__
@ -237,16 +228,16 @@
// A line with an empty display: contents leaf in the middle.
testTextAtOffset([ "displayContents" ], BOUNDARY_LINE_START,
// See the okIfCache test below.
// See the kOkIfCache test below.
// [ [0, 3, `a${kEmbedChar}b`, 0, 3] ]);
[ [0, 0, `a${kEmbedChar}b`, 0, 3],
[2, 3, `a${kEmbedChar}b`, 0, 3] ]);
testTextAtOffset(/* aOffset */ 1, BOUNDARY_LINE_START,
`a${kEmbedChar}b`, /* aStartOffset */ 0, /* aEndOffset */ 3,
"displayContents",
/* returned text */ okIfCache,
/* returned start offset */ okIfCache,
/* returned end offset */ okIfCache);
/* returned text */ kOkIfCache,
/* returned start offset */ kOkIfCache,
/* returned end offset */ kOkIfCache);
// A line which wraps, followed by a br, followed by another line.
testTextAtOffset([ "brAfterWrapped" ], BOUNDARY_LINE_START,

View File

@ -197,14 +197,14 @@
testTextBeforeOffset(ids, BOUNDARY_WORD_END,
[ [ 0, 7, "", 0, 0 ],
[ 8, 12, "oneword", 0, 7,
[ [ 8, "ml_divbr1", kTodo, kOk, kTodo ],
[ 8, "ml_edivbr1", kTodo, kOk, kTodo ],
[ 9, "ml_divbr1", kTodo, kOk, kTodo ],
[ 9, "ml_edivbr1", kTodo, kOk, kTodo ] ] ],
[ [ 8, "ml_divbr1", kOkIfCache, kOk, kOkIfCache ],
[ 8, "ml_edivbr1", kOkIfCache, kOk, kOkIfCache ],
[ 9, "ml_divbr1", kOkIfCache, kOk, kOkIfCache ],
[ 9, "ml_edivbr1", kOkIfCache, kOk, kOkIfCache ] ] ],
[ 13, 18, "\n\ntwo", 7, 12 ],
[ 19, 19, " words", 12, 18,
[ [ 19, "ml_divbr1", kTodo, kTodo, kTodo ],
[ 19, "ml_edivbr1", kTodo, kTodo, kTodo ] ] ],
[ [ 19, "ml_divbr1", kOkIfCache, kOkIfCache, kOkIfCache ],
[ 19, "ml_edivbr1", kOkIfCache, kOkIfCache, kOkIfCache ] ] ],
] );
testTextAtOffset(ids, BOUNDARY_WORD_START,
@ -216,10 +216,10 @@
[ 7, 11, "\n\ntwo", 7, 12 ],
[ 12, 17, " words", 12, 18 ],
[ 18, 19, "\n", 18, 19,
[ [ 18, "ml_divbr1", kTodo, kTodo, kOk ],
[ 18, "ml_edivbr1", kTodo, kTodo, kOk ],
[ 19, "ml_divbr1", kTodo, kTodo, kOk ],
[ 19, "ml_edivbr1", kTodo, kTodo, kOk ] ] ] ]);
[ [ 18, "ml_divbr1", kOkIfCache, kOkIfCache, kOk ],
[ 18, "ml_edivbr1", kOkIfCache, kOkIfCache, kOk ],
[ 19, "ml_divbr1", kOkIfCache, kOkIfCache, kOk ],
[ 19, "ml_edivbr1", kOkIfCache, kOkIfCache, kOk ] ] ] ]);
testTextAfterOffset(ids, BOUNDARY_WORD_START,
[ [ 0, 8, "two ", 9, 13 ],
@ -229,8 +229,8 @@
[ [ 0, 7, "\n\ntwo", 7, 12 ],
[ 8, 12, " words", 12, 18 ],
[ 13, 18, "\n", 18, 19,
[ [ 18, "ml_divbr1", kTodo, kTodo, kOk ],
[ 18, "ml_edivbr1", kTodo, kTodo, kOk ] ] ],
[ [ 18, "ml_divbr1", kOkIfCache, kOkIfCache, kOk ],
[ 18, "ml_edivbr1", kOkIfCache, kOkIfCache, kOk ] ] ],
[ 19, 19, "", 19, 19 ] ]);
// a <a href="#">b</a>
@ -280,7 +280,7 @@
[ 0, 1, "a ", 0, 2 ],
[ 2, 3, `${kEmbedChar} `, 2, 4, [
// Word at offset 2 returns end offset 3, should be 4.
[ 2, "multiword_embed", kTodo, kOk, kTodo ]
[ 2, "multiword_embed", kOkIfCache, kOk, kOkIfCache ]
] ],
[ 4, 5, "b", 4, 5 ]
]);