[mapguide-commits] r10008 - in trunk/MgDev/Web/src: WebApp WebTestRunner WebTestRunner/TestData

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Nov 8 04:56:24 PST 2022


Author: jng
Date: 2022-11-08 04:56:23 -0800 (Tue, 08 Nov 2022)
New Revision: 10008

Added:
   trunk/MgDev/Web/src/WebTestRunner/TestData/WebLayoutUnformatted.xml
   trunk/MgDev/Web/src/WebTestRunner/WebLayoutTest.cpp
Modified:
   trunk/MgDev/Web/src/WebApp/WebLayout.cpp
   trunk/MgDev/Web/src/WebTestRunner/OgcWfsTest.cpp
   trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj
   trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj.filters
Log:
Fix a 14 year old (!!!) long standing bug with MgWebLayout loading unformatted WebLayout XML. The issue is due to an unnecessary null pointer check in MgWebLayout::ParsePrintCommand(). When the XML is unformatted, the DOMNode ptr will be null, when the XML is formatted, the DOMNode ptr is not null, but inspecting this pointer shows that the DOMNode pointer is for a #text region (ie. Whitespace).

Since the method itself is ultimately trying to parse an *optional* <PrintLayout> that may or may not be present, there is no need for the incoming DOMNode ptr to actually not be null. If it's null, just bail out early and move on.

A new WebTestRunner test case has been added to exercise this particular case.

Fixes #979

