Skip to content

Commit

Permalink
TableView title issue fix on windows platforms. (#25414)
Browse files Browse the repository at this point in the history
* TableView title issue fix on IOS and windows platforms.

* Added test cases

* Modified a test cases

* Modified a fix

* Modified a test case

* Addressed a review concerns

* Removed unwanted changes

* Modified the test cases

* Added snap shots for android and IOS

* Added image for windows

* Added images for IOS

* Removed IOS code changes

* Added image for IOS

---------

Co-authored-by: Shalini-Ashokan <[email protected]>
Co-authored-by: Shalini-Ashokan <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2024
1 parent 11291a2 commit adb3529
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@


<DataTemplate x:Key="TableRoot">
<TextBlock Margin="0,20,0,0" Text="{Binding Title,Converter={StaticResource LowerConverter}}" Style="{ThemeResource TitleTextBlockStyle}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource CollapseWhenEmpty}}" />
<TextBlock Margin="0,20,0,0" Text="{Binding Title}" Style="{ThemeResource TitleTextBlockStyle}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource CollapseWhenEmpty}}" />
</DataTemplate>

<DataTemplate x:Key="TableSection">
<TextBlock Margin="0,20,0,0" Text="{Binding Title,Converter={StaticResource LowerConverter}}" Style="{ThemeResource SubtitleTextBlockStyle}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource CollapseWhenEmpty}}" Foreground="{Binding TextColor,Converter={StaticResource ColorConverter},ConverterParameter=DefaultTextForegroundThemeBrush}" />
<TextBlock Margin="0,20,0,0" Text="{Binding Title}" Style="{ThemeResource SubtitleTextBlockStyle}" Visibility="{Binding Text,RelativeSource={RelativeSource Mode=Self},Converter={StaticResource CollapseWhenEmpty}}" Foreground="{Binding TextColor,Converter={StaticResource ColorConverter},ConverterParameter=DefaultTextForegroundThemeBrush}" />
</DataTemplate>

</ResourceDictionary>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue17123.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using System;
using Microsoft.Maui;
using Microsoft.Maui.Controls;

namespace Maui.Controls.Sample.Issues
{
[Issue(IssueTracker.Github, 17123, "TableSection and TableRoot Title properties are displayed as lower case", PlatformAffected.All)]
public class Issue17123 : TestContentPage
{
protected override void Init()
{
var tableRootLabel = new Label() { Text = "TableRoot Title Text", TextColor = Colors.Red, AutomationId = "TableRootLabel" };
var tableSectionLabel = new Label() { Text = "TableSection Title Text", TextColor = Colors.Red, AutomationId = "TableSectionLabel" };

var tableView = new TableView() { Intent = TableIntent.Menu, AutomationId = "TableView", HorizontalOptions= LayoutOptions.Center };
var tableRoot = new TableRoot(tableRootLabel.Text);
var tableSection = new TableSection(tableSectionLabel.Text)
{
new TextCell() { Text = "TextCell Text" , Detail="TextCell Detail" },
new EntryCell() { Label = "EntryCell Label", Placeholder="EntryCell Placeholder" },
};

tableRoot.Add(tableSection);
tableView.Root = tableRoot;

var stackLayout = new StackLayout();
stackLayout.Children.Add(tableRootLabel);
stackLayout.Children.Add(tableSectionLabel);
stackLayout.Children.Add(tableView);

Content = stackLayout;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues
{
public class Issue17123 : _IssuesUITest
{
public override string Issue => "TableSection and TableRoot Title properties are displayed as lower case";

public Issue17123(TestDevice device) : base(device)
{
}

[Test]
[Category(UITestCategories.TableView)]
public void ValidateTableViewTitles()
{
App.WaitForElement("TableView");
var tableViewRootText = App.FindElement("TableRootLabel").GetText();
if (string.IsNullOrEmpty(tableViewRootText))
{
Assert.Fail("Table root text is does not match expected");
}
else
{
Assert.That(tableViewRootText, Is.EqualTo("TableRoot Title Text"));
}

var tableViewSelectionText = App.FindElement("TableSectionLabel").GetText();
if (string.IsNullOrEmpty(tableViewSelectionText))
{
Assert.Fail("Table selection text is does not match expected");
}
else
{
Assert.That(tableViewSelectionText, Is.EqualTo("TableSection Title Text"));
}

VerifyScreenshot();
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit adb3529

Please sign in to comment.