summaryrefslogtreecommitdiff
path: root/Xamarin.Forms.Controls.Issues/Xamarin.Forms.Controls.Issues.Shared/Bugzilla35738.cs
blob: e79343b3437d2666cf2250e59baa616acbe1208e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Diagnostics;
using Xamarin.Forms.CustomAttributes;

#if UITEST
using Xamarin.UITest;
using NUnit.Framework;
#endif

namespace Xamarin.Forms.Controls
{
    [Preserve (AllMembers = true)]
    public class CustomButton : Button
    {
        // In the Android project, there's a custom renderer set up for this type
    }

    [Preserve (AllMembers = true)]
    [Issue (IssueTracker.Bugzilla, 35738, "ButtonRenderer UpdateTextColor function crash", PlatformAffected.Android)]
    public class Bugzilla35738 : TestContentPage
    {
        protected override void Init ()
        {
            var label = new Label () { Text = "If you can see the button, this test has passed" };
            var customButton = new CustomButton () { Text = "This is a custom button", TextColor = Color.Fuchsia };

            Content = new StackLayout () {
                Children = { label, customButton }
            };
        }

#if UITEST
        [Test]
        [UiTest (typeof(TestContentPage))]
        public void CallingOnElementChangedOnCustomButtonShouldNotCrash ()
        {
            RunningApp.WaitForElement (q => q.Marked ("This is a custom button"));
        }
#endif
    }
}