Modified: trunk/MgDev/Web/src/WebApp/WebLayout.cpp
===================================================================
--- trunk/MgDev/Web/src/WebApp/WebLayout.cpp	2022-11-08 11:39:50 UTC (rev 10007)
+++ trunk/MgDev/Web/src/WebApp/WebLayout.cpp	2022-11-08 12:56:23 UTC (rev 10008)
@@ -955,10 +955,15 @@
 //
 void MgWebLayout::ParsePrintCommand(DOMNode* node, MgWebPrintCommand* cmd)
 {
+    // This could happen if the WebLayout is formatted and this command defn doesn't
+    // specify any print layouts
+    if (nullptr == node)
+    {
+        return;
+    }
+
     MG_TRY()
 
-    CHECKARGUMENTNULL(node, L"MgWebLayout.ParsePrintCommand");
-
     Ptr<MgStringCollection> printLayouts = cmd->GetPrintLayouts();
 
     do

Modified: trunk/MgDev/Web/src/WebTestRunner/OgcWfsTest.cpp
===================================================================
--- trunk/MgDev/Web/src/WebTestRunner/OgcWfsTest.cpp	2022-11-08 11:39:50 UTC (rev 10007)
+++ trunk/MgDev/Web/src/WebTestRunner/OgcWfsTest.cpp	2022-11-08 12:56:23 UTC (rev 10008)
@@ -37,8 +37,6 @@
     Ptr<MgHttpResult> result = resp->GetResult();
 
     STRING err = result->GetDetailedErrorMessage();
-    auto errMsg = err.c_str();
-    auto elen = err.length();
     REQUIRE(err.empty());
 
     Ptr<MgByteReader> reader = dynamic_cast<MgByteReader*>(result->GetResultObject());

Added: trunk/MgDev/Web/src/WebTestRunner/TestData/WebLayoutUnformatted.xml
===================================================================
--- trunk/MgDev/Web/src/WebTestRunner/TestData/WebLayoutUnformatted.xml	                        (rev 0)
+++ trunk/MgDev/Web/src/WebTestRunner/TestData/WebLayoutUnformatted.xml	2022-11-08 12:56:23 UTC (rev 10008)
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?><WebLayout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xsi:noNamespaceSchemaLocation="WebLayout-1.0.0.xsd"><Title>Sheboygan Map</Title><Map><ResourceId>Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition</ResourceId><HyperlinkTarget>TaskPane</HyperlinkTarget></Map><ToolBar><Visible>true</Visible><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Print</Command></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Get Printable Page</Command></Button><Button xsi:type="SeparatorItemType"><Function>Separator</Function></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Measure</Command></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Buffer</Command></Button><Button xsi:type="SeparatorItemType"><Function>Separator</Function></Button><Button xsi:type="FlyoutItemType"><Function>Flyout
 </Function><Label>Zoom</Label><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Previous View</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Next View</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Initial Map View</Command></SubItem></Button><Button xsi:type="SeparatorItemType"><Function>Separator</Function></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom Rectangle</Command></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom In</Command></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom Out</Command></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom</Command></Button><Button xsi:type="SeparatorItemType"><Function>Separator</Function></Button><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Select</Command></Bu
 tton><Button xsi:type="CommandItemType"><Function>Command</Function><Command>Pan</Command></Button></ToolBar><InformationPane><Visible>true</Visible><Width>200</Width><LegendVisible>true</LegendVisible><PropertiesVisible>true</PropertiesVisible></InformationPane><ContextMenu><Visible>true</Visible><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Print</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Refresh Map</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Copy</Command></MenuItem><MenuItem xsi:type="SeparatorItemType"><Function>Separator</Function></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Pan</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom Rectangle</Command></MenuItem><MenuIt
 em xsi:type="SeparatorItemType"><Function>Separator</Function></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom In</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom Out</Command></MenuItem><MenuItem xsi:type="SeparatorItemType"><Function>Separator</Function></MenuItem><MenuItem xsi:type="FlyoutItemType"><Function>Flyout</Function><Label>Zoom</Label><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Initial Map View</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Previous View</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Next View</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Initial Center and Scale</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Zoom Selection</Command></SubItem></MenuItem><Menu
 Item xsi:type="SeparatorItemType"><Function>Separator</Function></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Select</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Clear Selection</Command></MenuItem><MenuItem xsi:type="FlyoutItemType"><Function>Flyout</Function><Label>Select More</Label><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Select Radius</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Select Polygon</Command></SubItem><SubItem xsi:type="CommandItemType"><Function>Command</Function><Command>Select Within</Command></SubItem></MenuItem><MenuItem xsi:type="SeparatorItemType"><Function>Separator</Function></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Buffer</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Measure</Command></MenuItem><MenuItem
  xsi:type="SeparatorItemType"><Function>Separator</Function></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>View Options</Command></MenuItem><MenuItem xsi:type="SeparatorItemType"><Function>Separator</Function></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>Help</Command></MenuItem><MenuItem xsi:type="CommandItemType"><Function>Command</Function><Command>About</Command></MenuItem></ContextMenu><TaskPane><Visible>true</Visible><Width>250</Width><TaskBar><Visible>true</Visible><Home><Name>Home</Name><Tooltip>Return to home task page</Tooltip><Description>Return to home task page</Description><ImageURL>../stdicons/icon_home.gif</ImageURL><DisabledImageURL>../stdicons/icon_home_disabled.gif</DisabledImageURL></Home><Forward><Name>Forward</Name><Tooltip>Forward to next task page</Tooltip><Description>Forward to next task page</Description><ImageURL>../stdicons/icon_forward.gif</ImageURL><DisabledImageURL>../stdicon
 s/icon_forward_disabled.gif</DisabledImageURL></Forward><Back><Name>Back</Name><Tooltip>Return to previous task page</Tooltip><Description>Return to previous task page</Description><ImageURL>../stdicons/icon_back.gif</ImageURL><DisabledImageURL>../stdicons/icon_back_disabled.gif</DisabledImageURL></Back><Tasks><Name>Tasks</Name><Tooltip>Task list</Tooltip><Description>View a list of available tasks</Description><ImageURL>../stdicons/icon_tasks.gif</ImageURL><DisabledImageURL>../stdicons/icon_tasks_disabled.gif</DisabledImageURL></Tasks><MenuButton xsi:type="CommandItemType"><Function>Command</Function><Command>Overview</Command></MenuButton><MenuButton xsi:type="CommandItemType"><Function>Command</Function><Command>Query</Command></MenuButton><MenuButton xsi:type="CommandItemType"><Function>Command</Function><Command>Theme</Command></MenuButton><MenuButton xsi:type="CommandItemType"><Function>Command</Function><Command>Find Address</Command></MenuButton><MenuButton xsi:type="Command
 ItemType"><Function>Command</Function><Command>Plot</Command></MenuButton><MenuButton xsi:type="SeparatorItemType"><Function>Separator</Function></MenuButton><MenuButton xsi:type="CommandItemType"><Function>Command</Function><Command>Buffer</Command></MenuButton><MenuButton xsi:type="CommandItemType"><Function>Command</Function><Command>Measure</Command></MenuButton></TaskBar><InitialTask>../phpviewersample/overview/overviewmain.php</InitialTask></TaskPane><StatusBar><Visible>true</Visible></StatusBar><ZoomControl><Visible>true</Visible></ZoomControl><CommandSet><Command xsi:type="BasicCommandType"><Name>Pan</Name><Label>Pan</Label><Tooltip>Pan mode</Tooltip><Description>Drag the map to view areas out of range</Description><ImageURL>../stdicons/icon_pan.gif</ImageURL><DisabledImageURL>../stdicons/icon_pan_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>Pan</Action></Command><Command xsi:type="BasicCommandType"><Name>Pan Up</Name><Label>Pan Up</Label><Tooltip>P
 an up</Tooltip><Description>Pan up by a preset increment</Description><ImageURL>../stdicons/icon_panup.gif</ImageURL><DisabledImageURL>../stdicons/icon_panup_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>PanUp</Action></Command><Command xsi:type="BasicCommandType"><Name>Pan Down</Name><Label>Pan Down</Label><Tooltip>Pan down</Tooltip><Description>Pan down by a preset increment</Description><ImageURL>../stdicons/icon_pandown.gif</ImageURL><DisabledImageURL>../stdicons/icon_pandown_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>PanDown</Action></Command><Command xsi:type="BasicCommandType"><Name>Pan Right</Name><Label>Pan Right</Label><Tooltip>Pan right</Tooltip><Description>Pan right by a preset increment</Description><ImageURL>../stdicons/icon_panright.gif</ImageURL><DisabledImageURL>../stdicons/icon_panright_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>PanRight</Action></Command><Command xsi:type="BasicComma
 ndType"><Name>Pan Left</Name><Label>Pan Left</Label><Tooltip>Pan left</Tooltip><Description>Pan left by a preset increment</Description><ImageURL>../stdicons/icon_panleft.gif</ImageURL><DisabledImageURL>../stdicons/icon_panleft_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>PanLeft</Action></Command><Command xsi:type="BasicCommandType"><Name>Zoom</Name><Label>Zoom</Label><Tooltip>Zoom dynamic</Tooltip><Description>Zoom dynamically by clicking and dragging</Description><ImageURL>../stdicons/icon_zoom.gif</ImageURL><DisabledImageURL>../stdicons/icon_zoom_disabled.gif</DisabledImageURL><TargetViewer>Dwf</TargetViewer><Action>Zoom</Action></Command><Command xsi:type="BasicCommandType"><Name>Zoom In</Name><Label>Zoom In</Label><Tooltip>Zoom in</Tooltip><Description>Zoom in by a preset increment</Description><ImageURL>../stdicons/icon_zoomin.gif</ImageURL><DisabledImageURL>../stdicons/icon_zoomin_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Actio
 n>ZoomIn</Action></Command><Command xsi:type="BasicCommandType"><Name>Zoom Out</Name><Label>Zoom Out</Label><Tooltip>Zoom out</Tooltip><Description>Zoom out by a preset increment</Description><ImageURL>../stdicons/icon_zoomout.gif</ImageURL><DisabledImageURL>../stdicons/icon_zoomout_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>ZoomOut</Action></Command><Command xsi:type="BasicCommandType"><Name>Zoom Rectangle</Name><Label>Zoom Rectangle</Label><Tooltip>Zoom rectangle</Tooltip><Description>Zoom in on an area</Description><ImageURL>../stdicons/icon_zoomrect.gif</ImageURL><DisabledImageURL>../stdicons/icon_zoomrect_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>ZoomRectangle</Action></Command><Command xsi:type="BasicCommandType"><Name>Zoom Selection</Name><Label>Zoom Selection</Label><Tooltip>Zoom to selection</Tooltip><Description>Zoom to extents of selected features</Description><ImageURL>../stdicons/icon_zoomselect.gif</ImageURL><Dis
 abledImageURL>../stdicons/icon_zoomselect_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>ZoomToSelection</Action></Command><Command xsi:type="BasicCommandType"><Name>Initial Map View</Name><Label>Initial Map View</Label><Tooltip>Initial map view</Tooltip><Description>Fit the extents of the map to the window</Description><ImageURL>../stdicons/icon_fitwindow.gif</ImageURL><DisabledImageURL>../stdicons/icon_fitwindow_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>FitToWindow</Action></Command><Command xsi:type="BasicCommandType"><Name>Previous View</Name><Label>Previous View</Label><Tooltip>Previous view</Tooltip><Description>Go to previous view</Description><ImageURL>../stdicons/icon_zoomprev.gif</ImageURL><DisabledImageURL>../stdicons/icon_zoomprev_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>PreviousView</Action></Command><Command xsi:type="BasicCommandType"><Name>Next View</Name><Label>Next View</Label><Toolt
 ip>Next view</Tooltip><Description>Go to next view</Description><ImageURL>../stdicons/icon_zoomnext.gif</ImageURL><DisabledImageURL>../stdicons/icon_zoomnext_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>NextView</Action></Command><Command xsi:type="BasicCommandType"><Name>Initial Center and Scale</Name><Label>Initial Center and Scale</Label><Tooltip>Initial center and scale</Tooltip><Description>Zoom to initial map center and scale</Description><ImageURL>../stdicons/icon_restorecenter.gif</ImageURL><DisabledImageURL>../stdicons/icon_restorecenter_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>RestoreView</Action></Command><Command xsi:type="BasicCommandType"><Name>Select</Name><Label>Select</Label><Tooltip>Select mode</Tooltip><Description>Select features by clicking and dragging</Description><ImageURL>../stdicons/icon_select.gif</ImageURL><DisabledImageURL>../stdicons/icon_select_disabled.gif</DisabledImageURL><TargetViewer>All</Tar
 getViewer><Action>Select</Action></Command><Command xsi:type="BasicCommandType"><Name>Select Radius</Name><Label>Select Radius</Label><Tooltip>Select radius</Tooltip><Description>Click and drag to select all features inside the circle</Description><ImageURL>../stdicons/icon_selectradius.gif</ImageURL><DisabledImageURL>../stdicons/icon_selectradius_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>SelectRadius</Action></Command><Command xsi:type="BasicCommandType"><Name>Select Polygon</Name><Label>Select Polygon</Label><Tooltip>Select polygon</Tooltip><Description>Create a polygon to select all features that fall within</Description><ImageURL>../stdicons/icon_selectpolygon.gif</ImageURL><DisabledImageURL>../stdicons/icon_selectpolygon_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>SelectPolygon</Action></Command><Command xsi:type="BasicCommandType"><Name>Clear Selection</Name><Label>Clear Selection</Label><Tooltip>Clear selection</Tooltip>
 <Description>Clear the current selections</Description><ImageURL>../stdicons/icon_clearselect.gif</ImageURL><DisabledImageURL>../stdicons/icon_clearselect_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>ClearSelection</Action></Command><Command xsi:type="BasicCommandType"><Name>Refresh Map</Name><Label>Refresh Map</Label><Tooltip>Refresh map</Tooltip><Description>Refresh map and reload all layers keeping current center and scale</Description><ImageURL>../stdicons/icon_refreshmap.gif</ImageURL><DisabledImageURL>../stdicons/icon_refreshmap_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Action>Refresh</Action></Command><Command xsi:type="BasicCommandType"><Name>Copy</Name><Label>Copy</Label><Tooltip>Copy</Tooltip><Description>Copy current view of map to clipboard</Description><ImageURL>../stdicons/icon_copy.gif</ImageURL><DisabledImageURL>../stdicons/icon_copy_disabled.gif</DisabledImageURL><TargetViewer>Dwf</TargetViewer><Action>CopyMap</Action>
 </Command><Command xsi:type="BasicCommandType"><Name>About</Name><Label>About</Label><Tooltip>About</Tooltip><Description>Display information about this application</Description><ImageURL /><DisabledImageURL /><TargetViewer>All</TargetViewer><Action>About</Action></Command><Command xsi:type="BufferCommandType"><Name>Buffer</Name><Label>Buffer</Label><Tooltip>Buffer</Tooltip><Description>Create buffers around the selected features</Description><ImageURL>../stdicons/icon_buffer.gif</ImageURL><DisabledImageURL>../stdicons/icon_buffer_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target></Command><Command xsi:type="SelectWithinCommandType"><Name>Select Within</Name><Label>Select Within</Label><Tooltip>Select within</Tooltip><Description>Select features that fall within currently selected areas</Description><ImageURL>../stdicons/icon_selectwithin.gif</ImageURL><DisabledImageURL>../stdicons/icon_selectwithin_disabled.gif</DisabledImageURL><TargetViewer>A
 ll</TargetViewer><Target>TaskPane</Target></Command><Command xsi:type="PrintCommandType"><Name>Print</Name><Label>Print</Label><Tooltip>Print</Tooltip><Description>Print with optional layout</Description><ImageURL>../stdicons/icon_print.gif</ImageURL><DisabledImageURL>../stdicons/icon_print_disabled.gif</DisabledImageURL><TargetViewer>Dwf</TargetViewer></Command><Command xsi:type="MeasureCommandType"><Name>Measure</Name><Label>Measure</Label><Tooltip>Measure</Tooltip><Description>Measure distances on the map</Description><ImageURL>../stdicons/icon_measure.gif</ImageURL><DisabledImageURL>../stdicons/icon_measure_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target></Command><Command xsi:type="ViewOptionsCommandType"><Name>View Options</Name><Label>View Options</Label><Tooltip>View Options</Tooltip><Description>View Options</Description><ImageURL>../stdicons/icon_viewoptions.gif</ImageURL><DisabledImageURL>../stdicons/icon_viewoptions_disabled.gif</D
 isabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target></Command><Command xsi:type="GetPrintablePageCommandType"><Name>Get Printable Page</Name><Label>Get Printable Page</Label><Tooltip>Get printable Page</Tooltip><Description>Get printer-friendly page</Description><ImageURL>../stdicons/icon_printablepage.gif</ImageURL><DisabledImageURL>../stdicons/icon_printablepage_disabled.gif</DisabledImageURL><TargetViewer>Ajax</TargetViewer><Target>NewWindow</Target></Command><Command xsi:type="HelpCommandType"><Name>Help</Name><Label>Help</Label><Tooltip>Help</Tooltip><Description>Launch help for this application</Description><ImageURL>../stdicons/icon_help.gif</ImageURL><DisabledImageURL>../stdicons/icon_help_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target></Command><Command xsi:type="InvokeURLCommandType"><Name>Query</Name><Label>Query</Label><Tooltip>Query the Data</Tooltip><Description>Query the Data</Description><ImageURL>../stdic
 ons/icon_invokeurl.gif</ImageURL><DisabledImageURL>../stdicons/icon_invokeurl_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target><URL>../phpviewersample/query/querymain.php</URL><LayerSet /><DisableIfSelectionEmpty>false</DisableIfSelectionEmpty></Command><Command xsi:type="InvokeURLCommandType"><Name>Overview</Name><Label>Overview</Label><Tooltip>Display an Overview</Tooltip><Description>Display an overview of the application</Description><ImageURL>../stdicons/icon_invokeurl.gif</ImageURL><DisabledImageURL>../stdicons/icon_invokeurl_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target><URL>../phpviewersample/overview/overviewmain.php</URL><LayerSet /><DisableIfSelectionEmpty>false</DisableIfSelectionEmpty></Command><Command xsi:type="InvokeURLCommandType"><Name>Theme</Name><Label>Theme</Label><Tooltip>Create a Theme</Tooltip><Description>Create a Theme</Description><ImageURL>../stdicons/icon_invokeurl.gif</Imag
 eURL><DisabledImageURL>../stdicons/icon_invokeurl_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target><URL>../phpviewersample/theme/thememain.php</URL><LayerSet /><DisableIfSelectionEmpty>false</DisableIfSelectionEmpty></Command><Command xsi:type="InvokeURLCommandType"><Name>Plot</Name><Label>Plot as DWF</Label><Tooltip>Plot as DWF</Tooltip><Description>Plot the current map as a DWF</Description><ImageURL>../stdicons/icon_invokeurl.gif</ImageURL><DisabledImageURL>../stdicons/icon_invokeurl_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target><URL>../phpviewersample/plot/plotmain.php</URL><LayerSet /><DisableIfSelectionEmpty>false</DisableIfSelectionEmpty></Command><Command xsi:type="InvokeURLCommandType"><Name>Find Address</Name><Label>Find Address</Label><Tooltip>Find an Address</Tooltip><Description>Find an address in Sheboygan</Description><ImageURL>../stdicons/icon_invokeurl.gif</ImageURL><DisabledImageURL>..
 /stdicons/icon_invokeurl_disabled.gif</DisabledImageURL><TargetViewer>All</TargetViewer><Target>TaskPane</Target><URL>../phpviewersample/findaddress/findaddressmain.php</URL><LayerSet /><DisableIfSelectionEmpty>false</DisableIfSelectionEmpty></Command></CommandSet></WebLayout>
\ No newline at end of file

Added: trunk/MgDev/Web/src/WebTestRunner/WebLayoutTest.cpp
===================================================================
--- trunk/MgDev/Web/src/WebTestRunner/WebLayoutTest.cpp	                        (rev 0)
+++ trunk/MgDev/Web/src/WebTestRunner/WebLayoutTest.cpp	2022-11-08 12:56:23 UTC (rev 10008)
@@ -0,0 +1,50 @@
+//
+//  Copyright (C) 2004-2022 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+#include "catch.hpp"
+#include "MapGuideCommon.h"
+#include "WebApp.h"
+
+TEST_CASE("WebLayout_UnformattedTest", "[WebLayout]")
+{
+	try 
+	{
+		Ptr<MgSiteConnection> conn = new MgSiteConnection();
+		Ptr<MgUserInformation> userInfo = new MgUserInformation(L"Anonymous", L"");
+		conn->Open(userInfo);
+
+		Ptr<MgSite> site = conn->GetSite();
+		auto sessionId = site->CreateSession();
+
+		userInfo->SetMgSessionId(sessionId);
+
+		Ptr<MgResourceService> resSvc = static_cast<MgResourceService*>(conn->CreateService(MgServiceType::ResourceService));
+		Ptr<MgResourceIdentifier> wlId = new MgResourceIdentifier(L"Session:" + sessionId + L"//Unformatted.WebLayout");
+
+		Ptr<MgByteSource> testSource = new MgByteSource(L"TestData/WebLayoutUnformatted.xml");
+		Ptr<MgByteReader> testRdr = testSource->GetReader();
+
+		resSvc->SetResource(wlId, testRdr, nullptr);
+
+		Ptr<MgWebLayout> wl = new MgWebLayout(resSvc, wlId);
+	}
+	catch (MgException* ex)
+	{
+		auto msg = ex->GetExceptionMessage();
+		SAFE_RELEASE(ex);
+	}
+}
\ No newline at end of file

Modified: trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj
===================================================================
--- trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj	2022-11-08 11:39:50 UTC (rev 10007)
+++ trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj	2022-11-08 12:56:23 UTC (rev 10008)
@@ -221,6 +221,7 @@
     <ClCompile Include="main.cpp" />
     <ClCompile Include="OgcWfsTest.cpp" />
     <ClCompile Include="TestListener.cpp" />
+    <ClCompile Include="WebLayoutTest.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\..\..\Common\Foundation\Foundation.vcxproj">

Modified: trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj.filters
===================================================================
--- trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj.filters	2022-11-08 11:39:50 UTC (rev 10007)
+++ trunk/MgDev/Web/src/WebTestRunner/WebTestRunner.vcxproj.filters	2022-11-08 12:56:23 UTC (rev 10008)
@@ -24,6 +24,9 @@
     <ClCompile Include="OgcWfsTest.cpp">
       <Filter>Source Files</Filter>
     </ClCompile>
+    <ClCompile Include="WebLayoutTest.cpp">
+      <Filter>Source Files</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="resource.h">



More information about the mapguide-commits mailing list