<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic ArcGIS Pro Unit Testing, loading LayoutView problem in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-unit-testing-loading-layoutview-problem/m-p/1080973#M6878</link>
    <description>&lt;P&gt;Recently we are working on unit testing on our ArcGIS Pro plug-in/add-in application. We are referring the Esri's demo method, (&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Regression-Testing" target="_blank" rel="noopener noreferrer"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Regression-Testing).&amp;nbsp;&lt;/A&gt;We have a problem getting the&amp;nbsp;&lt;SPAN&gt;LayoutView.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We can load the project file (.aprx) using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Project project = Project.OpenAsync(@"C:\Users\Administrator\Documents\files\test.aprx").Result;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;QueuedTask.Run(() =&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;_map = project.GetItems&amp;lt;MapProjectItem&amp;gt;().Where(x =&amp;gt; x.Name.Equals("Map")).FirstOrDefault().GetMap();&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;_layers = _map.GetLayersAsFlattenedList();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_layoutProjItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().FirstOrDefault(item =&amp;gt; item.Name.Equals("Layout"));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_layout = _layoutProjItem.GetLayout(); //Worker thread&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}).Wait();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But we cannot get LayoutView. For example,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PaneCollection panes = ProApp.Panes;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ILayoutPane layoutPane = panes.FindLayoutPanes(_layout).FirstOrDefault();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;layoutPane.LayoutView always returns null.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While We know in ArcGIS Desktop, like 10.*, we can get/initialize everything for example,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Get&amp;nbsp;Mxd&amp;nbsp;file (location of the&amp;nbsp;mxd&amp;nbsp;file)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Get&amp;nbsp;MapDocument&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Get&amp;nbsp;PageLayout&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Set&amp;nbsp;pageLayout&amp;nbsp;as&amp;nbsp;ActiveView.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My Question is , in unit test, ArcGIS Pro can get&amp;nbsp;LayoutView ? How to get the LayoutView in the Unit test.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
    <pubDate>Thu, 29 Jul 2021 15:38:33 GMT</pubDate>
    <dc:creator>EricChang3721</dc:creator>
    <dc:date>2021-07-29T15:38:33Z</dc:date>
    <item>
      <title>ArcGIS Pro Unit Testing, loading LayoutView problem</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-unit-testing-loading-layoutview-problem/m-p/1080973#M6878</link>
      <description>&lt;P&gt;Recently we are working on unit testing on our ArcGIS Pro plug-in/add-in application. We are referring the Esri's demo method, (&lt;A href="https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Regression-Testing" target="_blank" rel="noopener noreferrer"&gt;https://github.com/Esri/arcgis-pro-sdk/wiki/ProGuide-Regression-Testing).&amp;nbsp;&lt;/A&gt;We have a problem getting the&amp;nbsp;&lt;SPAN&gt;LayoutView.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;We can load the project file (.aprx) using the following code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Project project = Project.OpenAsync(@"C:\Users\Administrator\Documents\files\test.aprx").Result;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;QueuedTask.Run(() =&amp;gt;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;_map = project.GetItems&amp;lt;MapProjectItem&amp;gt;().Where(x =&amp;gt; x.Name.Equals("Map")).FirstOrDefault().GetMap();&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;_layers = _map.GetLayersAsFlattenedList();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_layoutProjItem = Project.Current.GetItems&amp;lt;LayoutProjectItem&amp;gt;().FirstOrDefault(item =&amp;gt; item.Name.Equals("Layout"));&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_layout = _layoutProjItem.GetLayout(); //Worker thread&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}).Wait();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But we cannot get LayoutView. For example,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;PaneCollection panes = ProApp.Panes;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;ILayoutPane layoutPane = panes.FindLayoutPanes(_layout).FirstOrDefault();&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;layoutPane.LayoutView always returns null.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;While We know in ArcGIS Desktop, like 10.*, we can get/initialize everything for example,&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Get&amp;nbsp;Mxd&amp;nbsp;file (location of the&amp;nbsp;mxd&amp;nbsp;file)&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Get&amp;nbsp;MapDocument&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Get&amp;nbsp;PageLayout&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Set&amp;nbsp;pageLayout&amp;nbsp;as&amp;nbsp;ActiveView.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;My Question is , in unit test, ArcGIS Pro can get&amp;nbsp;LayoutView ? How to get the LayoutView in the Unit test.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Thu, 29 Jul 2021 15:38:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-unit-testing-loading-layoutview-problem/m-p/1080973#M6878</guid>
      <dc:creator>EricChang3721</dc:creator>
      <dc:date>2021-07-29T15:38:33Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Pro Unit Testing, loading LayoutView problem</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-unit-testing-loading-layoutview-problem/m-p/1081015#M6882</link>
      <description>&lt;P&gt;In clarifying, we were able to retrieve a LayoutView instance, but it appears uninitialized.&amp;nbsp;&lt;STRONG&gt;layoutPane.LayoutView.IsReady is always false &lt;/STRONG&gt;and&amp;nbsp;the &lt;STRONG&gt;Extent and ActiveMapFrame properties are null&lt;/STRONG&gt;, etc. Our need is to access the map frames in the layout, and specifically that we need to call MapFrame.GetMapView() on each one.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Eric&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 19:25:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/arcgis-pro-unit-testing-loading-layoutview-problem/m-p/1081015#M6882</guid>
      <dc:creator>EricChang3721</dc:creator>
      <dc:date>2021-07-20T19:25:14Z</dc:date>
    </item>
  </channel>
</rss>

