Skip to content

Commit

Permalink
[C] test for #17776 (#18264)
Browse files Browse the repository at this point in the history
Co-authored-by: Stephane Delcroix <stephane@delcroix.org>
  • Loading branch information
github-actions[bot] and StephaneDelcroix authored Oct 23, 2023
1 parent 049a0a6 commit 44e03cc
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 44e03cc

Please sign in to comment.