Update release

This commit is contained in:
vczh
2025-08-31 22:44:06 -07:00
parent 9c91710e2d
commit 3f0e43b724
19 changed files with 1447 additions and 865 deletions
+34 -3
View File
@@ -54,6 +54,11 @@ namespace vl::presentation::unittest
}
}
namespace vl::presentation::GuiHostedController_UnitTestHelper
{
extern bool ExceptionOccuredUnderUnitTestReleaseMode();
}
using namespace vl;
using namespace vl::collections;
using namespace vl::filesystem;
@@ -63,6 +68,7 @@ using namespace vl::presentation;
using namespace vl::presentation::remoteprotocol;
using namespace vl::presentation::controls;
using namespace vl::presentation::unittest;
using namespace vl::presentation::GuiHostedController_UnitTestHelper;
class UnitTestContextImpl : public Object, public virtual IUnitTestContext
{
@@ -362,6 +368,7 @@ void GacUIUnitTest_Start(const WString& appName, Nullable<UnitTestScreenConfig>
: &filteredProtocol
);
GacUIUnitTest_SetGuiMainProxy({});
TEST_ASSERT(!ExceptionOccuredUnderUnitTestReleaseMode());
GacUIUnitTest_LogUI(appName, unitTestProtocol);
if (!globalConfig.useDomDiff)
@@ -445,6 +452,8 @@ void GacUIUnitTest_StartAsync(const WString& appName, Nullable<UnitTestScreenCon
});
asyncChannelSender.WaitForStopped();
TEST_ASSERT(!ExceptionOccuredUnderUnitTestReleaseMode());
GacUIUnitTest_LogUI(appName, unitTestProtocol);
if (!config.Value().useDomDiff)
{
@@ -500,6 +509,16 @@ void GacUIUnitTest_Start_WithResourceAsText(const WString& appName, Nullable<Uni
#undef ERROR_MESSAGE_PREFIX
}
void GacUIUnitTest_PrintErrors(GuiResourceError::List& errors)
{
for (auto&& error : errors)
{
TEST_PRINT(L"Error in resource: " + error.location.resourcePath);
TEST_PRINT(L" ROW: " + itow(error.position.row) + L", COLUMN: " + itow(error.position.column));
TEST_PRINT(L" REASON: " + error.message);
}
}
Ptr<GuiResource> GacUIUnitTest_CompileAndLoad(const WString& xmlResource)
{
#define ERROR_MESSAGE_PREFIX L"GacUIUnitTest_CompileAndLoad(const WString&)#"
@@ -509,10 +528,18 @@ Ptr<GuiResource> GacUIUnitTest_CompileAndLoad(const WString& xmlResource)
auto resourcePath = (GetUnitTestFrameworkConfig().resourceFolder / L"Resource.xml").GetFullPath();
auto parser = GetParserManager()->GetParser<glr::xml::XmlDocument>(L"XML");
auto xml = parser->Parse({ WString::Empty,resourcePath }, xmlResource, errors);
CHECK_ERROR(xml && errors.Count() == 0, ERROR_MESSAGE_PREFIX L"Failed to parse XML resource.");
if(!xml || errors.Count()> 0)
{
GacUIUnitTest_PrintErrors(errors);
CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Failed to parse XML resource.");
}
resource = GuiResource::LoadFromXml(xml, resourcePath, GetFolderPath(resourcePath), errors);
CHECK_ERROR(resource && errors.Count() == 0, ERROR_MESSAGE_PREFIX L"Failed to load XML resource.");
if (!resource || errors.Count() > 0)
{
GacUIUnitTest_PrintErrors(errors);
CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Failed to load XML resource.");
}
}
auto precompiledFolder = resource->Precompile(
@@ -524,7 +551,11 @@ Ptr<GuiResource> GacUIUnitTest_CompileAndLoad(const WString& xmlResource)
nullptr,
errors
);
CHECK_ERROR(precompiledFolder && errors.Count() == 0, ERROR_MESSAGE_PREFIX L"Failed to precompile XML resource.");
if (!precompiledFolder || errors.Count() > 0)
{
GacUIUnitTest_PrintErrors(errors);
CHECK_FAIL(ERROR_MESSAGE_PREFIX L"Failed to precompile XML resource.");
}
auto compiledWorkflow = precompiledFolder->GetValueByPath(WString::Unmanaged(L"Workflow/InstanceClass")).Cast<GuiInstanceCompiledWorkflow>();
CHECK_ERROR(compiledWorkflow, ERROR_MESSAGE_PREFIX L"Failed to compile generated Workflow script.");