Release v0.6.57: multi-PC input, shared clipboard and resilient Settings Save
This commit is contained in:
1 parent
82292c8a7e
commit
5de010ee44
39 files changed
+1707
-312
No files matched your search
@@ -1,6 +1,7 @@
|
||||
#include "autocorrect.h"
|
||||
#include "history_preview.h"
|
||||
#include "ocr.h"
|
||||
#include "lan_clipboard_image.h"
|
||||
#include "richtext.h"
|
||||
#include "storage.h"
|
||||
#include "diagnostics.h"
|
||||
@@ -895,6 +896,33 @@ int main(int argc, char **argv)
|
||||
ks::validateTesseract(options);
|
||||
require(true, "Windows OCR works without optional installation");
|
||||
}
|
||||
{
|
||||
ks::History h(temp/L"computer-origins");auto clip=ks::textClip(L"shared text");
|
||||
h.add(clip,L"editor",settings);
|
||||
h.add(clip,L"editor",settings,"peer-a",L"Office PC");
|
||||
h.add(clip,L"editor",settings,"peer-a",L"Office PC");
|
||||
require(h.entries().size()==2,"duplicate suppression preserves different clipboard sources");
|
||||
ks::History restored(temp/L"computer-origins");
|
||||
require(restored.entries().front().computer=="peer-a"&&restored.entries().front().computerName==L"Office PC","computer metadata survives history reload");
|
||||
require(restored.entries().back().computer.empty(),"legacy and local records remain local");
|
||||
}
|
||||
{
|
||||
ks::Pixels pixels{1920,1080,ks::Bytes(1920*1080*4,255)};
|
||||
for(size_t i=0;i<pixels.bgra.size();i+=4){pixels.bgra[i]=static_cast<unsigned char>((i/4)%1920/16);pixels.bgra[i+1]=static_cast<unsigned char>((i/4)/1920/16);}
|
||||
ks::Clip original;original.formats.push_back(ks::imageDib(pixels));
|
||||
original.formats.push_back({RegisterClipboardFormatW(L"PNG"),L"PNG",ks::encodePng(pixels)});
|
||||
auto packed=ks::lan::compactClipboardImage(original);
|
||||
require(packed.formats.size()==1&&packed.formats[0].name==L"PNG","LAN sends only one image format");
|
||||
require(packed.size()*10<original.size(),"screen-like image LAN payload reduced by more than 90 percent");
|
||||
require(ks::decodeImage(packed).bgra==pixels.bgra,"LAN PNG preserves exact pixels");
|
||||
auto paste=ks::lan::clipboardImageForPaste(packed);
|
||||
require(std::any_of(paste.formats.begin(),paste.formats.end(),[](const auto &f){return f.id==CF_DIB||f.id==CF_DIBV5;}),"LAN receiver restores a DIB for ordinary paste");
|
||||
original.formats.pop_back();
|
||||
require(ks::decodeImage(ks::lan::compactClipboardImage(original)).bgra==pixels.bgra,"DIB-only clipboard is losslessly compressed");
|
||||
auto text=ks::textClip(L"plain text");
|
||||
require(ks::encodeClip(ks::lan::compactClipboardImage(text))==ks::encodeClip(text),"LAN text clipboard remains unchanged");
|
||||
std::cout<<"LAN screenshot bytes: "<<original.size()<<" -> "<<packed.size()<<"\n";
|
||||
}
|
||||
// Test-owned directory only; never touch the user's clipboard or stored history.
|
||||
std::filesystem::remove_all(temp);
|
||||
CoUninitialize();
|
||||
|
||||
Reference in new issue
Block a user