2019-08-13 15:23:28 +02:00
|
|
|
/*++
|
|
|
|
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
|
|
|
|
|
2020-08-28 03:09:22 +02:00
|
|
|
// Manually include til after we include Windows.Foundation to give it winrt superpowers
|
|
|
|
#define BLOCK_TIL
|
2019-08-13 15:23:28 +02:00
|
|
|
// 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
|
|
|
|
|
Fix the TabTests! (#3833)
## Summary of the Pull Request
Fix the `TabTests`, and enable testing of types with XAML content. The `TabTests` were written many, many moons ago. they were intended to be our tests of XAML-like content within the Terminal app, so we could have unittests of Tabs, Panes, etc. Between their initial authoring and the day they were checked in, we had a bunch of build changes come in and break them irreperably.
We've gotten them fixed now with _one weird trick_ <sup>doctors hate me</sup>. As long as there isn't an `App.xbf` in the test's output directory, then the tests will deploy just fine.
We also needed a bit of magic, cribbed straight from TAEF, to enable running test code synchronously on the UI thread. Hence, `CppwinrtTailored.h`.
## References
## PR Checklist
* [x] Closes #2472
* [x] I work here
* [x] Tests added/passed - you better believe it
* [n/a] Requires documentation to be updated
## Validation Steps Performed
![image](https://user-images.githubusercontent.com/18356694/70185192-ef1d0b00-16ae-11ea-8799-b77061e3cdb0.png)
2019-12-06 21:45:08 +01:00
|
|
|
#include <wil/cppwinrt.h>
|
|
|
|
#include <unknwn.h>
|
|
|
|
#include <hstring.h>
|
|
|
|
|
2019-08-13 15:23:28 +02:00
|
|
|
#include <WexTestClass.h>
|
|
|
|
#include <json.h>
|
|
|
|
#include "consoletaeftemplates.hpp"
|
A bunch of test fixes (#9192)
A bunch of our local tests regressed recently. I'm unsure as to when
this happened. Clearly, we all do a super good job of running these
tests 😄.
* I had to make sure the call to `AppLogic::CurrentAppSettings` was
try/caught, because that doesn't work in the tests
* I had to make the `Pointer*` events take a weak pointer to the
`TerminalPage` because for whatever reason, they'd be called at a
weird point in the test init, causing the tests to fail. It was weird.
Almost as if the TerminalPage had been released, but the test logs
showed it hadn't barely been set up yet? Whatever, this fixes it.
* The `VerifyCommandPaletteTabSwitcherOrder` test needed to take a time
out, for reasons that are not totally clear to me. That one was flakey
and I hate it.
### Checklist:
* [x] Doesn't close anything, this is just something I noticed.
* [x] Doesn't require docs to be updated, it's test fixes
* [x] Yea, I ran the tests
/cc @Don-Vito: The `FilteredCommandTests` all crashed immediately for
me. I'm not sure what's causing that - I _think_ everything we need for
those tests is set up right? The generated `AppxManifest.xml` had all
the right classes listed in it, I really can't be sure what was wrong
there. These tests aren't run in CI so it's not a super big deal, but I
thought I'd let you know.
(cherry picked from commit ccda434f69d5fd39042d9573f1610aa6ff01d0e7)
2021-02-18 21:47:14 +01:00
|
|
|
#include "winrtTaefTemplates.hpp"
|
2019-08-13 15:23:28 +02:00
|
|
|
|
2020-05-04 22:57:12 +02:00
|
|
|
#include <winrt/Windows.ApplicationModel.Resources.Core.h>
|
|
|
|
#include "winrt/Windows.UI.Xaml.Markup.h"
|
Fix the TabTests! (#3833)
## Summary of the Pull Request
Fix the `TabTests`, and enable testing of types with XAML content. The `TabTests` were written many, many moons ago. they were intended to be our tests of XAML-like content within the Terminal app, so we could have unittests of Tabs, Panes, etc. Between their initial authoring and the day they were checked in, we had a bunch of build changes come in and break them irreperably.
We've gotten them fixed now with _one weird trick_ <sup>doctors hate me</sup>. As long as there isn't an `App.xbf` in the test's output directory, then the tests will deploy just fine.
We also needed a bit of magic, cribbed straight from TAEF, to enable running test code synchronously on the UI thread. Hence, `CppwinrtTailored.h`.
## References
## PR Checklist
* [x] Closes #2472
* [x] I work here
* [x] Tests added/passed - you better believe it
* [n/a] Requires documentation to be updated
## Validation Steps Performed
![image](https://user-images.githubusercontent.com/18356694/70185192-ef1d0b00-16ae-11ea-8799-b77061e3cdb0.png)
2019-12-06 21:45:08 +01:00
|
|
|
#include <winrt/Windows.system.h>
|
2019-08-13 15:23:28 +02:00
|
|
|
#include <winrt/Windows.Foundation.h>
|
|
|
|
#include <winrt/Windows.Foundation.Collections.h>
|
|
|
|
#include <winrt/windows.ui.core.h>
|
|
|
|
#include <winrt/Windows.ui.input.h>
|
|
|
|
#include <winrt/Windows.UI.Xaml.Controls.h>
|
|
|
|
#include <winrt/Windows.UI.Xaml.Controls.Primitives.h>
|
Add support for renaming windows (#9662)
## Summary of the Pull Request
This PR adds support for renaming windows.
![window-renaming-000](https://user-images.githubusercontent.com/18356694/113034344-9a30be00-9157-11eb-9443-975f3c294f56.gif)
![window-renaming-001](https://user-images.githubusercontent.com/18356694/113034452-b5033280-9157-11eb-9e35-e5ac80fef0bc.gif)
It does so through two new actions:
* `renameWindow` takes a `name` parameter, and attempts to set the window's name
to the provided name. This is useful if you always want to hit <kbd>F3</kbd>
and rename a window to "foo" (READ: probably not that useful)
* `openWindowRenamer` is more interesting: it opens a `TeachingTip` with a
`TextBox`. When the user hits Ok, it'll request a rename for the provided
value. This lets the user pick a new name for the window at runtime.
In both cases, if there's already a window with that name, then the monarch will
reject the rename, and pop a `Toast` in the window informing the user that the
rename failed. Nifty!
## References
* Builds on the toasts from #9523
* #5000 - process model megathread
## PR Checklist
* [x] Closes https://github.com/microsoft/terminal/projects/5#card-50771747
* [x] I work here
* [x] Tests addded (and pass with the help of #9660)
* [ ] Requires documentation to be updated
## Detailed Description of the Pull Request / Additional comments
I'm sending this PR while finishing up the tests. I figured I'll have time to sneak them in before I get the necessary reviews.
> PAIN: We can't immediately focus the textbox in the TeachingTip. It's
> not technically focusable until it is opened. However, it doesn't
> provide an even tto tell us when it is opened. That's tracked in
> microsoft/microsoft-ui-xaml#1607. So for now, the user _needs_ to
> click on the text box manually.
> We're also not using a ContentDialog for this, because in Xaml
> Islands a text box in a ContentDialog won't recieve _any_ keypresses.
> Fun!
## Validation Steps Performed
I've been playing with
```json
{ "keys": "f1", "command": "identifyWindow" },
{ "keys": "f2", "command": "identifyWindows" },
{ "keys": "f3", "command": "openWindowRenamer" },
{ "keys": "f4", "command": { "action": "renameWindow", "name": "foo" } },
{ "keys": "f5", "command": { "action": "renameWindow", "name": "bar" } },
```
and they seem to work as expected
2021-04-02 18:00:04 +02:00
|
|
|
#include <winrt/Windows.UI.Xaml.Data.h>
|
2019-08-13 15:23:28 +02:00
|
|
|
#include <winrt/Windows.ui.xaml.media.h>
|
|
|
|
#include <winrt/Windows.ui.xaml.input.h>
|
Fix unittesting our `.xaml` classes (#4105)
## Summary of the Pull Request
New year, new unittests.
This PR introduces a new project, `TestHostApp`. This project is largely taken from the TAEF samples, and allows us to easily construct a helper executable and `resources.pri` for running TerminalApp unittests.
## References
## PR Checklist
* [x] Closes #3986
* [x] I work here
* [x] is Tests
* [n/a] Requires documentation to be updated
* [x] **Waiting for an updated version of TAEF to be available**
## Detailed Description of the Pull Request / Additional comments
Unittesting for the TerminalApp project has been a horrifying process to try getting everything pieced together just right. Dependencies need to get added to manifests, binplaced correctly, and XAML resources need to get compiled together as well. In addition, using a MUX `Application` (as opposed to the Windows.UI.Xaml `Application`) has led to additional problems.
This was always a horrifying house of cards for us. Turns out, the reason this was so horrible is that the test infrastructure for doing what we're doing _literally didn't exist_ when I started doing all that work last year.
So, with help from the TAEF team, I was able to get rid of our entire house of cards, and use a much simpler project to build and run the tests.
Unfortunately, the latest TAEF release has a minor bug in it's build rules, and only publishes the x86 version of a dll we need from them. But, the rest of this PR works for x86, and I'll bump this when that updated version is available. We should be able to review this even in the state it's in.
## Validation Steps Performed
ran the tests yo
2020-01-10 19:55:31 +01:00
|
|
|
#include <winrt/Windows.UI.Xaml.Markup.h>
|
|
|
|
#include <winrt/Windows.UI.Xaml.Documents.h>
|
2019-08-13 15:23:28 +02:00
|
|
|
|
|
|
|
#include <windows.ui.xaml.media.dxinterop.h>
|
Fix the TabTests! (#3833)
## Summary of the Pull Request
Fix the `TabTests`, and enable testing of types with XAML content. The `TabTests` were written many, many moons ago. they were intended to be our tests of XAML-like content within the Terminal app, so we could have unittests of Tabs, Panes, etc. Between their initial authoring and the day they were checked in, we had a bunch of build changes come in and break them irreperably.
We've gotten them fixed now with _one weird trick_ <sup>doctors hate me</sup>. As long as there isn't an `App.xbf` in the test's output directory, then the tests will deploy just fine.
We also needed a bit of magic, cribbed straight from TAEF, to enable running test code synchronously on the UI thread. Hence, `CppwinrtTailored.h`.
## References
## PR Checklist
* [x] Closes #2472
* [x] I work here
* [x] Tests added/passed - you better believe it
* [n/a] Requires documentation to be updated
## Validation Steps Performed
![image](https://user-images.githubusercontent.com/18356694/70185192-ef1d0b00-16ae-11ea-8799-b77061e3cdb0.png)
2019-12-06 21:45:08 +01:00
|
|
|
|
|
|
|
#include <winrt/windows.applicationmodel.core.h>
|
|
|
|
|
|
|
|
#include <winrt/Microsoft.Terminal.TerminalConnection.h>
|
2020-10-06 18:56:59 +02:00
|
|
|
#include <winrt/Microsoft.Terminal.Settings.Model.h>
|
Fix the TabTests! (#3833)
## Summary of the Pull Request
Fix the `TabTests`, and enable testing of types with XAML content. The `TabTests` were written many, many moons ago. they were intended to be our tests of XAML-like content within the Terminal app, so we could have unittests of Tabs, Panes, etc. Between their initial authoring and the day they were checked in, we had a bunch of build changes come in and break them irreperably.
We've gotten them fixed now with _one weird trick_ <sup>doctors hate me</sup>. As long as there isn't an `App.xbf` in the test's output directory, then the tests will deploy just fine.
We also needed a bit of magic, cribbed straight from TAEF, to enable running test code synchronously on the UI thread. Hence, `CppwinrtTailored.h`.
## References
## PR Checklist
* [x] Closes #2472
* [x] I work here
* [x] Tests added/passed - you better believe it
* [n/a] Requires documentation to be updated
## Validation Steps Performed
![image](https://user-images.githubusercontent.com/18356694/70185192-ef1d0b00-16ae-11ea-8799-b77061e3cdb0.png)
2019-12-06 21:45:08 +01:00
|
|
|
|
|
|
|
#include <winrt/Microsoft.UI.Xaml.Controls.h>
|
2020-01-27 16:34:12 +01:00
|
|
|
|
|
|
|
#include <regex>
|
|
|
|
#include <CLI11/CLI11.hpp>
|
2020-08-28 03:09:22 +02:00
|
|
|
|
2021-02-22 19:50:39 +01:00
|
|
|
#include <shobjidl_core.h>
|
|
|
|
|
2020-08-28 03:09:22 +02:00
|
|
|
// Manually include til after we include Windows.Foundation to give it winrt superpowers
|
|
|
|
#include "til.h"
|
|
|
|
|
|
|
|
// Common includes for most tests:
|
|
|
|
#include "../../inc/argb.h"
|
|
|
|
#include "../../inc/conattrs.hpp"
|
|
|
|
#include "../../types/inc/utils.hpp"
|
|
|
|
#include "../../inc/DefaultSettings.h"
|