Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
d7a1a01
Initial plan for issue
Copilot Jun 17, 2025
4f1f8ad
Initial analysis and plan for DensityValue implementation
Copilot Jun 17, 2025
af56ccc
Add DensityValue struct and enhance GridLayoutManager with density-aw…
Copilot Jun 17, 2025
dff88d4
Add comprehensive tests for DensityValue pixel distribution scenarios
Copilot Jun 17, 2025
7d5cd33
Revert Templates/src JSON files and enhance copilot instructions
Copilot Jun 17, 2025
7ed62a3
Create IWindow.GetDisplayDensity extension method with platform-speci…
Copilot Jun 17, 2025
76af21b
Remove GetDisplayDensity extension method and use window.RequestDispl…
Copilot Jun 18, 2025
94028e7
Remove all changes to WindowExtensions.cs as requested
Copilot Jun 18, 2025
1c5f8de
Add GridLayoutManager tests for DensityValue scenarios from PR descri…
Copilot Jun 18, 2025
4f5dc0c
Copy changes from PR #28259 to fix label text cropping in Border cont…
Copilot Jun 18, 2025
a03b965
Fix compilation error by removing unused variable
Copilot Jun 18, 2025
8cd3a4f
Remove Tizen ViewExtensions changes and add conditional compilation f…
Copilot Jun 18, 2025
7d4f1ef
Address code review feedback: remove TIZEN ifdefs, add error logging,…
Copilot Jun 19, 2025
1aa7308
Add ArrangesContentWithoutOverlapAndWithProperSize test replicating d…
Copilot Jun 19, 2025
db9afd5
Revert Templates JSON files that should not be committed
Copilot Jun 19, 2025
0148325
Update tests to validate RawPx values instead of Dp values
Copilot Jun 19, 2025
ad04ae2
Implement IViewWithWindow interface and density-aware test infrastruc…
Copilot Jun 20, 2025
2e6d67a
Update tests to use tolerance-based comparisons while maintaining den…
Copilot Jun 20, 2025
c32c3e2
Fix density-aware tests to use tolerance-based comparisons and focus …
Copilot Jun 20, 2025
04ebf82
Implement IViewWithWindow interface for density-aware testing and upd…
Copilot Jun 20, 2025
92d7d78
Add debugging test to investigate density-aware distribution failure
Copilot Jun 20, 2025
fa3375f
Refactor GridLayoutManager to use pixel-first DensityValue approach
Copilot Jun 20, 2025
ba194c2
Complete pixel-first DensityValue refactor with runtime compatibility
Copilot Jun 20, 2025
09d8a23
Update Cell to use DensityValue for pixel-precise measurements and fi…
Copilot Jun 20, 2025
b42c29c
Add debugging to trace precision loss between star resolution and cel…
Copilot Jun 20, 2025
9cd2dc9
Convert MinimumSize property in Definition class to use DensityValue …
Copilot Jun 20, 2025
b6f929b
Revert Templates JSON files and enhance copilot instructions for prev…
Copilot Jun 20, 2025
eab0cf0
Fix backward compatibility for density-aware Grid layout when density…
Copilot Jun 20, 2025
638c4bf
Address review feedback: use Math.Floor, implement right-to-left pixe…
Copilot Jun 21, 2025
5741ff2
- add additional logging to device tests
PureWeen Jun 21, 2025
847a476
Address review feedback: add density 2.625 tests and revert Templates…
Copilot Jun 21, 2025
0f7b6fc
Complete density 2.625 tests with correct pixel expectations and fix …
Copilot Jun 21, 2025
8e05bf9
- fix stub
PureWeen Jun 21, 2025
97ed27f
Fix ViewsInUnconstrainedStarRowsDoNotOverlapWhenArrangeHeightChanges …
Copilot Jun 21, 2025
55e3236
Fix pixel distribution algorithm and address structural review feedba…
Copilot Jun 21, 2025
c857bc0
Remove debug output and identify core issue with density-aware star e…
Copilot Jun 21, 2025
9dbe3ad
Fix failing ArrangesContentWithoutOverlapAndWithProperSize tests: use…
Copilot Jun 21, 2025
c02791a
Restore GridLayoutManager to original implementation with DensityValu…
Copilot Jun 22, 2025
1920d71
Fix failing tests by restoring GridLayoutManager to use DensityValue …
Copilot Jun 22, 2025
2a1f16c
Implement density-aware Grid star sizing for pixel-perfect layout
Copilot Jun 22, 2025
59f4c0c
Integrate density-aware logic into ExpandStars method and remove Pre-…
Copilot Jun 22, 2025
4415725
Remove density conditional logic from ExpandStars method
Copilot Jun 22, 2025
9c694ab
Fix compilation errors and maintain backwards compatibility for densi…
Copilot Jun 22, 2025
8068388
Remove conditional density logic and unify star expansion algorithm
Copilot Jun 22, 2025
1517527
Fix failing tests by setting appropriate density values for pixel-per…
Copilot Jun 23, 2025
df05f7d
- update screen shots
PureWeen Jun 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,19 @@ dotnet cake --target=dotnet-pack
### Testing and Debugging

