-
Notifications
You must be signed in to change notification settings - Fork 634
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
68 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,13 @@ | ||
using System; | ||
using System.Collections.Concurrent; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Reflection; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace DynamoUtilities | ||
{ | ||
internal class TestUtilities | ||
internal static class TestUtilities | ||
{ | ||
internal static bool RunningFromNUnit = false; | ||
static TestUtilities() | ||
{ | ||
foreach (Assembly assem in AppDomain.CurrentDomain.GetAssemblies()) | ||
{ | ||
// Can't do something like this as it will load the nUnit assembly | ||
// if (assem == typeof(NUnit.Framework.Assert)) | ||
|
||
if (assem.FullName.ToLowerInvariant().StartsWith("nunit.framework")) | ||
{ | ||
RunningFromNUnit = true; | ||
break; | ||
} | ||
} | ||
} | ||
|
||
private static ConcurrentDictionary<string, int> WebView2Counter = new ConcurrentDictionary<string, int>(); | ||
internal static void IncrementWebView2(string containingType) | ||
{ | ||
if (!WebView2Counter.TryGetValue(containingType, out _)) | ||
{ | ||
WebView2Counter.TryAdd(containingType, 0); | ||
} | ||
WebView2Counter[containingType]++; | ||
} | ||
|
||
internal static void DecrementWebView2(string containingType) | ||
{ | ||
WebView2Counter[containingType]--; | ||
} | ||
|
||
internal static void AssertCounters() | ||
{ | ||
var exceptions = new List<Exception>(); | ||
foreach (var counter in WebView2Counter) | ||
{ | ||
if (counter.Value != 0) | ||
{ | ||
exceptions.Add(new Exception($"Unexpected number of webview2 allocations/deallocations: {counter.Value} webview2 instances for containing class {counter.Key}")); | ||
} | ||
} | ||
WebView2Counter.Clear(); | ||
if ( exceptions.Count > 0 ) { throw new AggregateException(exceptions.ToArray()); } | ||
} | ||
internal static string WebView2Stamp; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
<UserControl x:Class="Dynamo.LibraryViewExtensionWebView2.Views.LibraryView" | ||
<UserControl x:Class="Dynamo.LibraryViewExtensionWebView2.Views.LibraryView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" | ||
xmlns:wv2="clr-namespace:Dynamo.Wpf.Utilities;assembly=DynamoCoreWpf" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Dynamo.LibraryViewExtensionWebView2.Views" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid x:Name="mainGrid"> | ||
<wv2:WebView2 Visibility="Hidden"/> | ||
<wv2:DynamoWebView2 Visibility="Hidden"/> | ||
</Grid> | ||
</UserControl> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.