Skip to content

Commit

Permalink
[C] test for #17776 (#17796)
Browse files Browse the repository at this point in the history
  • Loading branch information
StephaneDelcroix committed Oct 23, 2023
1 parent 55e1c80 commit 33a01c0
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Controls/tests/Core.UnitTests/BindingUnitTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Microsoft.Maui.Graphics;
using Xunit;

namespace Microsoft.Maui.Controls.Core.UnitTests
Expand Down Expand Up @@ -2338,5 +2340,18 @@ public void ManualValueDoesntClearTwoWayBinding()
vm.Text = string.Empty;
Assert.Equal(string.Empty, entry.Text);
}

[Fact]
//https://github.com/dotnet/maui/issues/17776
public void DoubleSetBinding()
{
var button = new Button { BackgroundColor = Colors.HotPink };

//shouldn't crash
button.BackgroundColor = Colors.Coral;
button.SetBinding(Button.BackgroundColorProperty, new Binding("BackgroundColor", source: this));
button.BackgroundColor = Colors.Coral;
button.SetBinding(Button.BackgroundColorProperty, new Binding("BackgroundColor", source: this));
}
}
}

0 comments on commit 33a01c0

Please sign in to comment.