feat: improve desktop path selection and USB connection recovery

This commit is contained in:
tongtong committed 2026-11-13 03:14:00 +08:00
1 parent 5aa575f182
commit 6490665af8
28 files changed
+846 -51

No files matched your search

@@ -0,0 +1,21 @@
using Ads.Desktop;
using Xunit;
namespace Ads.Desktop.Tests;
public class SelectedPathTests
{
[Fact]
public void SelectedToolIsSavedEvenWhileServerTextIsInvalid()
{
var folder=Path.Combine(Path.GetTempPath(),"ads-path-"+Guid.NewGuid().ToString("N"));
try {
using var vm=new MainViewModel(folder,backgroundMonitoring:false,loadLocalCredentials:false);
vm.Server="incomplete address";
vm.AdbPath="C:/tools/adb.exe";
vm.UsbipPath="C:/tools/usbip.exe";
vm.PersistSelectedPaths();
var saved=DesktopPaths.LoadSettings(Path.Combine(folder,"settings.json"));
Assert.Equal(vm.AdbPath,saved.Adb);
Assert.Equal(vm.UsbipPath,saved.UsbipPath);
} finally {if(Directory.Exists(folder))Directory.Delete(folder,true);}
}
}