Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion test/inc/TestDef.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#pragma once

#include <windows.h>
#include <string>
#include <winrt/base.h>

constexpr static const int c_phaseTimeout = (30 * 1000); // 30 seconds
static const std::wstring c_genericTestMoniker = L"this_is_a_test";
static const std::wstring c_testFailureEventName = L"WindowsAppRuntimeTestFailureEventName";
Expand Down
4 changes: 2 additions & 2 deletions test/inc/WindowsAppRuntime.Test.AppModel.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#ifndef __WINDOWSAPPRUNTIME_TEST_APPMODEL_H
#define __WINDOWSAPPRUNTIME_TEST_APPMODEL_H

#include <windows.h>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

Is this currently a problem or is this a stylistic change?

This is the most obvious example - why does this need to include windows.h? That's routinely the 1st include in any precompiled header, and in any source file in projects not using precompiled headers. Also, some include <unknown.h> rather than windows.h (the former includes the latter, plus other things).

I don't see the value including windows.h in any header file (except precomp.h/pch.h)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current problem is that for some of these headers, you can't include them alone without including these dependencies before in your file. Creating a new test that uses one of these headers requires knowing what they depend on, and it is not possible to just include the header that you actually want to use alone, requiring the include of windows.h before including the desire header for example.
I think it is a good practice to have headers that work as their own (by being possible to compile a .cpp file including only it, which is what I mean when I say a header can be compiled) and it would make it easier for others to use them within the project.

For this specific case, this header can be compile on its own because it includes windows.h within appmodel.h, but it is hidden under a conditional macro. So I included it here to make it safer.

Do you think there are any downsides on doing this change? We can close this PR if it is not desired.

#include <appmodel.h>

#include <Verify.h>

namespace Test::AppModel
Expand Down
1 change: 1 addition & 0 deletions test/inc/WindowsAppRuntime.Test.Bootstrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef __WINDOWSAPPRUNTIME_TEST_BOOTSTRAP_H
#define __WINDOWSAPPRUNTIME_TEST_BOOTSTRAP_H

#include <windows.h>
#include <MddBootstrap.h>
#include <MddBootstrapTest.h>

Expand Down
4 changes: 3 additions & 1 deletion test/inc/WindowsAppRuntime.Test.FileSystem.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// Copyright (c) Microsoft Corporation and Contributors.
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.

#ifndef __WINDOWSAPPRUNTIME_TEST_FILESYSTEM_H
#define __WINDOWSAPPRUNTIME_TEST_FILESYSTEM_H

#include <windows.h>
#include <filesystem>
#include <verify.h>

#include <wil/win32_helpers.h>
#include <wil/resource.h>
Expand Down
1 change: 1 addition & 0 deletions test/inc/WindowsAppRuntime.Test.Package.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#ifndef __WINDOWSAPPRUNTIME_TEST_PACKAGE_H
#define __WINDOWSAPPRUNTIME_TEST_PACKAGE_H

#include <windows.h>
#include <appmodel.h>

#include <WindowsAppRuntime.Test.FileSystem.h>
Expand Down
6 changes: 5 additions & 1 deletion test/inc/WindowsAppRuntime.Test.TAEF.cppwinrt.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Copyright (c) Microsoft Corporation and Contributors. All rights reserved.
// Copyright (c) Microsoft Corporation and Contributors. All rights reserved.
// Licensed under the MIT License.

#ifndef __WINDOWSAPPRUNTIME_TEST_TAEF_CPPWINRT_H
#define __WINDOWSAPPRUNTIME_TEST_TAEF_CPPWINRT_H

#include <windows.h>
#include <winrt/base.h>
#include <WexTestClass.h>

namespace WEX::TestExecution
{
// Teach TAEF how to format a winrt::hstring
Expand Down
6 changes: 5 additions & 1 deletion test/inc/WindowsAppRuntime.Test.TAEF.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
// Copyright (c) Microsoft Corporation and Contributors. All rights reserved.
// Copyright (c) Microsoft Corporation and Contributors. All rights reserved.
// Licensed under the MIT License.

#ifndef __WINDOWSAPPRUNTIME_TEST_TAEF_H
#define __WINDOWSAPPRUNTIME_TEST_TAEF_H

#include <windows.h>
#include <filesystem>
#include <WexTestClass.h>

namespace Test::TAEF
{
inline std::filesystem::path GetDeploymentDir()
Expand Down
Loading