Release v0.6.59: clarify sync results and refresh downloaded settings
This commit is contained in:
1 parent
d0387904a0
commit
4d8d8d47b9
16 files changed
+107
-28
No files matched your search
@@ -1,4 +1,5 @@
|
||||
#include "app.h"
|
||||
#include "configuration.h"
|
||||
#include "ui_scroll.h"
|
||||
#include "ui_geometry.h"
|
||||
#include "screenshot.h"
|
||||
@@ -752,6 +753,21 @@ int main(int argc, char **argv) {
|
||||
require(fitted.left==-600&&fitted.top==680&&fitted.right==0,"negative-coordinate monitor supported");
|
||||
ks::showSettings(app,false);
|
||||
{
|
||||
auto window = app.settingsWindow;
|
||||
auto previous = app.settings;
|
||||
TabCtrl_SetCurSel(GetDlgItem(window,260),3);
|
||||
app.settings.awake = !previous.awake;
|
||||
app.settings.maxItems = previous.maxItems + 1;
|
||||
SendMessageW(window,ks::ConfigSettingsDownloaded,0,0);
|
||||
wchar_t count[32]{};
|
||||
GetDlgItemTextW(window,240,count,32);
|
||||
require(app.settingsWindow == window &&
|
||||
SendDlgItemMessageW(window,205,BM_GETCHECK,0,0) == (app.settings.awake ? BST_CHECKED : BST_UNCHECKED) &&
|
||||
std::stoi(count) == app.settings.maxItems && TabCtrl_GetCurSel(GetDlgItem(window,260)) == 3,
|
||||
"download refreshes existing settings controls while preserving window and active tab");
|
||||
app.settings = previous;
|
||||
SendMessageW(window,ks::ConfigSettingsDownloaded,0,0);
|
||||
TabCtrl_SetCurSel(GetDlgItem(window,260),0);
|
||||
auto timer = SetTimer(nullptr, 0, 10, answerSettingsClose);
|
||||
require(timer != 0, "settings close prompt responder");
|
||||
SendMessageW(app.settingsWindow, WM_CLOSE, 0, 0);
|
||||
|
||||
+19
-1
@@ -298,6 +298,9 @@ int main()
|
||||
require(provider.writes == 1 && result.revision == 1, "no-op avoids versions");
|
||||
result = synchronize(provider, base, bytes(left), SyncAction::Download);
|
||||
require(parse(result.settings) == parse(base) && provider.writes == 1, "download never writes");
|
||||
require(result.downloaded, "explicit download requests a settings window refresh");
|
||||
require(result.status.find(L"Downloaded remote settings. Server version 1.") != std::wstring::npos,
|
||||
"explicit download reports its result and server version");
|
||||
provider.race = true;
|
||||
rejects([&] { synchronize(provider, base, bytes(left), SyncAction::Upload); }, "racing writer protected");
|
||||
require(provider.writes == 1 && provider.remote.settings == base, "CAS failure preserves remote");
|
||||
@@ -395,10 +398,25 @@ int main()
|
||||
rejects([&] { bao->read(); }, "permission denied is not absent");
|
||||
readStatus = 302;
|
||||
rejects([&] { bao->read(); }, "redirect response rejected");
|
||||
readStatus = 400;
|
||||
try { bao->read(); require(false, "download HTTP 400 must fail"); }
|
||||
catch (const std::runtime_error &e) {
|
||||
require(std::string(e.what()).find("download request (HTTP 400)") != std::string::npos,
|
||||
"download failure is not mislabeled as a write failure");
|
||||
}
|
||||
writeStatus = 400;
|
||||
rejects([&] { bao->write(base, 7); }, "server CAS refusal propagated");
|
||||
}
|
||||
require(logins == 1 && revokes == 1 && reads == 5 && writes == 2, "temporary login lifecycle");
|
||||
require(logins == 1 && revokes == 1 && reads == 6 && writes == 2, "temporary login lifecycle");
|
||||
try {
|
||||
makeSyncProvider(config, [](const std::wstring &, const std::wstring &, const std::wstring &, const Bytes &) {
|
||||
return SyncHttpResponse{400, {}};
|
||||
});
|
||||
require(false, "login HTTP 400 must fail");
|
||||
} catch (const std::runtime_error &e) {
|
||||
require(std::string(e.what()).find("authentication request (HTTP 400)") != std::string::npos,
|
||||
"login failure identifies authentication instead of a write");
|
||||
}
|
||||
forgetSyncPassword(config); forgetSyncPassword(config);
|
||||
++checks;
|
||||
std::filesystem::remove_all(root);
|
||||
|
||||
Reference in new issue
Block a user