mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-02-23 19:49:43 +01:00
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Workspace support for pwa is now limited, it is tight to specific Profile launch. If you create a pwa app with a profile other than "Default", launch will fail. Then you have to manually configure that profile to launch. This pr fix it by launching with shell:appsfolder\appusermodelId <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [X] **Closes:** #36384 - [ ] **Communication:** I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end user facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - [X] Create a new workspace with a pwa app(Other than default profile) should be no problem. - [X] Existing workspace with a pwa(default profile and other profile) should launch successfully without problem 1. with pt version 91.1, create a loop pwa with "Profile 1" instead of "Default" in edge. 2. capture and launch actually launch the edge instead of loop 3. Create profile with this impl and launch 4. Launch pwa successfully --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
101 lines
3.0 KiB
C++
101 lines
3.0 KiB
C++
#include "pch.h"
|
|
|
|
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
|
|
|
namespace WorkspacesLibUnitTests
|
|
{
|
|
TEST_CLASS (PwaHelperTests)
|
|
{
|
|
public:
|
|
TEST_METHOD (PwaHelper_Constructor_DoesNotThrow)
|
|
{
|
|
// Act & Assert - Constructor should not crash when called
|
|
try
|
|
{
|
|
Utils::PwaHelper helper;
|
|
// If we get here, the constructor didn't throw
|
|
Assert::IsTrue(true);
|
|
}
|
|
catch (...)
|
|
{
|
|
Assert::Fail(L"PwaHelper constructor should not throw exceptions");
|
|
}
|
|
}
|
|
|
|
TEST_METHOD (PwaHelper_GetEdgeAppId_EmptyAumid_ReturnsEmpty)
|
|
{
|
|
// Arrange
|
|
Utils::PwaHelper helper;
|
|
std::wstring emptyAumid = L"";
|
|
|
|
// Act
|
|
auto result = helper.GetEdgeAppId(emptyAumid);
|
|
|
|
// Assert
|
|
Assert::IsFalse(result.has_value());
|
|
}
|
|
|
|
TEST_METHOD (PwaHelper_GetChromeAppId_EmptyAumid_ReturnsEmpty)
|
|
{
|
|
// Arrange
|
|
Utils::PwaHelper helper;
|
|
std::wstring emptyAumid = L"";
|
|
|
|
// Act
|
|
auto result = helper.GetChromeAppId(emptyAumid);
|
|
|
|
// Assert
|
|
Assert::IsFalse(result.has_value());
|
|
}
|
|
|
|
TEST_METHOD (PwaHelper_SearchPwaName_EmptyParameters_ReturnsEmpty)
|
|
{
|
|
// Arrange
|
|
Utils::PwaHelper helper;
|
|
std::wstring emptyPwaAppId = L"";
|
|
std::wstring emptyWindowAumid = L"";
|
|
|
|
// Act
|
|
std::wstring result = helper.SearchPwaName(emptyPwaAppId, emptyWindowAumid);
|
|
|
|
// Assert
|
|
Assert::IsTrue(result.empty());
|
|
}
|
|
|
|
TEST_METHOD (PwaHelper_SearchPwaName_NonExistentIds_ReturnsEmpty)
|
|
{
|
|
// Arrange
|
|
Utils::PwaHelper helper;
|
|
std::wstring nonExistentPwaAppId = L"nonexistent_app_id";
|
|
std::wstring nonExistentWindowAumid = L"nonexistent_aumid";
|
|
|
|
// Act
|
|
std::wstring result = helper.SearchPwaName(nonExistentPwaAppId, nonExistentWindowAumid);
|
|
|
|
// TODO: is it really expected?
|
|
Assert::IsTrue(result == nonExistentWindowAumid);
|
|
}
|
|
|
|
TEST_METHOD (PwaHelper_GetEdgeAppId_ValidConstruction_DoesNotCrash)
|
|
{
|
|
// Arrange
|
|
Utils::PwaHelper helper;
|
|
std::wstring testAumid = L"Microsoft.MicrosoftEdge_8wekyb3d8bbwe!App";
|
|
|
|
// Act & Assert - Should not crash
|
|
auto result = helper.GetEdgeAppId(testAumid);
|
|
// Result can be empty or have value, but should not crash
|
|
}
|
|
|
|
TEST_METHOD (PwaHelper_GetChromeAppId_ValidConstruction_DoesNotCrash)
|
|
{
|
|
// Arrange
|
|
Utils::PwaHelper helper;
|
|
std::wstring testAumid = L"Chrome.App.TestId";
|
|
|
|
// Act & Assert - Should not crash
|
|
auto result = helper.GetChromeAppId(testAumid);
|
|
// Result can be empty or have value, but should not crash
|
|
}
|
|
};
|
|
} |