1
+ // Licensed to the .NET Foundation under one or more agreements.
2
+ // The .NET Foundation licenses this file to you under the MIT license.
3
+ // See the LICENSE file in the project root for more information.
4
+
5
+ using Microsoft . Windows . Apps . Test . Foundation . Controls ;
6
+ using Windows . UI . Xaml . Tests . MUXControls . InteractionTests . Common ;
7
+ using Windows . UI . Xaml . Tests . MUXControls . InteractionTests . Infra ;
8
+
9
+ #if USING_TAEF
10
+ using WEX . Logging . Interop ;
11
+ using WEX . TestExecution ;
12
+ using WEX . TestExecution . Markup ;
13
+ #else
14
+ using Microsoft . VisualStudio . TestTools . UnitTesting ;
15
+ #endif
16
+
17
+ namespace UITests . Tests
18
+ {
19
+ [ TestClass ]
20
+ public class ColorPickerButtonTest : UITestBase
21
+ {
22
+ [ ClassInitialize ]
23
+ [ TestProperty ( "RunAs" , "User" ) ]
24
+ [ TestProperty ( "Classification" , "ScenarioTestSuite" ) ]
25
+ [ TestProperty ( "Platform" , "Any" ) ]
26
+ public static void ClassInitialize ( TestContext testContext )
27
+ {
28
+ TestEnvironment . Initialize ( testContext , WinUICsUWPSampleApp ) ;
29
+ }
30
+
31
+ /// <summary>
32
+ /// This test validates the two way binding of the selected color. It verifies that
33
+ /// when the bound property changes this change is properly forwarded to the internal colorpicker.
34
+ /// See also issue #4367
35
+ /// </summary>
36
+ [ TestMethod ]
37
+ [ TestPage ( "ColorPickerButtonTestPage" ) ]
38
+ public void TwoWayTestMethod ( )
39
+ {
40
+ var colorpicker = new Button ( FindElement . ById ( "TheColorPickerButton" ) ) ;
41
+
42
+ var redButton = new Button ( FindElement . ById ( "SetRedButton" ) ) ;
43
+
44
+ Verify . IsNotNull ( colorpicker ) ;
45
+ Verify . IsNotNull ( colorpicker ) ;
46
+
47
+ colorpicker . Click ( ) ;
48
+
49
+ Wait . ForIdle ( ) ;
50
+ var colorInput = GetColorPickerInputField ( ) ;
51
+
52
+ Verify . AreEqual ( "008000" , colorInput . GetText ( ) ) ;
53
+
54
+ // close the picker
55
+ colorpicker . Click ( ) ;
56
+
57
+ Wait . ForIdle ( ) ;
58
+
59
+ redButton . Click ( ) ;
60
+
61
+ Wait . ForIdle ( ) ;
62
+
63
+ colorpicker . Click ( ) ;
64
+
65
+ var colorInput_new = GetColorPickerInputField ( ) ;
66
+ Verify . AreEqual ( "FF0000" , colorInput_new . GetText ( ) ) ;
67
+ }
68
+
69
+ private static Edit GetColorPickerInputField ( )
70
+ {
71
+ var channelButton = new Button ( FindElement . ByName ( "Channels" ) ) ;
72
+ Verify . IsNotNull ( channelButton ) ;
73
+
74
+ Wait . ForIdle ( ) ;
75
+
76
+ channelButton . Click ( ) ;
77
+
78
+ Wait . ForIdle ( ) ;
79
+
80
+ var colorInput = new Edit ( FindElement . ByName ( "Hexadecimal Color Input" ) ) ;
81
+ Verify . IsNotNull ( colorInput ) ;
82
+ return colorInput ;
83
+ }
84
+ }
85
+ }
0 commit comments