diff --git a/OpenConsole.sln b/OpenConsole.sln index efac4b8f7..65a12e008 100644 --- a/OpenConsole.sln +++ b/OpenConsole.sln @@ -243,6 +243,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TerminalAppLib", "src\casca {CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907} = {CA5CAD1A-D7EC-4107-B7C6-79CB77AE2907} EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LocalTests_TerminalApp", "src\cascadia\LocalTests_TerminalApp\TerminalApp.LocalTests.vcxproj", "{CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}" + ProjectSection(ProjectDependencies) = postProject + {CA5CAD1A-9A12-429C-B551-8562EC954746} = {CA5CAD1A-9A12-429C-B551-8562EC954746} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution AuditMode|ARM64 = AuditMode|ARM64 @@ -1087,6 +1092,24 @@ Global {CA5CAD1A-9A12-429C-B551-8562EC954746}.Release|x64.Build.0 = Release|x64 {CA5CAD1A-9A12-429C-B551-8562EC954746}.Release|x86.ActiveCfg = Release|Win32 {CA5CAD1A-9A12-429C-B551-8562EC954746}.Release|x86.Build.0 = Release|Win32 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|ARM64.ActiveCfg = AuditMode|ARM64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|ARM64.Build.0 = AuditMode|ARM64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|x64.ActiveCfg = AuditMode|x64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|x64.Build.0 = AuditMode|x64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|x86.ActiveCfg = AuditMode|Win32 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.AuditMode|x86.Build.0 = AuditMode|Win32 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|ARM64.Build.0 = Debug|ARM64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x64.ActiveCfg = Debug|x64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x64.Build.0 = Debug|x64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x86.ActiveCfg = Debug|Win32 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Debug|x86.Build.0 = Debug|Win32 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|ARM64.ActiveCfg = Release|ARM64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|ARM64.Build.0 = Release|ARM64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x64.ActiveCfg = Release|x64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x64.Build.0 = Release|x64 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x86.ActiveCfg = Release|Win32 + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1147,6 +1170,7 @@ Global {34DE34D3-1CD6-4EE3-8BD9-A26B5B27EC73} = {89CDCC5C-9F53-4054-97A4-639D99F169CD} {CA5CAD1A-9333-4D05-B12A-1905CBF112F9} = {59840756-302F-44DF-AA47-441A9D673202} {CA5CAD1A-9A12-429C-B551-8562EC954746} = {59840756-302F-44DF-AA47-441A9D673202} + {CA5CAD1A-B11C-4DDB-A4FE-C3AFAE9B5506} = {59840756-302F-44DF-AA47-441A9D673202} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3140B1B7-C8EE-43D1-A772-D82A7061A271} diff --git a/src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp b/src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp new file mode 100644 index 000000000..82bcfbe61 --- /dev/null +++ b/src/cascadia/LocalTests_TerminalApp/SettingsTests.cpp @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "precomp.h" + +#include "../TerminalApp/ColorScheme.h" + +using namespace Microsoft::Console; +using namespace TerminalApp; +using namespace WEX::Logging; +using namespace WEX::TestExecution; + +namespace TerminalAppLocalTests +{ + // Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab + // machine available that can run Windows version 18362. + + class SettingsTests + { + // Use a custom manifest to ensure that we can activate winrt types from + // our test. This property will tell taef to manually use this as the + // sxs manifest during this test class. It includes all the cppwinrt + // types we've defined, so if your test is crashing for an unknown + // reason, make sure it's included in that file. + // If you want to do anything XAML-y, you'll need to run yor test in a + // packaged context. See TabTests.cpp for more details on that. + BEGIN_TEST_CLASS(SettingsTests) + TEST_CLASS_PROPERTY(L"ActivationContext", L"TerminalApp.LocalTests.manifest") + END_TEST_CLASS() + + TEST_METHOD(TryCreateWinRTType); + }; + + void SettingsTests::TryCreateWinRTType() + { + winrt::Microsoft::Terminal::Settings::TerminalSettings settings{}; + VERIFY_IS_NOT_NULL(settings); + auto oldFontSize = settings.FontSize(); + settings.FontSize(oldFontSize + 5); + auto newFontSize = settings.FontSize(); + VERIFY_ARE_NOT_EQUAL(oldFontSize, newFontSize); + } + +} diff --git a/src/cascadia/LocalTests_TerminalApp/TabTests.cpp b/src/cascadia/LocalTests_TerminalApp/TabTests.cpp new file mode 100644 index 000000000..4a1f69213 --- /dev/null +++ b/src/cascadia/LocalTests_TerminalApp/TabTests.cpp @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "precomp.h" + +#include "../TerminalApp/ColorScheme.h" +#include "../TerminalApp/Tab.h" + +using namespace Microsoft::Console; +using namespace TerminalApp; +using namespace WEX::Logging; +using namespace WEX::TestExecution; + +namespace TerminalAppLocalTests +{ + // Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab + // machine available that can run Windows version 18362. + + class TabTests + { + // For this set of tests, we need to activate some XAML content. To do + // that, we need to be able to activate Xaml Islands(XI), using the Xaml + // Hosting APIs. Because XI looks at the manifest of the exe running, we + // can't just use the TerminalApp.Unit.Tests.manifest as our + // ActivationContext. XI is going to inspect `te.exe`s manifest to try + // and find the maxversiontested property, but te.exe hasn't set that. + // Instead, this test will run as a UAP application, as a packaged + // centenial (win32) app. We'll specify our own AppxManifest, so that + // we'll be able to also load all the dll's for the types we've defined + // (and want to use here). This does come with a minor caveat, as + // deploying the appx takes a bit, so use sparingly (though it will + // deploy once per class when used like this.) + BEGIN_TEST_CLASS(TabTests) + TEST_CLASS_PROPERTY(L"RunAs", L"UAP") + TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TerminalApp.LocalTests.AppxManifest.xml") + END_TEST_CLASS() + + // These four tests act as canary tests. If one of them fails, then they + // can help you identify if something much lower in the stack has + // failed. + TEST_METHOD(TryInitXamlIslands); + TEST_METHOD(TryCreateLocalWinRTType); + TEST_METHOD(TryCreateXamlObjects); + TEST_METHOD(TryCreateTab); + + TEST_CLASS_SETUP(ClassSetup) + { + winrt::init_apartment(winrt::apartment_type::single_threaded); + // Initialize the Xaml Hosting Manager + _manager = winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread(); + _source = winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource{}; + + return true; + } + + private: + winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager _manager{ nullptr }; + winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource _source{ nullptr }; + }; + + void TabTests::TryInitXamlIslands() + { + // Ensures that XAML Islands was initialized correctly + VERIFY_IS_NOT_NULL(_manager); + VERIFY_IS_NOT_NULL(_source); + } + + void TabTests::TryCreateLocalWinRTType() + { + // Verify we can create a WinRT type we authored + // Just creating it is enough to know that everything is working. + winrt::Microsoft::Terminal::Settings::TerminalSettings settings{}; + VERIFY_IS_NOT_NULL(settings); + auto oldFontSize = settings.FontSize(); + settings.FontSize(oldFontSize + 5); + auto newFontSize = settings.FontSize(); + VERIFY_ARE_NOT_EQUAL(oldFontSize, newFontSize); + } + + void TabTests::TryCreateXamlObjects() + { + // Verify we can create a some XAML objects + // Just creating all of them is enough to know that everything is working. + winrt::Windows::UI::Xaml::Controls::UserControl controlRoot; + VERIFY_IS_NOT_NULL(controlRoot); + winrt::Windows::UI::Xaml::Controls::Grid root; + VERIFY_IS_NOT_NULL(root); + winrt::Windows::UI::Xaml::Controls::SwapChainPanel swapChainPanel; + VERIFY_IS_NOT_NULL(swapChainPanel); + winrt::Windows::UI::Xaml::Controls::Primitives::ScrollBar scrollBar; + VERIFY_IS_NOT_NULL(scrollBar); + } + + void TabTests::TryCreateTab() + { + // Just try creating all of: + // 1. one of our pure c++ types (Profile) + // 2. one of our c++winrt types (TermControl) + // 3. one of our types that uses MUX/Xaml (Tab). + // Just creating all of them is enough to know that everything is working. + const auto profileGuid{ Utils::CreateGuid() }; + winrt::Microsoft::Terminal::TerminalControl::TermControl term{}; + VERIFY_IS_NOT_NULL(term); + + auto newTab = std::make_shared(profileGuid, term); + + VERIFY_IS_NOT_NULL(newTab); + } + +} diff --git a/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.AppxManifest.prototype.xml b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.AppxManifest.prototype.xml new file mode 100644 index 000000000..c29790748 --- /dev/null +++ b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.AppxManifest.prototype.xml @@ -0,0 +1,52 @@ + + + + + + + + TerminalApp.LocalTests.Package Host Process + Microsoft Corp. + taef.png + TAEF Packaged Cwa FullTrust Application Host Process + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.manifest b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.manifest new file mode 100644 index 000000000..ef9516047 --- /dev/null +++ b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.manifest @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + PerMonitorV2 + true + + + diff --git a/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj new file mode 100644 index 000000000..554737e67 --- /dev/null +++ b/src/cascadia/LocalTests_TerminalApp/TerminalApp.LocalTests.vcxproj @@ -0,0 +1,176 @@ + + + + + + + + + + + + + + + + Create + + + + NotUsing + + + + + + + + + + + + + + + + + + {CA5CAD1A-b11c-4ddb-a4fe-c3afae9b5506} + Win32Proj + TerminalAppLocalTests + LocalTests_TerminalApp + TerminalApp.LocalTests + 10.0.18362.0 + 10.0.18362.0 + + + + + + ..;$(OpenConsoleDir)\dep\jsoncpp\json;$(OpenConsoleDir)src\inc;$(OpenConsoleDir)src\inc\test;$(WinRT_IncludePath)\..\cppwinrt\winrt;"$(OpenConsoleDir)\src\cascadia\TerminalApp\lib\Generated Files";%(AdditionalIncludeDirectories) + precomp.h + + + 4702;%(DisableSpecificWarnings) + + + WindowsApp.lib;%(AdditionalDependencies) + + + + + true + true + + + + + + + + + + $(OpenConsoleDir)\bin\$(Platform)\$(Configuration)\$(ProjectName)\ + $(OpenConsoleDir)\obj\$(Platform)\$(Configuration)\$(ProjectName)\ + + + + <_CppWinrtBinRoot>"$(OpenConsoleDir)$(Platform)\$(Configuration)\" + + x86 + $(Platform) + <_MUXBinRoot>"$(OpenConsoleDir)packages\Microsoft.UI.Xaml.2.2.190611001-prerelease\runtimes\win10-$(Native-Platform)\native\" + + + + + + + + + + + + + $(BeforeLinkTargets); + _LocalTestsGenerateCombinedManifests; + _LocalTestsBuildAppxManifest; + _LocalTestsCopyDependencies; + + + + + + + + + + + + + + + + + + + + <_ContinueOnError Condition="'$(BuildingProject)' == 'true'">true + <_ContinueOnError Condition="'$(BuildingProject)' != 'true'">false + + + + + + + + + + + + + + + + + + + + diff --git a/src/cascadia/LocalTests_TerminalApp/precomp.cpp b/src/cascadia/LocalTests_TerminalApp/precomp.cpp new file mode 100644 index 000000000..6a6fa8e5a --- /dev/null +++ b/src/cascadia/LocalTests_TerminalApp/precomp.cpp @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT license. + +#include "precomp.h" \ No newline at end of file diff --git a/src/cascadia/LocalTests_TerminalApp/precomp.h b/src/cascadia/LocalTests_TerminalApp/precomp.h new file mode 100644 index 000000000..5c19aff51 --- /dev/null +++ b/src/cascadia/LocalTests_TerminalApp/precomp.h @@ -0,0 +1,53 @@ +/*++ +Copyright (c) Microsoft Corporation +Licensed under the MIT license. + +Module Name: +- precomp.h + +Abstract: +- Contains external headers to include in the precompile phase of console build process. +- Avoid including internal project headers. Instead include them only in the classes that need them (helps with test project building). + +Author(s): +- Carlos Zamora (cazamor) April 2019 +--*/ + +#pragma once + +// This includes support libraries from the CRT, STL, WIL, and GSL +#include "LibraryIncludes.h" +// This is inexplicable, but for whatever reason, cppwinrt conflicts with the +// SDK definition of this function, so the only fix is to undef it. +// from WinBase.h +// Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime +#ifdef GetCurrentTime +#undef GetCurrentTime +#endif + +#include +#include +#include "consoletaeftemplates.hpp" + +// Needed just for XamlIslands to work at all: +#include +#include +#include +#include + +// Common includes for most tests: +#include "../../inc/argb.h" +#include "../../inc/conattrs.hpp" +#include "../../types/inc/utils.hpp" +#include "../../inc/DefaultSettings.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include diff --git a/src/cascadia/ut_app/SettingsTests.cpp b/src/cascadia/ut_app/SettingsTests.cpp deleted file mode 100644 index 4f5189ef2..000000000 --- a/src/cascadia/ut_app/SettingsTests.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#include "precomp.h" - -#include "../TerminalApp/ColorScheme.h" - -using namespace Microsoft::Console; -using namespace TerminalApp; -using namespace WEX::Logging; -using namespace WEX::TestExecution; - -namespace TerminalAppUnitTests -{ - // Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab - // machine available that can run Windows version 18362. Until then, these - // tests will be commented out. GH#1012 should move our CI to that version. - // When that happens, these tests can be re-added. - - // class SettingsTests - // { - // // Use a custom manifest to ensure that we can activate winrt types from - // // our test. This property will tell taef to manually use this as the - // // sxs manifest during this test class. It includes all the cppwinrt - // // types we've defined, so if your test is crashing for an unknown - // // reason, make sure it's included in that file. - // // If you want to do anything XAML-y, you'll need to run yor test in a - // // packaged context. See TabTests.cpp for more details on that. - // BEGIN_TEST_CLASS(SettingsTests) - // TEST_CLASS_PROPERTY(L"ActivationContext", L"TerminalApp.Unit.Tests.manifest") - // END_TEST_CLASS() - - // TEST_METHOD(TryCreateWinRTType); - // }; - - // void SettingsTests::TryCreateWinRTType() - // { - // winrt::Microsoft::Terminal::Settings::TerminalSettings settings{}; - // VERIFY_IS_NOT_NULL(settings); - // auto oldFontSize = settings.FontSize(); - // settings.FontSize(oldFontSize + 5); - // auto newFontSize = settings.FontSize(); - // VERIFY_ARE_NOT_EQUAL(oldFontSize, newFontSize); - // } - -} diff --git a/src/cascadia/ut_app/TabTests.cpp b/src/cascadia/ut_app/TabTests.cpp deleted file mode 100644 index a36e445bb..000000000 --- a/src/cascadia/ut_app/TabTests.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. -// Licensed under the MIT license. - -#include "precomp.h" - -#include "../TerminalApp/ColorScheme.h" -#include "../TerminalApp/Tab.h" - -using namespace Microsoft::Console; -using namespace TerminalApp; -using namespace WEX::Logging; -using namespace WEX::TestExecution; - -namespace TerminalAppUnitTests -{ - // Unfortunately, these tests _WILL NOT_ work in our CI, until we have a lab - // machine available that can run Windows version 18362. Until then, these - // tests will be commented out. GH#1012 should move our CI to that version. - // When that happens, these tests can be re-added. - - // class TabTests - // { - // // For this set of tests, we need to activate some XAML content. To do - // // that, we need to be able to activate Xaml Islands(XI), using the Xaml - // // Hosting APIs. Because XI looks at the manifest of the exe running, we - // // can't just use the TerminalApp.Unit.Tests.manifest as our - // // ActivationContext. XI is going to inspect `te.exe`s manifest to try - // // and find the maxversiontested property, but te.exe hasn't set that. - // // Instead, this test will run as a UAP application, as a packaged - // // centenial (win32) app. We'll specify our own AppxManifest, so that - // // we'll be able to also load all the dll's for the types we've defined - // // (and want to use here). This does come with a minor caveat, as - // // deploying the appx takes a bit, so use sparingly (though it will - // // deploy once per class when used like this.) - // BEGIN_TEST_CLASS(TabTests) - // TEST_CLASS_PROPERTY(L"RunAs", L"UAP") - // TEST_CLASS_PROPERTY(L"UAP:AppXManifest", L"TerminalApp.Unit.Tests.AppxManifest.xml") - // END_TEST_CLASS() - - // // These four tests act as canary tests. If one of them fails, then they - // // can help you identify if something much lower in the stack has - // // failed. - // TEST_METHOD(TryInitXamlIslands); - // TEST_METHOD(TryCreateLocalWinRTType); - // TEST_METHOD(TryCreateXamlObjects); - // TEST_METHOD(TryCreateTab); - - // TEST_CLASS_SETUP(ClassSetup) - // { - // winrt::init_apartment(winrt::apartment_type::single_threaded); - // // Initialize the Xaml Hosting Manager - // _manager = winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager::InitializeForCurrentThread(); - // _source = winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource{}; - - // return true; - // } - - // private: - // winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager _manager{ nullptr }; - // winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource _source{ nullptr }; - // }; - - // void TabTests::TryInitXamlIslands() - // { - // // Ensures that XAML Islands was initialized correctly - // VERIFY_IS_NOT_NULL(_manager); - // VERIFY_IS_NOT_NULL(_source); - // } - - // void TabTests::TryCreateLocalWinRTType() - // { - // // Verify we can create a WinRT type we authored - // // Just creating it is enough to know that everything is working. - // winrt::Microsoft::Terminal::Settings::TerminalSettings settings{}; - // VERIFY_IS_NOT_NULL(settings); - // auto oldFontSize = settings.FontSize(); - // settings.FontSize(oldFontSize + 5); - // auto newFontSize = settings.FontSize(); - // VERIFY_ARE_NOT_EQUAL(oldFontSize, newFontSize); - // } - - // void TabTests::TryCreateXamlObjects() - // { - // // Verify we can create a some XAML objects - // // Just creating all of them is enough to know that everything is working. - // winrt::Windows::UI::Xaml::Controls::UserControl controlRoot; - // VERIFY_IS_NOT_NULL(controlRoot); - // winrt::Windows::UI::Xaml::Controls::Grid root; - // VERIFY_IS_NOT_NULL(root); - // winrt::Windows::UI::Xaml::Controls::SwapChainPanel swapChainPanel; - // VERIFY_IS_NOT_NULL(swapChainPanel); - // winrt::Windows::UI::Xaml::Controls::Primitives::ScrollBar scrollBar; - // VERIFY_IS_NOT_NULL(scrollBar); - // } - - // void TabTests::TryCreateTab() - // { - // // Just try creating all of: - // // 1. one of our pure c++ types (Profile) - // // 2. one of our c++winrt types (TermControl) - // // 3. one of our types that uses MUX/Xaml (Tab). - // // Just creating all of them is enough to know that everything is working. - // const auto profileGuid{ Utils::CreateGuid() }; - // winrt::Microsoft::Terminal::TerminalControl::TermControl term{}; - // VERIFY_IS_NOT_NULL(term); - - // auto newTab = std::make_shared(profileGuid, term); - - // VERIFY_IS_NOT_NULL(newTab); - // } - -} diff --git a/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj b/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj index 921bfd721..94784d216 100644 --- a/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj +++ b/src/cascadia/ut_app/TerminalApp.UnitTests.vcxproj @@ -11,8 +11,6 @@ - - Create diff --git a/src/cascadia/ut_app/precomp.h b/src/cascadia/ut_app/precomp.h index 5c19aff51..24638220f 100644 --- a/src/cascadia/ut_app/precomp.h +++ b/src/cascadia/ut_app/precomp.h @@ -29,25 +29,14 @@ Author(s): #include #include "consoletaeftemplates.hpp" -// Needed just for XamlIslands to work at all: -#include -#include -#include -#include - // Common includes for most tests: #include "../../inc/argb.h" #include "../../inc/conattrs.hpp" #include "../../types/inc/utils.hpp" #include "../../inc/DefaultSettings.h" -#include -#include -#include -#include -#include -#include -#include -#include - -#include +// Are you thinking about adding WinRT things here? If so, you probably want to +// add your test to TerminalApp.LocalTests, not TerminalApp.UnitTests. The +// UnitTests run in CI, while the LocalTests do not. However, since the CI can't +// run XAML islands or unpackaged WinRT, any tests using those features will +// need to be added to the LocalTests. diff --git a/tools/GenerateAppxFromManifest.ps1 b/tools/GenerateAppxFromManifest.ps1 new file mode 100644 index 000000000..b23db70a7 --- /dev/null +++ b/tools/GenerateAppxFromManifest.ps1 @@ -0,0 +1,74 @@ +# This script is used for taking all the activatable classes from a SxS manifest +# and adding them as Extensions to an Appxmanifest.xml. +# Params: +# - SxSManifest: The path to the SxS manifest to get the types from +# - AppxManifestPrototype: The path to an AppxManifest.xml-style XML document to add the Extensions to +# - SxSManifest: The path to write the updated XML doc to. + +param ( + [parameter(Mandatory=$true, Position=0)] + [string]$SxSManifest, + + [parameter(Mandatory=$true, Position=1)] + [string]$AppxManifestPrototype, + + [parameter(Mandatory=$true, Position=2)] + [string]$OutPath +) + +# Load the xml files. +[xml]$manifestData = Get-Content $SxSManifest +[xml]$appxPrototypeData = Get-Content $AppxManifestPrototype + +# You need to make sure each element we add is part of the same namespace as the +# Package, otherwise powershell will append a bunch of `xmlns=""` properties +# that will make the appx deployment reject the manifest. +$rootNS = $appxPrototypeData.Package.NamespaceURI + +# Create an XML element for all the extensions we're adding. +$Extensions = $appxPrototypeData.CreateNode("element", "Extensions", $rootNS) + +$assembly = $manifestData.assembly +$files = $assembly.file +$files | ForEach-Object { + + $Extension = $appxPrototypeData.CreateNode("element", "Extension", $rootNS) + $Extension.SetAttribute("Category", "windows.activatableClass.inProcessServer") + + $InProcessServer = $appxPrototypeData.CreateNode("element", "InProcessServer", $rootNS) + $Path = $appxPrototypeData.CreateNode("element", "Path", $rootNS) + + # You need to stash the result here, otherwise a blank line will be echod to + # the console. + $placeholder = $Path.InnerText = $_.name + + $InProcessServer.AppendChild($Path) + $Extension.AppendChild($InProcessServer) | Out-Null + + foreach($class in $_.activatableClass) { + $ActivatableClass = $appxPrototypeData.CreateNode("element", "ActivatableClass", $rootNS) + $ActivatableClass.SetAttribute("ActivatableClassId", $class.name) + $ActivatableClass.SetAttribute("ThreadingModel", $class.threadingModel) + + $InProcessServer.AppendChild($ActivatableClass) | Out-Null + } + + $Extensions.AppendChild($Extension) | Out-Null + +} + +# Add our fully constructed list of extensions to the original Appxmanifest prototype +$appxPrototypeData.Package.AppendChild($Extensions) | Out-Null + +# Write the modified xml back out. +$appxPrototypeData.save($OutPath) + +# Left as a helper for debugging: +# $StringWriter = New-Object System.IO.StringWriter; +# $XmlWriter = New-Object System.Xml.XmlTextWriter $StringWriter; +# $XmlWriter.Formatting = "indented"; +# $appxPrototypeData.WriteTo($XmlWriter); +# $XmlWriter.Flush(); +# $StringWriter.Flush(); +# Write-Output $StringWriter.ToString(); + diff --git a/tools/OpenConsole.psm1 b/tools/OpenConsole.psm1 index 2ba68c21d..48d3f1c35 100644 --- a/tools/OpenConsole.psm1 +++ b/tools/OpenConsole.psm1 @@ -159,7 +159,7 @@ function Invoke-OpenConsoleTests() [switch]$FTOnly, [parameter(Mandatory=$false)] - [ValidateSet('host', 'interactivityWin32', 'terminal', 'adapter', 'feature', 'uia', 'textbuffer', 'types', 'terminalCore', 'terminalApp')] + [ValidateSet('host', 'interactivityWin32', 'terminal', 'adapter', 'feature', 'uia', 'textbuffer', 'types', 'terminalCore', 'terminalApp', 'localTerminalApp')] [string]$Test, [parameter(Mandatory=$false)] diff --git a/tools/runut.cmd b/tools/runut.cmd index 419f88b6d..c4a3961aa 100644 --- a/tools/runut.cmd +++ b/tools/runut.cmd @@ -12,4 +12,5 @@ call %TAEF% ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\ConAdapter.Unit.Tests.dll ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\Types.Unit.Tests.dll ^ %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\UnitTests_TerminalApp\Terminal.App.Unit.Tests.dll ^ + %OPENCON%\bin\%PLATFORM%\%_LAST_BUILD_CONF%\LocalTests_TerminalApp\TerminalApp.LocalTests.dll ^ %* diff --git a/tools/tests.xml b/tools/tests.xml index 2cf7c3b41..930cf5ec3 100644 --- a/tools/tests.xml +++ b/tools/tests.xml @@ -4,6 +4,7 @@ +