#### Testing Guidelines
- **Always** ensure code compiles before running tests to validate changes, otherwise you might be running tests against old code
- **Always** run unit tests for any code changes before finishing
- **Never** leave failing unit tests that were introduced by your changes
- Add tests for new functionality
- Ensure existing tests pass:
- `src/Core/tests/UnitTests/Core.UnitTests.csproj`
- `src/Essentials/test/UnitTests/Essentials.UnitTests.csproj`
- `src/Compatibility/Core/tests/Compatibility.UnitTests/Compatibility.Core.UnitTests.csproj`
- `src/Controls/tests/Core.UnitTests/Controls.Core.UnitTests.csproj`
- `src/Controls/tests/Xaml.UnitTests/Controls.Xaml.UnitTests.csproj`
- Use `dotnet test` to run specific test projects or test filters
- When adding new unit tests, ensure they pass consistently
- Fix any test failures before committing and pushing changes

### Code Formatting

Expand Down Expand Up @@ -174,10 +180,25 @@ When working on an issue:
- More robust implementation patterns

### Files to Never Commit
- **Never** check in changes to `cgmanifest.json` files
- **Never** check in changes to `templatestrings.json` files
- **Never** check in changes to `cgmanifest.json` files (especially in `Templates/src/` directory)
- **Never** check in changes to `templatestrings.json` files (especially in `Templates/src/` directory)
- **Always revert** any changes to JSON files in the `Templates/src/` directory before committing
- These files are automatically generated and should not be modified manually



### Platform-Specific Restrictions
- **Never** make changes to files related to Tizen platform
- Tizen-specific code should not be modified unless explicitly required for critical fixes

### Testing Guidelines
- **Always** ensure code compiles before running tests to validate changes, otherwise you might be running tests against old code
- **Always** run unit tests for any code changes before finishing
- **Never** leave failing unit tests that were introduced by your changes
- Use `dotnet test` to run specific test projects or test filters
- When adding new unit tests, ensure they pass consistently
- Fix any test failures before committing and pushing changes

### File Reset Guidelines for AI Agents
Since coding agents function as both CI and pair programmers, they need to handle CI-generated files appropriately:

