1 parent
2ffee2f880
commit
59d01375ff
17 files changed
+496
-129
No files matched your search
+40
-1
@@ -423,7 +423,30 @@ int main(int argc, char **argv) {
|
||||
require(IsWindowVisible(GetDlgItem(dialog, 753)) && IsWindowVisible(GetDlgItem(dialog, 792)) &&
|
||||
!IsWindowVisible(GetDlgItem(dialog, 787)),
|
||||
"text insertion uses the crosshair and shows a multiline text editor");
|
||||
DestroyWindow(dialog);
|
||||
auto select = [&](int id, int row) {
|
||||
SendDlgItemMessageW(dialog, id, CB_SETCURSEL, row, 0);
|
||||
SendMessageW(dialog, WM_COMMAND, MAKEWPARAM(id, CBN_SELCHANGE), 0);
|
||||
};
|
||||
select(790, 2);
|
||||
require(IsWindowVisible(GetDlgItem(dialog, 797)) && IsWindowVisible(GetDlgItem(dialog, 799)) &&
|
||||
!IsWindowVisible(GetDlgItem(dialog, 753)) && !IsWindowVisible(GetDlgItem(dialog, 801)),
|
||||
"Open URL shows an address and browser without an unrelated crosshair or profile picker");
|
||||
select(799, 2);
|
||||
require(IsWindowVisible(GetDlgItem(dialog, 803)), "choosing another browser exposes the browser executable");
|
||||
select(799, 1);
|
||||
require(IsWindowVisible(GetDlgItem(dialog, 801)) && !IsWindowVisible(GetDlgItem(dialog, 803)),
|
||||
"choosing Chrome exposes the profile picker");
|
||||
SetDlgItemTextW(dialog, 783, L"Open project board");
|
||||
SetDlgItemTextW(dialog, 784, L"Ctrl+Alt+F10");
|
||||
SetDlgItemTextW(dialog, 797, L"https://example.com/board");
|
||||
SendMessageW(dialog, WM_COMMAND, IDOK, 0);
|
||||
require(!IsWindow(dialog) && ListView_GetItemCount(list) == 2, "adding Open URL updates the shortcut list");
|
||||
ListView_SetCheckState(list, 1, FALSE);
|
||||
SendMessageW(settings, WM_COMMAND, 272, 0);
|
||||
const auto persisted = ks::loadSettings(temp / L"settings.json", app.layouts).customShortcuts;
|
||||
require(persisted.size() == 2 && persisted[1].action == ks::CustomShortcutAction::OpenUrl &&
|
||||
persisted[1].url == L"https://example.com/board" && persisted[1].browser == ks::ShortcutBrowser::Chrome,
|
||||
"Apply persists the Open URL action and browser from the editor");
|
||||
DestroyWindow(settings);
|
||||
|
||||
const auto target = CreateWindowExW(0, L"STATIC", L"Shortcut target", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
@@ -468,6 +491,22 @@ int main(int argc, char **argv) {
|
||||
require(std::filesystem::exists(marker), newInstance ? "new-instance mode starts the program" :
|
||||
"activate mode starts the program if there is no matching window");
|
||||
}
|
||||
const auto browser = temp / L"browser-fixture.exe";
|
||||
std::filesystem::copy_file(std::filesystem::path(argv[2]), browser);
|
||||
const std::wstring url = L"https://example.com/board?view=a%20b&filter=active#notes";
|
||||
app.settings.customShortcuts[0] = {L"Open board", L"Ctrl+Alt+F9", browser.wstring(), true, false,
|
||||
ks::CustomShortcutAction::OpenUrl, L"", L"", 0, url, ks::ShortcutBrowser::Other};
|
||||
ks::InputRegressionAccess::invokeCustomShortcut(app, 0, VK_F9);
|
||||
const auto marker = temp / L"browser-fixture.exe.opened";
|
||||
for (const auto deadline = GetTickCount64() + 5000; GetTickCount64() < deadline;)
|
||||
{
|
||||
std::error_code ec;
|
||||
if (std::filesystem::file_size(marker, ec) == url.size()) break;
|
||||
Sleep(25);
|
||||
}
|
||||
const auto recorded = ks::readFile(marker, 1024);
|
||||
require(std::string(recorded.begin(), recorded.end()) == ks::utf8(url),
|
||||
"URL shortcut starts the chosen browser with the complete address as one argument");
|
||||
}
|
||||
std::filesystem::remove_all(temp);
|
||||
std::cout << "Passed " << checks << " custom shortcuts layout checks\n";
|
||||
|
||||
Reference in new issue
Block a user