diff --git a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.0.Elements.FactSet.Markdown.png b/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.0.Elements.FactSet.Markdown.png deleted file mode 100644 index 1bc1f88637..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.0.Elements.FactSet.Markdown.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.0.Tests.TextBlock.Markdown.Telephony.png b/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.0.Tests.TextBlock.Markdown.Telephony.png deleted file mode 100644 index b56e5b5061..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.0.Tests.TextBlock.Markdown.Telephony.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Elements.Column.Fallback.png b/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Elements.Column.Fallback.png deleted file mode 100644 index 1592f857c0..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Elements.Column.Fallback.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png b/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png deleted file mode 100644 index a5c7af29c5..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Tests.ContainerDoubleFallback.png b/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Tests.ContainerDoubleFallback.png deleted file mode 100644 index d8ead01073..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/Fixed Size Non-Interactive.v1.2.Tests.ContainerDoubleFallback.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.0.Elements.FactSet.Markdown.png b/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.0.Elements.FactSet.Markdown.png deleted file mode 100644 index a354425456..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.0.Elements.FactSet.Markdown.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.0.Tests.TextBlock.Markdown.Telephony.png b/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.0.Tests.TextBlock.Markdown.Telephony.png deleted file mode 100644 index afac28fb00..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.0.Tests.TextBlock.Markdown.Telephony.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Elements.Column.Fallback.png b/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Elements.Column.Fallback.png deleted file mode 100644 index 9b307b3edb..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Elements.Column.Fallback.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png b/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png deleted file mode 100644 index 8acf7e28e9..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Tests.ContainerDoubleFallback.png b/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Tests.ContainerDoubleFallback.png deleted file mode 100644 index 9a188a7a60..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/No host config (default values).v1.2.Tests.ContainerDoubleFallback.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.0.Elements.FactSet.Markdown.png b/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.0.Elements.FactSet.Markdown.png deleted file mode 100644 index a7a4d82a58..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.0.Elements.FactSet.Markdown.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.0.Tests.TextBlock.Markdown.Telephony.png b/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.0.Tests.TextBlock.Markdown.Telephony.png deleted file mode 100644 index cf9a4f2b4d..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.0.Tests.TextBlock.Markdown.Telephony.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Elements.Column.Fallback.png b/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Elements.Column.Fallback.png deleted file mode 100644 index 2a3b61556b..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Elements.Column.Fallback.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png b/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png deleted file mode 100644 index 6a9170e025..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Tests.AdaptiveCard.BackgroundImage.FillMode.Cover.SmallImage.png and /dev/null differ diff --git a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Tests.ContainerDoubleFallback.png b/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Tests.ContainerDoubleFallback.png deleted file mode 100644 index b04acf2235..0000000000 Binary files a/source/uwp/AdaptiveCardTestApp/Expected/testVariantHostConfig.v1.2.Tests.ContainerDoubleFallback.png and /dev/null differ diff --git a/source/uwp/Renderer/lib/ElementTagContent.cpp b/source/uwp/Renderer/lib/ElementTagContent.cpp index 1a1851f3f5..6da7373e46 100644 --- a/source/uwp/Renderer/lib/ElementTagContent.cpp +++ b/source/uwp/Renderer/lib/ElementTagContent.cpp @@ -17,7 +17,9 @@ namespace AdaptiveNamespace _In_ IPanel* parentPanel, _In_ IUIElement* separator, _In_ IColumnDefinition* columnDefinition, - boolean isStretchable) + _In_ boolean expectedVisibility, + _In_ boolean isStretchable) + { if (parentPanel != nullptr) { @@ -28,6 +30,7 @@ namespace AdaptiveNamespace m_columnDefinition = columnDefinition; m_separator = separator; m_cardElement = cardElement; + m_expectedVisibility = expectedVisibility; m_isStretchable = isStretchable; return S_OK; } @@ -51,14 +54,28 @@ namespace AdaptiveNamespace { return m_parentPanel.CopyTo(parentPanel); } + HRESULT ElementTagContent::get_IsStretchable(boolean* isStretchable) { *isStretchable = m_isStretchable; return S_OK; } + HRESULT ElementTagContent::put_IsStretchable(boolean isStretchable) { m_isStretchable = isStretchable; return S_OK; } + + HRESULT ElementTagContent::get_ExpectedVisibility(_Outptr_ boolean* expectedVisibility) + { + *expectedVisibility = m_expectedVisibility; + return S_OK; + } + + HRESULT ElementTagContent::set_ExpectedVisibility(boolean expectedVisibility) + { + m_expectedVisibility = expectedVisibility; + return S_OK; + } } diff --git a/source/uwp/Renderer/lib/ElementTagContent.h b/source/uwp/Renderer/lib/ElementTagContent.h index fee39b6dce..8d1559db80 100644 --- a/source/uwp/Renderer/lib/ElementTagContent.h +++ b/source/uwp/Renderer/lib/ElementTagContent.h @@ -12,6 +12,11 @@ namespace AdaptiveNamespace virtual HRESULT get_AdaptiveCardElement(_COM_Outptr_ ABI::AdaptiveNamespace::IAdaptiveCardElement * *cardElement) = 0; virtual HRESULT get_Separator(_COM_Outptr_ ABI::Windows::UI::Xaml::IUIElement * *separator) = 0; virtual HRESULT get_ParentPanel(_COM_Outptr_ ABI::Windows::UI::Xaml::Controls::IPanel * *parentPanel) = 0; + // Auto size images hide themselves while they haven't finished loading even when they are expected to be + // visible so the best way to track the intended visibility of the element and its separator is keeping this + // flag to avoid comparing against the rendered visibility + virtual HRESULT get_ExpectedVisibility(_Outptr_ boolean * expectedVisibility) = 0; + virtual HRESULT set_ExpectedVisibility(_In_ boolean expectedVisibility) = 0; virtual HRESULT get_IsStretchable(_Outptr_ boolean * isStretchable) = 0; virtual HRESULT put_IsStretchable(boolean isStretchable) = 0; }; @@ -28,12 +33,15 @@ namespace AdaptiveNamespace _In_ ABI::Windows::UI::Xaml::Controls::IPanel* parentPanel, _In_ ABI::Windows::UI::Xaml::IUIElement* separator, _In_ ABI::Windows::UI::Xaml::Controls::IColumnDefinition* columnDefinition, - boolean isStretchable); + _In_ boolean expectedVisibility, + _In_ boolean isStretchable); virtual HRESULT get_ColumnDefinition(_COM_Outptr_ ABI::Windows::UI::Xaml::Controls::IColumnDefinition** columnDefinition) override; virtual HRESULT get_AdaptiveCardElement(_COM_Outptr_ ABI::AdaptiveNamespace::IAdaptiveCardElement** cardElement) override; virtual HRESULT get_Separator(_COM_Outptr_ ABI::Windows::UI::Xaml::IUIElement** separator) override; virtual HRESULT get_ParentPanel(_COM_Outptr_ ABI::Windows::UI::Xaml::Controls::IPanel** parentPanel) override; + virtual HRESULT get_ExpectedVisibility(_Outptr_ boolean* expectedVisibility) override; + virtual HRESULT set_ExpectedVisibility(_In_ boolean expectedVisibility) override; virtual HRESULT get_IsStretchable(_Outptr_ boolean* isStretchable) override; virtual HRESULT put_IsStretchable(boolean isStretchable) override; @@ -42,6 +50,7 @@ namespace AdaptiveNamespace Microsoft::WRL::ComPtr m_columnDefinition; Microsoft::WRL::ComPtr m_separator; Microsoft::WRL::WeakRef m_parentPanel; + boolean m_expectedVisibility; boolean m_isStretchable; }; } diff --git a/source/uwp/Renderer/lib/XamlBuilder.cpp b/source/uwp/Renderer/lib/XamlBuilder.cpp index cd86232fce..e83252f5af 100644 --- a/source/uwp/Renderer/lib/XamlBuilder.cpp +++ b/source/uwp/Renderer/lib/XamlBuilder.cpp @@ -884,7 +884,7 @@ namespace AdaptiveNamespace RETURN_IF_FAILED(element->get_Height(&heightType)); ComPtr tagContent; - RETURN_IF_FAILED(MakeAndInitialize(&tagContent, element, parentPanel, separator, columnDefinition, heightType == HeightType_Stretch)); + RETURN_IF_FAILED(MakeAndInitialize(&tagContent, element, parentPanel, separator, columnDefinition, isVisible, heightType == HeightType_Stretch)); RETURN_IF_FAILED(newControlAsFrameworkElement->put_Tag(tagContent.Get())); XamlHelpers::AppendXamlElementToPanel(newControl, parentPanel, heightType); @@ -983,11 +983,15 @@ namespace AdaptiveNamespace Visibility visibility; RETURN_IF_FAILED(child->get_Visibility(&visibility)); + boolean expectedVisibility{}; + RETURN_IF_FAILED(elementTagContent->get_ExpectedVisibility(&expectedVisibility)); + if (separator) { - if (visibility == Visibility_Collapsed || !foundPreviousVisibleElement) + if (!expectedVisibility || !foundPreviousVisibleElement) { // If the element is collapsed, or if it's the first visible element, collapse the separator + // Images are hidden while they are retrieved, we shouldn't hide the separator RETURN_IF_FAILED(separator->put_Visibility(Visibility_Collapsed)); } else @@ -1464,7 +1468,16 @@ namespace AdaptiveNamespace ComPtr toggleElementAsUIElement; RETURN_IF_FAILED(toggleElement.As(&toggleElementAsUIElement)); - Visibility visibilityToSet; + ComPtr toggleElementAsFrameworkElement; + RETURN_IF_FAILED(toggleElement.As(&toggleElementAsFrameworkElement)); + + ComPtr tag; + RETURN_IF_FAILED(toggleElementAsFrameworkElement->get_Tag(&tag)); + + ComPtr elementTagContent; + RETURN_IF_FAILED(tag.As(&elementTagContent)); + + Visibility visibilityToSet = Visibility_Visible; if (toggle == ABI::AdaptiveNamespace::IsVisible_IsVisibleTrue) { visibilityToSet = Visibility_Visible; @@ -1475,21 +1488,13 @@ namespace AdaptiveNamespace } else if (toggle == ABI::AdaptiveNamespace::IsVisible_IsVisibleToggle) { - Visibility currentVisibility; - RETURN_IF_FAILED(toggleElementAsUIElement->get_Visibility(¤tVisibility)); - visibilityToSet = (currentVisibility == Visibility_Collapsed) ? Visibility_Visible : Visibility_Collapsed; + boolean currentVisibility{}; + RETURN_IF_FAILED(elementTagContent->get_ExpectedVisibility(¤tVisibility)); + visibilityToSet = (currentVisibility) ? Visibility_Collapsed : Visibility_Visible; } RETURN_IF_FAILED(toggleElementAsUIElement->put_Visibility(visibilityToSet)); - - ComPtr toggleElementAsFrameworkElement; - RETURN_IF_FAILED(toggleElement.As(&toggleElementAsFrameworkElement)); - - ComPtr tag; - RETURN_IF_FAILED(toggleElementAsFrameworkElement->get_Tag(&tag)); - - ComPtr elementTagContent; - RETURN_IF_FAILED(tag.As(&elementTagContent)); + RETURN_IF_FAILED(elementTagContent->set_ExpectedVisibility(visibilityToSet == Visibility_Visible)); ComPtr parentPanel; RETURN_IF_FAILED(elementTagContent->get_ParentPanel(&parentPanel));