Expand Down
4 changes: 3 additions & 1 deletion src/Controls/src/Core/View/View.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Microsoft.Maui.Controls
/// This is the base class for <see cref="Layout"/> and most of the controls.
/// Because <see cref="View" /> ultimately inherits from <see cref="BindableObject" />, application developers can use the Model-View-ViewModel architecture, as well as XAML, to develop portable user interfaces.
/// </remarks>
public partial class View : VisualElement, IViewController, IGestureController, IGestureRecognizers, IView, IPropertyMapperView, IHotReloadableView, IControlsView
public partial class View : VisualElement, IViewController, IGestureController, IGestureRecognizers, IView, IPropertyMapperView, IHotReloadableView, IControlsView, IViewWithWindow
{
protected internal IGestureController GestureController => this;

Expand Down Expand Up @@ -314,6 +314,8 @@ internal protected PropertyMapper<T> GetRendererOverrides<T>() where T : IView =

IReloadHandler IHotReloadableView.ReloadHandler { get; set; }

IWindow? IViewWithWindow.Window => Window;

void IHotReloadableView.TransferState(IView newView)
{
//TODO: LEt you hot reload the the ViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.Maui;
using Microsoft.Maui.Controls;
using Microsoft.Maui.Controls.Handlers;
using Microsoft.Maui.Devices;
using Microsoft.Maui.DeviceTests.Stubs;
using Microsoft.Maui.Graphics;
using Microsoft.Maui.Handlers;
Expand Down Expand Up @@ -81,7 +82,8 @@ await CreateHandlerAndAddToWindow(grid, (LayoutHandler handler) =>

// This fails sometimes due to the way we arrange the content based on coordinates instead of size
// Assert.Equal(expectedWidth, pxFrame.Width);
Assert.True(pxFrame.Left == lastRight);

Assert.True(pxFrame.Left == lastRight, $"ColumnCount: {columnCount} Expected Left {lastRight} but got {pxFrame.Left} for child {i} Device Info: {DeviceDisplay.Current.MainDisplayInfo}");

lastRight = pxFrame.Right;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ public class WindowHandlerStub : ElementHandler<IWindow, AActivity>, IWindowHand
[nameof(IWindow.Content)] = MapContent
};

public static CommandMapper<IWindow, IWindowHandler> CommandMapper = new(ElementCommandMapper)
{
[nameof(IWindow.RequestDisplayDensity)] = WindowHandler.MapRequestDisplayDensity,
};

public AView PlatformViewUnderTest { get; private set; }

void UpdateContent()
Expand Down Expand Up @@ -50,7 +55,7 @@ protected override void DisconnectHandler(AActivity platformView)
}

public WindowHandlerStub()
: base(WindowMapper)
: base(WindowMapper, CommandMapper)
{
}

Expand Down
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions src/Controls/tests/TestCases.HostApp/Issues/Issue28117.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace Maui.Controls.Sample.Issues;

[Issue(IssueTracker.Github, 28117, "Label text is cropped inside the border control with a specific padding value on certain Android devices", PlatformAffected.Android)]
public class Issue28117 : ContentPage
{
public Issue28117()
{
Content = new VerticalStackLayout
{
WidthRequest = 350,
Children =
{
new Border()
{
Padding = new Thickness(70.89827027958738, 0, 0, 0),
Margin = new Thickness(10),
StrokeThickness = 1,
Stroke = Colors.Black,
Content =
new Label
{
AutomationId = "Label",
FontFamily = "OpenSansRegular",
FontSize = 16,
Text = "At any time, but not later than one month before the expiration date"
}
},
}
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#if !MACCATALYST // On Mac platform, Label does not wrap properly when a width request is set https://github.com/dotnet/maui/issues/15559
using NUnit.Framework;
using UITest.Appium;
using UITest.Core;

namespace Microsoft.Maui.TestCases.Tests.Issues;

public class Issue28117 : _IssuesUITest
{
public Issue28117(TestDevice device) : base(device) { }

public override string Issue => "Label text is cropped inside the border control with a specific padding value on certain Android devices";

[Test]
[Category(UITestCategories.Border)]
public void ShouldDisplayLabelWithoutBeingCroppedInsideBorder()
{
App.WaitForElement("Label");
VerifyScreenshot();
}
}
#endif
17 changes: 17 additions & 0 deletions src/Core/src/IViewWithWindow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#nullable enable

namespace Microsoft.Maui
{
/// <summary>
/// Internal interface for views that can provide access to their window.
/// This enables dependency injection for testing scenarios.
/// </summary>
// TODO Delete this in NET10 and just add it with a default implementation to IView
internal interface IViewWithWindow
{
/// <summary>
/// Gets the window associated with this view.
/// </summary>
IWindow? Window { get; }
Comment thread
PureWeen marked this conversation as resolved.
}
}
Loading