feat: restore legacy drag events and Tornado launch integration
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace MBN_STOCK_WEBVIEW.LegacyWeb.Tests;
|
||||
|
||||
public sealed class LegacyDevelopmentLiveStartupContractTests
|
||||
{
|
||||
private const string ParityProjectGuid =
|
||||
"{0F72B3C8-8A81-4D1E-8E57-0C0E9A9960C1}";
|
||||
private const string PrototypeProjectGuid =
|
||||
"{E6F5F1A0-D0FD-4E6B-A76D-1E8E3DAE8606}";
|
||||
private const string ExactArgument = "--development-live";
|
||||
|
||||
private static readonly string RepositoryRoot = FindRepositoryRoot();
|
||||
private static readonly string ParityRoot = Path.Combine(
|
||||
RepositoryRoot,
|
||||
"src",
|
||||
"MBN_STOCK_WEBVIEW.LegacyParityApp");
|
||||
|
||||
[Fact]
|
||||
public void VisualStudioProfilesPutDevelopmentLiveFirstAndKeepExplicitDryRun()
|
||||
{
|
||||
using var document = JsonDocument.Parse(File.ReadAllText(Path.Combine(
|
||||
ParityRoot,
|
||||
"Properties",
|
||||
"launchSettings.json")));
|
||||
var profiles = document.RootElement.GetProperty("profiles")
|
||||
.EnumerateObject()
|
||||
.ToArray();
|
||||
|
||||
Assert.Equal(2, profiles.Length);
|
||||
Assert.Equal(
|
||||
"MBN_STOCK_WEBVIEW.LegacyParityApp - Development Live (Package)",
|
||||
profiles[0].Name);
|
||||
Assert.Equal("MsixPackage", profiles[0].Value.GetProperty("commandName").GetString());
|
||||
Assert.Equal(ExactArgument,
|
||||
profiles[0].Value.GetProperty("commandLineArgs").GetString());
|
||||
Assert.Equal(
|
||||
"MBN_STOCK_WEBVIEW.LegacyParityApp - Explicit DryRun (Package)",
|
||||
profiles[1].Name);
|
||||
Assert.Equal("MsixPackage", profiles[1].Value.GetProperty("commandName").GetString());
|
||||
Assert.Equal(string.Empty,
|
||||
profiles[1].Value.GetProperty("commandLineArgs").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SharedSolutionLaunchStartsOnlyTheLegacyParityApp()
|
||||
{
|
||||
using var document = JsonDocument.Parse(File.ReadAllText(Path.Combine(
|
||||
RepositoryRoot,
|
||||
"MBN_STOCK_WEBVIEW.slnLaunch")));
|
||||
var profile = Assert.Single(document.RootElement.EnumerateArray());
|
||||
Assert.Equal("Legacy Parity App (VS F5)", profile.GetProperty("Name").GetString());
|
||||
var project = Assert.Single(profile.GetProperty("Projects").EnumerateArray());
|
||||
Assert.Equal(
|
||||
"src\\MBN_STOCK_WEBVIEW.LegacyParityApp\\MBN_STOCK_WEBVIEW.LegacyParityApp.csproj",
|
||||
project.GetProperty("Path").GetString());
|
||||
Assert.Equal("Start", project.GetProperty("Action").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NormalDebugDeployTargetsParityInsteadOfThePrototype()
|
||||
{
|
||||
var solution = File.ReadAllText(Path.Combine(
|
||||
RepositoryRoot,
|
||||
"MBN_STOCK_WEBVIEW.sln"));
|
||||
|
||||
Assert.Contains(
|
||||
$"{ParityProjectGuid}.Debug|x64.Deploy.0 = Debug|x64",
|
||||
solution,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
$"{PrototypeProjectGuid}.Debug|x64.Deploy.0 = Debug|x64",
|
||||
solution,
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AppAppliesCompileTimeBuildGateBeforeConstructingMainWindow()
|
||||
{
|
||||
var app = File.ReadAllText(Path.Combine(ParityRoot, "App.xaml.cs"));
|
||||
var bootstrap = app.IndexOf(
|
||||
"DevelopmentLiveLaunchBootstrap.TryApply(",
|
||||
StringComparison.Ordinal);
|
||||
var constructWindow = app.IndexOf("_window = new MainWindow();", StringComparison.Ordinal);
|
||||
|
||||
Assert.True(bootstrap >= 0);
|
||||
Assert.True(constructWindow > bootstrap);
|
||||
Assert.Contains("#if DEBUG", app, StringComparison.Ordinal);
|
||||
Assert.Contains("const bool isDebugBuild = true;", app, StringComparison.Ordinal);
|
||||
Assert.Contains("const bool isDebugBuild = false;", app, StringComparison.Ordinal);
|
||||
Assert.Contains("args.Arguments", app, StringComparison.Ordinal);
|
||||
Assert.Contains("Environment.GetCommandLineArgs()", app, StringComparison.Ordinal);
|
||||
Assert.Contains("ResolveLaunchArguments(", app, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TrackedExampleContainsOnlyNonUsableHashPlaceholders()
|
||||
{
|
||||
var example = File.ReadAllText(Path.Combine(
|
||||
RepositoryRoot,
|
||||
"Config",
|
||||
"playout.development-live.example.json"));
|
||||
using var document = JsonDocument.Parse(example);
|
||||
var root = document.RootElement;
|
||||
|
||||
Assert.Equal(1, root.GetProperty("schemaVersion").GetInt32());
|
||||
Assert.Equal("Live", root.GetProperty("mode").GetString());
|
||||
Assert.StartsWith("<64-HEX-", root.GetProperty("nativeSha256").GetString());
|
||||
Assert.StartsWith("<64-HEX-", root.GetProperty("interopSha256").GetString());
|
||||
Assert.DoesNotContain(":\\", example, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RealDevelopmentAuthorizationFileIsIgnoredEverywhere()
|
||||
{
|
||||
var ignore = File.ReadAllText(Path.Combine(RepositoryRoot, ".gitignore"));
|
||||
|
||||
Assert.Contains("Config/playout.development-live.local.json", ignore,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("**/playout.development-live.local.json", ignore,
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
private static string FindRepositoryRoot()
|
||||
{
|
||||
var current = new DirectoryInfo(AppContext.BaseDirectory);
|
||||
while (current is not null)
|
||||
{
|
||||
if (File.Exists(Path.Combine(current.FullName, "MBN_STOCK_WEBVIEW.sln")))
|
||||
{
|
||||
return current.FullName;
|
||||
}
|
||||
|
||||
current = current.Parent;
|
||||
}
|
||||
|
||||
throw new DirectoryNotFoundException("Repository root was not found.");
|
||||
}
|
||||
}
|
||||
@@ -63,6 +63,8 @@ public sealed class LegacyOperatorCatalogParityWebTests
|
||||
"operator-catalog-new",
|
||||
"operator-catalog-results",
|
||||
"operator-catalog-name",
|
||||
"operator-catalog-name-check",
|
||||
"operator-catalog-name-status",
|
||||
"operator-catalog-stock-query",
|
||||
"operator-catalog-stock-results",
|
||||
"operator-catalog-add-stock",
|
||||
@@ -75,11 +77,20 @@ public sealed class LegacyOperatorCatalogParityWebTests
|
||||
}
|
||||
|
||||
Assert.Contains("operator-catalog-draft-row", Styles, StringComparison.Ordinal);
|
||||
Assert.Contains(">중복확인</button>", Markup, StringComparison.Ordinal);
|
||||
Assert.Contains("operator-catalog-name-field small.available", Styles,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("operator-catalog-backdrop[hidden]", Styles, StringComparison.Ordinal);
|
||||
Assert.Contains("operatorCatalogStockResults.addEventListener(\"dblclick\"", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("dataset.operatorCatalogBuyAmountRowId = row.rowId", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("dataset.operatorCatalogRowId = row.rowId", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("event.dataTransfer.setData(operatorCatalogDragMime, sourceRowId)", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains(".operator-catalog-draft-row.drag-before", Styles,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("remove.textContent = isTheme ? \"삭제\" : \"종목삭제\"", App,
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
@@ -98,9 +109,11 @@ public sealed class LegacyOperatorCatalogParityWebTests
|
||||
"select-operator-catalog-stock",
|
||||
"add-operator-catalog-stock",
|
||||
"activate-operator-catalog-stock",
|
||||
"reorder-operator-catalog-draft-row",
|
||||
"move-operator-catalog-draft-row",
|
||||
"remove-operator-catalog-draft-row",
|
||||
"set-operator-catalog-draft-buy-amount",
|
||||
"check-operator-catalog-theme-name",
|
||||
"save-operator-catalog",
|
||||
"delete-operator-catalog"
|
||||
})
|
||||
@@ -116,6 +129,14 @@ public sealed class LegacyOperatorCatalogParityWebTests
|
||||
new Regex("(?:themeCode|expertCode|stockCode|itemCode|expectedIdentity|SB_LIST|EXPERT_LIST)"),
|
||||
catalogSection);
|
||||
Assert.DoesNotContain("send(\"save-operator-catalog\"", App[..start], StringComparison.Ordinal);
|
||||
Assert.Contains(
|
||||
"send(\"check-operator-catalog-theme-name\", { name: name });",
|
||||
App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain(
|
||||
"send(\"check-operator-catalog-theme-name\", { name: name,",
|
||||
App,
|
||||
StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -139,6 +160,8 @@ public sealed class LegacyOperatorCatalogParityWebTests
|
||||
Assert.Contains("LegacyBeginUc6ExpertCatalogIntent", MainWindow, StringComparison.Ordinal);
|
||||
Assert.Contains("LegacyEditUc6SelectedExpertIntent", MainWindow, StringComparison.Ordinal);
|
||||
Assert.Contains("LegacyDeleteUc6SelectedExpertIntent", MainWindow, StringComparison.Ordinal);
|
||||
Assert.Contains("LegacyCheckOperatorCatalogThemeNameIntent", MainWindow,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("LegacySaveOperatorCatalogIntent", MainWindow, StringComparison.Ordinal);
|
||||
Assert.Contains("LegacyDeleteOperatorCatalogIntent", MainWindow, StringComparison.Ordinal);
|
||||
Assert.Contains("_intentGate.WaitAsync(", MainWindow, StringComparison.Ordinal);
|
||||
@@ -159,6 +182,7 @@ public sealed class LegacyOperatorCatalogParityWebTests
|
||||
"LegacyDeleteUc6SelectedExpertIntent",
|
||||
"LegacyAddOperatorCatalogStockIntent",
|
||||
"LegacyActivateOperatorCatalogStockIntent",
|
||||
"LegacyReorderOperatorCatalogDraftRowIntent",
|
||||
"LegacyMoveOperatorCatalogDraftRowIntent",
|
||||
"LegacyRemoveOperatorCatalogDraftRowIntent",
|
||||
"LegacySetOperatorCatalogDraftBuyAmountIntent",
|
||||
|
||||
@@ -106,6 +106,7 @@ public sealed class LegacyWebContractTests
|
||||
{
|
||||
"select-playlist-row",
|
||||
"set-playlist-enabled",
|
||||
"reorder-playlist-rows",
|
||||
"move-selected-playlist-rows",
|
||||
"delete-selected-playlist-rows",
|
||||
"delete-all-playlist-rows"
|
||||
@@ -119,6 +120,14 @@ public sealed class LegacyWebContractTests
|
||||
Assert.Contains("event.key === \"Delete\"", App, StringComparison.Ordinal);
|
||||
Assert.Contains("row.isSelected", App, StringComparison.Ordinal);
|
||||
Assert.Contains("enabled.disabled = state.isBusy === true", App, StringComparison.Ordinal);
|
||||
Assert.Contains("event.target.closest(\"input, button\")", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("preserveSelectedBlock", App, StringComparison.Ordinal);
|
||||
Assert.Contains("deferredPlaylistPlainSelectionRowId", App, StringComparison.Ordinal);
|
||||
Assert.Contains("event.dataTransfer.setData(playlistDragMime, rowId)", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains(".playlist-data-row.drag-before", Styles, StringComparison.Ordinal);
|
||||
Assert.Contains(".playlist-data-row.drag-after", Styles, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -131,6 +140,19 @@ public sealed class LegacyWebContractTests
|
||||
Assert.DoesNotContain("playlistRows.replaceChild", App, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MarketTabDragSwapsOnHoverThroughExpectedCSharpPositions()
|
||||
{
|
||||
Assert.Contains("send(\"hover-swap-tabs\"", App, StringComparison.Ordinal);
|
||||
Assert.Contains("expectedSourceIndex: sourceIndex", App, StringComparison.Ordinal);
|
||||
Assert.Contains("expectedTargetIndex: targetIndex", App, StringComparison.Ordinal);
|
||||
Assert.Contains("event.dataTransfer.setData(\"text/x-mbn-tab\"", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.Contains("marketTabs.addEventListener(\"dragover\"", App,
|
||||
StringComparison.Ordinal);
|
||||
Assert.DoesNotContain("send(\"swap-tabs\"", App, StringComparison.Ordinal);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FixedCatalogUsesOpaqueCSharpActionAndSectionIntents()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user