コード例 #1
0
			public void TestStyle (bool useCompiledXaml)
			{
				var layout = new StyleTests (useCompiledXaml);
				Assert.That (layout.style0, Is.InstanceOf<Style> ());
				Assert.AreSame (layout.style0, layout.label0.Style);
				Assert.AreEqual ("FooBar", layout.label0.Text);
			}
コード例 #2
0
			public void PropertyDoesNotNeedTypes (bool useCompiledXaml)
			{
				var layout = new StyleTests (useCompiledXaml);
				Style style2 = layout.style2;
				var s0 = style2.Setters [0];
				var s1 = style2.Setters [1];
				Assert.AreEqual (Label.TextProperty, s0.Property);
				Assert.AreEqual (BackgroundColorProperty, s1.Property);
				Assert.AreEqual (Color.Red, s1.Value);
			}
コード例 #3
0
			public void TestConversionOnSetters (bool useCompiledXaml)
			{
				var layout = new StyleTests (useCompiledXaml);
				Style style = layout.style1;
				Setter setter;

				//Test built-in conversions
				setter = style.Setters.Single (s => s.Property == HeightProperty);
				Assert.That (setter.Value, Is.TypeOf<double> ());
				Assert.AreEqual (42d, (double)setter.Value);

				//Test TypeConverters
				setter = style.Setters.Single (s => s.Property == BackgroundColorProperty);
				Assert.That (setter.Value, Is.TypeOf<Color> ());
				Assert.AreEqual (Color.Pink, (Color)setter.Value);

				//Test implicit cast operator
				setter = style.Setters.Single (s => s.Property == Image.SourceProperty);
				Assert.That (setter.Value, Is.TypeOf<FileImageSource> ());
				Assert.AreEqual ("foo.png", ((FileImageSource)setter.Value).File);
			}
コード例 #4
0
ファイル: StyleTests.xaml.cs プロジェクト: gywerd/CPUI
            public void ImplicitStyleAreApplied(bool useCompiledXaml)
            {
                var layout = new StyleTests(useCompiledXaml);

                Assert.AreEqual(Color.Red, layout.label1.TextColor);
            }
コード例 #5
0
			//issue #2406
			public void StylesDerivedFromDynamicStylesThroughStaticResource (bool useCompiledXaml)
			{
				var layout = new StyleTests (useCompiledXaml);
				Application.Current.MainPage = layout;

				var label = layout.labelWithStyleDerivedFromDynamic_StaticResource;

				Assert.AreEqual (50, label.FontSize);
				Assert.AreEqual (Color.Red, label.TextColor);
			}
コード例 #6
0
			public void ImplicitStyleAreApplied (bool useCompiledXaml)
			{
				var layout = new StyleTests (useCompiledXaml);
				Assert.AreEqual (Color.Red, layout.label1.TextColor);
			}