Skip to content

Commit

Permalink
Update projects to the latest WebView2 SDK 1.0.1724-prerelease (#180)
Browse files Browse the repository at this point in the history
* Updates for Win32, WPF and WinForms sample apps from 114.0.1777.0

* Updated package version for Win32, WPF and WinForms sample apps to 1.0.1777-prerelease

---------

Co-authored-by: WebView2 Github Bot <webview2github@microsoft.com>
  • Loading branch information
oggy22 and WebView2GithubBot committed Apr 11, 2023
1 parent 93f1c12 commit 75f3af3
Show file tree
Hide file tree
Showing 14 changed files with 689 additions and 17 deletions.
7 changes: 3 additions & 4 deletions SampleApps/WebView2APISample/ScenarioCookieManagement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ ScenarioCookieManagement::ScenarioCookieManagement(AppWindow* appWindow, bool is
CHECK_FEATURE_RETURN_EMPTY(webView2_13);
wil::com_ptr<ICoreWebView2Profile> webView2Profile;
CHECK_FAILURE(webView2_13->get_Profile(&webView2Profile));
auto webView2ExperimentalProfile8 =
webView2Profile.try_query<ICoreWebView2ExperimentalProfile8>();
CHECK_FEATURE_RETURN_EMPTY(webView2ExperimentalProfile8);
CHECK_FAILURE(webView2ExperimentalProfile8->get_CookieManager(&m_cookieManager));
auto webView2Profile5 = webView2Profile.try_query<ICoreWebView2Profile5>();
CHECK_FEATURE_RETURN_EMPTY(webView2Profile5);
CHECK_FAILURE(webView2Profile5->get_CookieManager(&m_cookieManager));
//! [CookieManagerProfile]
}
else
Expand Down
9 changes: 4 additions & 5 deletions SampleApps/WebView2APISample/ScenarioDragDrop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ ScenarioDragDrop::ScenarioDragDrop(AppWindow* appWindow) : m_appWindow(appWindow
Callback<ICoreWebView2WebMessageReceivedEventHandler>(
[this](ICoreWebView2* sender, ICoreWebView2WebMessageReceivedEventArgs* args)
{
wil::com_ptr<ICoreWebView2ExperimentalWebMessageReceivedEventArgs> args2 =
wil::com_ptr<ICoreWebView2WebMessageReceivedEventArgs2> args2 =
wil::com_ptr<ICoreWebView2WebMessageReceivedEventArgs>(args)
.query<ICoreWebView2ExperimentalWebMessageReceivedEventArgs>();
wil::com_ptr<ICoreWebView2ExperimentalObjectCollectionView> objectsCollection;
.query<ICoreWebView2WebMessageReceivedEventArgs2>();
wil::com_ptr<ICoreWebView2ObjectCollectionView> objectsCollection;
args2->get_AdditionalObjects(&objectsCollection);
unsigned int length;
objectsCollection->get_Count(&length);
Expand All @@ -38,8 +38,7 @@ ScenarioDragDrop::ScenarioDragDrop(AppWindow* appWindow) : m_appWindow(appWindow
wil::com_ptr<IUnknown> object;
objectsCollection->GetValueAtIndex(i, &object);

wil::com_ptr<ICoreWebView2ExperimentalFile> file =
object.query<ICoreWebView2ExperimentalFile>();
wil::com_ptr<ICoreWebView2File> file = object.query<ICoreWebView2File>();
if (file)
{
// Add the file to message to be sent back to webview
Expand Down
4 changes: 2 additions & 2 deletions SampleApps/WebView2APISample/WebView2APISample.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -382,13 +382,13 @@
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets" Condition="Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" />
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.1724-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.1724-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
<Import Project="..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets" Condition="Exists('..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets')" />
</ImportGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.ImplementationLibrary.1.0.191107.2\build\native\Microsoft.Windows.ImplementationLibrary.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.1724-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.1724-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Web.WebView2.1.0.1777-prerelease\build\native\Microsoft.Web.WebView2.targets'))" />
</Target>
</Project>
18 changes: 18 additions & 0 deletions SampleApps/WebView2APISample/documentation/Testing-Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ These are instructions for manually testing all the features of the WebView2 API
* [Open Link in New Window From PDF](#Open-Link-in-New-Window-from-PDF)
* [WebView Does Not Crash](#WebView-Does-Not-Crash)
* [Draggable Regions](#Draggable-Regions)
* [Drag and Drop](#Drag-and-Drop)

## Getting started

Expand Down Expand Up @@ -1404,3 +1405,20 @@ this the `appRegion` changes would not take place until some document element wa
1. Expected: Sample app will maximize
1. Right click 'Microsoft Edge WebView2' element and select `restore`
1. Expected: Sample app will restore.

#### Drag and Drop
Test that Drag and Drop is supported in WebView2 using both hosting modes.
1. Launch the sample app.
1. Select text "Runtime version".
1. Click, hold, and drag the selected text to the Query text box.
1. Release mouse over text box to drop text.
1. Expected: "Runtime version" text is inserted into Query text box.
1. Go to `Window -> Close WebView.`
1. Go to `Window -> WebView Creation Mode -> Visual - DComp.`
1. Go to `Window -> Create WebView.`
1. Select text "Runtime version".
1. Click, hold, and drag the selected text to the Query text box.
1. Release mouse over text box to drop text.
1. Expected: "Runtime version" text is inserted into Query text box.
1. Go to `Window -> Close WebView.`
1. Expected: App does not crash.
2 changes: 1 addition & 1 deletion SampleApps/WebView2APISample/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Web.WebView2" version="1.0.1724-prerelease" targetFramework="native" />
<package id="Microsoft.Web.WebView2" version="1.0.1777-prerelease" targetFramework="native" />
<package id="Microsoft.Windows.ImplementationLibrary" version="1.0.191107.2" targetFramework="native" />
</packages>
Loading

0 comments on commit 75f3af3

Please sign in to comment.