mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 818430 - Having line and token operators in the same query makes the scripts menulist behave weirdly, r=past
This commit is contained in:
parent
06a15377af
commit
e6e86f81a1
@ -754,6 +754,7 @@ FilterView.prototype = {
|
|||||||
if (!found) {
|
if (!found) {
|
||||||
found = true;
|
found = true;
|
||||||
view.selectedItem = item;
|
view.selectedItem = item;
|
||||||
|
view.refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Item not matched, hide the corresponding node.
|
// Item not matched, hide the corresponding node.
|
||||||
@ -778,9 +779,13 @@ FilterView.prototype = {
|
|||||||
*/
|
*/
|
||||||
_performLineSearch: function DVF__performLineSearch(aLine) {
|
_performLineSearch: function DVF__performLineSearch(aLine) {
|
||||||
// Don't search for lines if the input hasn't changed.
|
// Don't search for lines if the input hasn't changed.
|
||||||
if (this._prevSearchedLine != aLine && aLine > 0) {
|
if (this._prevSearchedLine != aLine && aLine) {
|
||||||
DebuggerView.editor.setCaretPosition(aLine - 1);
|
DebuggerView.editor.setCaretPosition(aLine - 1);
|
||||||
}
|
}
|
||||||
|
// Can't search for lines and tokens at the same time.
|
||||||
|
if (this._prevSearchedToken && !aLine) {
|
||||||
|
this._target.refresh();
|
||||||
|
}
|
||||||
this._prevSearchedLine = aLine;
|
this._prevSearchedLine = aLine;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -793,13 +798,17 @@ FilterView.prototype = {
|
|||||||
*/
|
*/
|
||||||
_performTokenSearch: function DVF__performTokenSearch(aToken) {
|
_performTokenSearch: function DVF__performTokenSearch(aToken) {
|
||||||
// Don't search for tokens if the input hasn't changed.
|
// Don't search for tokens if the input hasn't changed.
|
||||||
if (this._prevSearchedToken != aToken && aToken.length > 0) {
|
if (this._prevSearchedToken != aToken && aToken) {
|
||||||
let editor = DebuggerView.editor;
|
let editor = DebuggerView.editor;
|
||||||
let offset = editor.find(aToken, { ignoreCase: true });
|
let offset = editor.find(aToken, { ignoreCase: true });
|
||||||
if (offset > -1) {
|
if (offset > -1) {
|
||||||
editor.setSelection(offset, offset + aToken.length)
|
editor.setSelection(offset, offset + aToken.length)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Can't search for tokens and lines at the same time.
|
||||||
|
if (this._prevSearchedLine && !aToken) {
|
||||||
|
this._target.refresh();
|
||||||
|
}
|
||||||
this._prevSearchedToken = aToken;
|
this._prevSearchedToken = aToken;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ function test()
|
|||||||
}
|
}
|
||||||
|
|
||||||
function testScriptSearching() {
|
function testScriptSearching() {
|
||||||
|
let noMatchingScripts = gDebugger.L10N.getStr("noMatchingScriptsText");
|
||||||
var token;
|
var token;
|
||||||
|
|
||||||
gDebugger.DebuggerController.activeThread.resume(function() {
|
gDebugger.DebuggerController.activeThread.resume(function() {
|
||||||
@ -135,37 +136,87 @@ function testScriptSearching() {
|
|||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
"The editor didn't jump to the correct token. (6)");
|
"The editor didn't jump to the correct token. (6)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
write(":13#" + token);
|
write(":13#" + token);
|
||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
"The editor didn't jump to the correct token. (7)");
|
"The editor didn't jump to the correct token. (7)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
write(":#" + token);
|
write(":#" + token);
|
||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
"The editor didn't jump to the correct token. (8)");
|
"The editor didn't jump to the correct token. (8)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
write("::#" + token);
|
write("::#" + token);
|
||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
"The editor didn't jump to the correct token. (9)");
|
"The editor didn't jump to the correct token. (9)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
write(":::#" + token);
|
write(":::#" + token);
|
||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
"The editor didn't jump to the correct token. (10)");
|
"The editor didn't jump to the correct token. (10)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
|
||||||
|
write("#" + token + ":bogus");
|
||||||
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
|
"The editor didn't jump to the correct token. (6)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
write("#" + token + ":13");
|
||||||
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
|
"The editor didn't jump to the correct token. (7)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
write("#" + token + ":");
|
||||||
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
|
"The editor didn't jump to the correct token. (8)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
write("#" + token + "::");
|
||||||
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
|
"The editor didn't jump to the correct token. (9)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
write("#" + token + ":::");
|
||||||
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
|
"The editor didn't jump to the correct token. (10)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
|
||||||
write(":i am not a number");
|
write(":i am not a number");
|
||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
"The editor didn't remain at the correct token. (11)");
|
"The editor didn't remain at the correct token. (11)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
write("#__i do not exist__");
|
write("#__i do not exist__");
|
||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
"The editor didn't remain at the correct token. (12)");
|
"The editor didn't remain at the correct token. (12)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
|
||||||
token = "debugger";
|
token = "debugger";
|
||||||
@ -173,17 +224,23 @@ function testScriptSearching() {
|
|||||||
ok(gEditor.getCaretPosition().line == 2 &&
|
ok(gEditor.getCaretPosition().line == 2 &&
|
||||||
gEditor.getCaretPosition().col == 44 + token.length,
|
gEditor.getCaretPosition().col == 44 + token.length,
|
||||||
"The editor didn't jump to the correct token. (12.1)");
|
"The editor didn't jump to the correct token. (12.1)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
EventUtils.sendKey("RETURN");
|
EventUtils.sendKey("RETURN");
|
||||||
ok(gEditor.getCaretPosition().line == 2 &&
|
ok(gEditor.getCaretPosition().line == 2 &&
|
||||||
gEditor.getCaretPosition().col == 44 + token.length,
|
gEditor.getCaretPosition().col == 44 + token.length,
|
||||||
"The editor shouldn't jump to another token. (12.2)");
|
"The editor shouldn't jump to another token. (12.2)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
EventUtils.sendKey("ENTER");
|
EventUtils.sendKey("ENTER");
|
||||||
ok(gEditor.getCaretPosition().line == 2 &&
|
ok(gEditor.getCaretPosition().line == 2 &&
|
||||||
gEditor.getCaretPosition().col == 44 + token.length,
|
gEditor.getCaretPosition().col == 44 + token.length,
|
||||||
"The editor shouldn't jump to another token. (12.3)");
|
"The editor shouldn't jump to another token. (12.3)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
|
|
||||||
write(":1:2:3:a:b:c:::12");
|
write(":1:2:3:a:b:c:::12");
|
||||||
@ -196,7 +253,6 @@ function testScriptSearching() {
|
|||||||
gEditor.getCaretPosition().col == 44 + token.length,
|
gEditor.getCaretPosition().col == 44 + token.length,
|
||||||
"The editor didn't jump to the correct token. (14)");
|
"The editor didn't jump to the correct token. (14)");
|
||||||
|
|
||||||
|
|
||||||
EventUtils.sendKey("DOWN");
|
EventUtils.sendKey("DOWN");
|
||||||
ok(gEditor.getCaretPosition().line == 8 &&
|
ok(gEditor.getCaretPosition().line == 8 &&
|
||||||
gEditor.getCaretPosition().col == 2 + token.length,
|
gEditor.getCaretPosition().col == 2 + token.length,
|
||||||
@ -229,6 +285,8 @@ function testScriptSearching() {
|
|||||||
"The editor didn't remain at the correct token. (19)");
|
"The editor didn't remain at the correct token. (19)");
|
||||||
is(gScripts.visibleItems, 1,
|
is(gScripts.visibleItems, 1,
|
||||||
"Not all the scripts are shown after the search. (20)");
|
"Not all the scripts are shown after the search. (20)");
|
||||||
|
isnot(gMenulist.getAttribute("label"), noMatchingScripts,
|
||||||
|
"The menulist should not display a notice that matches are found.");
|
||||||
|
|
||||||
closeDebuggerAndFinish();
|
closeDebuggerAndFinish();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user