-using Tizen.NUI.Devel.Tests;
+using Tizen.NUI.Binding.Internals;
+using Tizen.NUI.Devel.Tests;
using Tizen.NUI.Xaml;
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
+++ /dev/null
-using System;
-using System.Collections.Generic;
-using System.Text;
-
-namespace Tizen.NUI.Devel.Tests
-{
- [AttributeUsage(AttributeTargets.All)]
- public class PreserveAttribute : Attribute
- {
- public bool AllMembers;
- public bool Conditional;
-
- public PreserveAttribute()
- {
- }
-
- public PreserveAttribute(bool allMembers, bool conditional)
- {
- AllMembers = allMembers;
- Conditional = conditional;
- }
- }
-}
<None Remove="res\layout\BindingSample.xaml" />
<None Remove="res\layout\MyResourceDictionary.xaml" />
<None Remove="testcase\public\Xaml\TotalSample\BaseXamlSample2.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\BindablePropertiesAccessModifiers.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\BindingsCompiler.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\BuiltInConversions.xaml" />
<None Remove="testcase\public\Xaml\TotalSample\ClockView.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\CustomXamlView.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\DuplicatePropertyElements.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\DuplicateXArgumentsElements.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\DynamicResource.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\FactoryMethodMissingCtor.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\FactoryMethodMissingMethod.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\FactoryMethods.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\FieldModifier.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\FindByName.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\GenericCollections.xaml" />
<None Remove="testcase\public\Xaml\TotalSample\HslColorScrollView.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\I8.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\McIgnorable.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\ResourceDictionaryWithInvalidSource.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\SetStyleIdFromXName.xaml" />
<None Remove="testcase\public\Xaml\TotalSample\StaticDateTimeView.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\StringLiterals.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\TestXmlnsUsing.xaml" />
<None Remove="testcase\public\Xaml\TotalSample\TotalSample.xaml" />
<None Remove="testcase\public\Xaml\TotalSample\XamlStyleSample.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\XArray.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\XReference.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\XStatic.xaml" />
+ <None Remove="testcase\public\Xaml\TotalSample\XStaticException.xaml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="res\layout\MyResourceDictionary.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\BindablePropertiesAccessModifiers.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\BindingsCompiler.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\BuiltInConversions.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
<EmbeddedResource Include="testcase\public\Xaml\TotalSample\ClockView.xaml">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\CustomXamlView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\DuplicatePropertyElements.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\DuplicateXArgumentsElements.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\DynamicResource.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\FactoryMethodMissingCtor.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\FactoryMethodMissingMethod.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\FactoryMethods.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\FieldModifier.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\FindByName.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\GenericCollections.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
<EmbeddedResource Include="testcase\public\Xaml\TotalSample\HslColorScrollView.xaml">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\I8.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\McIgnorable.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\ResourceDictionaryWithInvalidSource.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\SetStyleIdFromXName.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
<EmbeddedResource Include="testcase\public\Xaml\TotalSample\StaticDateTimeView.xaml">
<Generator>MSBuild:Compile</Generator>
</EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\StringLiterals.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\TestXmlnsUsing.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\XArray.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\XReference.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\XStatic.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
+ <EmbeddedResource Include="testcase\public\Xaml\TotalSample\XStaticException.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ </EmbeddedResource>
</ItemGroup>
<ItemGroup>
<l:RgbColorViewModel Color="Red" />
</TextLabel.BindingContext>
</TextLabel>
+
+ <TextLabel PointSize="18">
+ <TextLabel.XamlStyle>
+ <Binding Source="{x:Reference view1}" Path="Sensitive">
+ <Binding.Converter>
+ <l:BoolToObjectConverter x:TypeArguments="XamlStyle">
+ <l:BoolToObjectConverter.TrueObject>
+ <XamlStyle TargetType="TextLabel">
+ <Setter Property="Text" Value="Indubitably!" />
+ <Setter Property="TextColor" Value="Green" />
+ </XamlStyle>
+ </l:BoolToObjectConverter.TrueObject>
+
+ <l:BoolToObjectConverter.FalseObject>
+ <XamlStyle TargetType="TextLabel">
+ <Setter Property="Text" Value="Maybe later" />
+ <Setter Property="TextColor" Value="Red" />
+ </XamlStyle>
+ </l:BoolToObjectConverter.FalseObject>
+ </l:BoolToObjectConverter>
+ </Binding.Converter>
+ </Binding>
+ </TextLabel.XamlStyle>
+ </TextLabel>
</View>
</ResourceDictionary>
</l:UIElement.XamlResources>
- <l:UIElement x:Name="t1" CharP="c" StringP="{Binding Path=Size.Width, Converter={StaticResource floatToStringConverter}, StringFormat='{0:N0}'}" BindingContext="{x:Reference t2}" />
+ <l:UIElement x:Name="t1" CharP="c" StringP="{Binding Path=.Size.Width, Converter={StaticResource floatToStringConverter}, StringFormat='{0:N0}'}" BindingContext="{x:Reference t2}" />
<l:UIElement x:Name="t2" Size="300, 200" Position="{DynamicResource positionKey}" />
<l:UIElement x:Name="t3" StringP="{Binding Source={x:Reference t2}, Path=Size.Height, Converter={StaticResource floatToStringConverter}, StringFormat='{0:N0}'}" />
+ <l:UIElement x:Name="t4" StringP="{Binding Source={x:Reference t2}, Path=StringIndexer.[0]}" />
<l:UIElement CustomBindableProperty="View.Position">
</l:UIElement>
using NUnit.Framework;
using System;
+using System.Collections;
using System.Collections.Generic;
using System.Xml;
using Tizen.NUI.Binding;
{
using tlog = Tizen.Log;
+ internal class MockNameSpaceResolver : IXmlNamespaceResolver
+ {
+ public global::System.Collections.Generic.IDictionary<string, string> GetNamespacesInScope(XmlNamespaceScope scope)
+ {
+ throw new NotImplementedException();
+ }
+
+ public string LookupNamespace(string prefix)
+ {
+ return "";
+ }
+
+ public string LookupPrefix(string namespaceName)
+ {
+ return "";
+ }
+ }
+
[TestFixture]
[Description("internal/Xaml/ApplyPropertiesVisitor")]
public class InternalApplyPropertiesVisitorTest
private const string tag = "NUITEST";
private ApplyPropertiesVisitor visitor;
+ public class MarkupExtension : IMarkupExtension
+ {
+ public object ProvideValue(global::System.IServiceProvider serviceProvider)
+ {
+ return "provided value";
+ }
+ }
+
+ public class ArrayListOwner
+ {
+ public ArrayList ArrayList { get; } = new ArrayList();
+ }
+
internal class INodeImpl : INode
{
public global::System.Collections.Generic.List<string> IgnorablePrefixes { get; set; }
// tlog.Debug(tag, $"ApplyPropertiesVisitorSetPropertyValue END");
//}
- //[Test]
- //[Category("P1")]
- //[Description("ApplyPropertiesVisitor GetPropertyValue")]
- //[Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.GetPropertyValue M")]
- //[Property("SPEC_URL", "-")]
- //[Property("CRITERIA", "MR")]
- //public void ApplyPropertiesVisitorGetPropertyValue()
- //{
- // tlog.Debug(tag, $"ApplyPropertiesVisitorGetPropertyValue START");
+ [Test]
+ [Category("P1")]
+ [Description("ApplyPropertiesVisitor GetPropertyValue")]
+ [Property("SPEC", "Tizen.NUI.ApplyPropertiesVisitor.GetPropertyValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ApplyPropertiesVisitorGetPropertyValue()
+ {
+ tlog.Debug(tag, $"ApplyPropertiesVisitorGetPropertyValue START");
- // try
- // {
- // object o1 = new object();
- // XmlName xmlName = new XmlName();
- // Assert.IsNotNull(xmlName, "null XmlName");
- // object value = new object();
- // INodeImplement nodeImplement = new INodeImplement();
- // Assert.IsNotNull(nodeImplement, "null INodeImplement");
- // HydrationContext context = new HydrationContext();
- // Assert.IsNotNull(context, "null HydrationContext");
- // IXmlLineInfoImplement xmlLineInfoImplement = new IXmlLineInfoImplement();
- // Assert.IsNotNull(xmlLineInfoImplement, "null IXmlLineInfoImplement");
- // ApplyPropertiesVisitor.GetPropertyValue(o1, xmlName, context, xmlLineInfoImplement, out value);
- // }
- // catch (Exception e)
- // {
- // tlog.Debug(tag, e.Message.ToString());
- // Assert.Fail("Caught Exception" + e.ToString());
- // }
- // tlog.Debug(tag, $"ApplyPropertiesVisitorGetPropertyValue END");
- //}
+ try
+ {
+ const string NAMESPACE = "clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests";
+ var resolver = new MockNameSpaceResolver();
+ var type = new XmlType(NAMESPACE, "InternalApplyPropertiesVisitorTest+MarkupExtension", null);
+ var listNode = new ListNode(new[]
+ {
+ new ElementNode(type, NAMESPACE, resolver),
+ new ElementNode(type, NAMESPACE, resolver)
+ }, resolver);
+ var rootElement = new ArrayListOwner();
+ var rootType = new XmlType(NAMESPACE, "InternalApplyPropertiesVisitorTest+ArrayListOwner", null);
+ var rootNode = new XamlLoader.RuntimeRootNode(rootType, rootElement, null);
+ var context = new HydrationContext { RootElement = rootElement };
+
+ rootNode.Properties.Add(new XmlName(null, "ArrayList"), listNode);
+ rootNode.Accept(new XamlNodeVisitor((node, parent) => node.Parent = parent), null);
+ rootNode.Accept(new CreateValuesVisitor(context), null);
+ rootNode.Accept(new ApplyPropertiesVisitor(context), null);
+
+ Assert.AreEqual("provided value", rootElement.ArrayList[0]);
+ Assert.AreEqual("provided value", rootElement.ArrayList[1]);
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"ApplyPropertiesVisitorGetPropertyValue END");
+ }
}
}
\ No newline at end of file
[Test]
[Category("P1")]
[Description("MarkupExtensionParser Parse")]
- [Property("SPEC", "Tizen.NUI.MarkupExtensionParser.Parse M")]
+ [Property("SPEC", "Tizen.NUI.Xaml.MarkupExtensionParser.Parse M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
public void MarkupExtensionParserParse()
tlog.Debug(tag, $"MarkupExtensionParserParse END");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("MarkupExtensionParser Parse")]
+ [Property("SPEC", "Tizen.NUI.Xaml.MarkupExtensionParser.Parse M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void MarkupExtensionParserParse2()
+ {
+ tlog.Debug(tag, $"MarkupExtensionParserParse2 START");
+
+ try
+ {
+ string str = "{Binding Red}";
+ IServiceProviderImpl provider = new IServiceProviderImpl();
+ Assert.IsNotNull(provider, "null IServiceProviderImplement");
+ extParser.Parse("Binding", ref str, provider);
+ string str2 = "{TemplateBinding Red}";
+ extParser.Parse("TemplateBinding", ref str2, provider);
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"MarkupExtensionParserParse2 END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("MarkupExtensionParser Parse")]
+ [Property("SPEC", "Tizen.NUI.Xaml.MarkupExtensionParser.Parse M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void MarkupExtensionParserParse3()
+ {
+ tlog.Debug(tag, $"MarkupExtensionParserParse3 START");
+
+ try
+ {
+ string str = "{Binding Red}";
+ IServiceProviderImpl provider = new IServiceProviderImpl();
+ Assert.IsNotNull(provider, "null IServiceProviderImplement");
+ string str3 = "}";
+ extParser.Parse("StaticResource", ref str3, provider);
+ }
+ catch (XamlParseException e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.True(true, $"Should caught Exception {e.Message.ToString()}");
+ }
+
+ tlog.Debug(tag, $"MarkupExtensionParserParse3 END");
+ }
}
}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/Xaml/ResourcesLoader")]
+ public class InternalResourcesLoaderTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ResourcesLoader CreateFromResource<T>")]
+ [Property("SPEC", "Tizen.NUI.Xaml.ResourcesLoader.CreateFromResource<T> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ResourcesLoaderCreateFromResourceTest()
+ {
+ tlog.Debug(tag, $"ResourcesLoaderCreateFromResourceTest START");
+
+ try
+ {
+ var rl = new ResourcesLoader();
+ var ret = rl.CreateFromResource<View>("layout/BaseXamlSample3.xaml", typeof(UIElement).Assembly, null);
+ Assert.IsNotNull(ret, "Should not be null");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"ResourcesLoaderCreateFromResourceTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ResourcesLoader GetResource")]
+ [Property("SPEC", "Tizen.NUI.Xaml.ResourcesLoader.GetResource M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ResourcesLoaderGetResourceTest()
+ {
+ tlog.Debug(tag, $"ResourcesLoaderGetResourceTest START");
+
+ try
+ {
+ var rl = new ResourcesLoader();
+ var ret = rl.GetResource("layout/TotalSample.xaml", typeof(UIElement).Assembly, null);
+ Assert.IsNotNull(ret, "Should not be null");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"ResourcesLoaderGetResourceTest END");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/Xaml/RuntimeNamePropertyAttribute")]
+ public class InternalRuntimeNamePropertyAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RuntimeNamePropertyAttribute RuntimeNamePropertyAttribute")]
+ [Property("SPEC", "Tizen.NUI.Xaml.RuntimeNamePropertyAttribute.RuntimeNamePropertyAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void RuntimeNamePropertyAttributeConstructor()
+ {
+ tlog.Debug(tag, $"RuntimeNamePropertyAttributeConstructor START");
+
+ try
+ {
+ var rnp = new RuntimeNamePropertyAttribute("Content");
+ Assert.IsNotNull(rnp, "Should not be null");
+ Assert.AreEqual("Content", rnp.Name, "Should be equal");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"RuntimeNamePropertyAttributeConstructor END");
+ }
+
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/Xaml/ValueNode")]
+ public class InternalValueNodeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ValueNode Clone")]
+ [Property("SPEC", "Tizen.NUI.Xaml.ValueNode.Clone M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ValueNodeCloneTest()
+ {
+ tlog.Debug(tag, $"ValueNodeCloneTest START");
+
+ try
+ {
+ var node = new ValueNode("1", null, 1, 1);
+ var ret = node.Clone();
+ Assert.IsNotNull(ret, "Should not be equal");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"ValueNodeCloneTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MarkupNode Clone")]
+ [Property("SPEC", "Tizen.NUI.Xaml.MarkupNode.Clone M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void MarkupNodeCloneTest()
+ {
+ tlog.Debug(tag, $"MarkupNodeCloneTest START");
+
+ try
+ {
+ var node = new MarkupNode("1", null, 1, 1);
+ var ret = node.Clone();
+ Assert.IsNotNull(ret, "Should not be equal");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"MarkupNodeCloneTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ElementNode Clone")]
+ [Property("SPEC", "Tizen.NUI.Xaml.ElementNode.Clone M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ElementNodeCloneTest()
+ {
+ tlog.Debug(tag, $"ElementNodeCloneTest START");
+
+ try
+ {
+ var node = new ElementNode(null, "1", null, 1, 1);
+ node.Properties.Add(new XmlName("1", "View"), new ElementNode(null, "1", null, 1, 1));
+ node.SkipProperties.Add(new XmlName("1", "View"));
+ node.CollectionItems.Add(new ElementNode(null, "1", null, 1, 1));
+ var ret = node.Clone();
+ Assert.IsNotNull(ret, "Should not be equal");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"ElementNodeCloneTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ListNode Clone")]
+ [Property("SPEC", "Tizen.NUI.Xaml.ListNode.Clone M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ListNodeCloneTest()
+ {
+ tlog.Debug(tag, $"ListNodeCloneTest START");
+
+ try
+ {
+ List<INode> nodes = new List<INode>() { new ElementNode(null, "1", null, 1, 1) };
+ var node = new ListNode(nodes, null, 1, 1);
+ var ret = node.Clone();
+ Assert.IsNotNull(ret, "Should not be equal");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"ListNodeCloneTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ListNode Clone")]
+ [Property("SPEC", "Tizen.NUI.Xaml.INodeExtensions.Clone M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void INodeExtensionsSkipPrefixTest()
+ {
+ tlog.Debug(tag, $"INodeExtensionsSkipPrefixTest START");
+
+ try
+ {
+ var node = new ElementNode(null, "1", null, 1, 1);
+ node.IgnorablePrefixes = new List<string>() { "1" };
+ var ret = node.SkipPrefix("1");
+
+ Assert.True(ret, "Should be true");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception : Failed!");
+ }
+
+ tlog.Debug(tag, $"INodeExtensionsSkipPrefixTest END");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/AttachedCollection")]
+ public class InternalAttachedCollectionTest
+ {
+ private const string tag = "NUITEST";
+
+ internal class MyView : View, IAttachedObject
+ {
+ public void AttachTo(BindableObject bindable)
+ {
+ }
+
+ public void DetachFrom(BindableObject bindable)
+ {
+ }
+ }
+
+ internal class MyAttachedCollection<T> : AttachedCollection<T> where T : BindableObject, IAttachedObject
+ {
+ public void Clear()
+ {
+ ClearItems();
+ }
+
+ public void Insert(int index, T item)
+ {
+ InsertItem(index, item);
+ }
+
+ public void OnDetach(BindableObject bindable)
+ {
+ OnDetachingFrom(bindable);
+ }
+
+ public void Remove(int index)
+ {
+ RemoveItem(index);
+ }
+
+ public void Set(int index, T item)
+ {
+ SetItem(index, item);
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AttachedCollection constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.AttachedCollection C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void AttachedCollectionConstructor()
+ {
+ tlog.Debug(tag, $"AttachedCollectionConstructor START");
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new AttachedCollection<MyView>(collection);
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ IList<MyView> list = new List<MyView>() { new MyView() };
+ var testingTarget2 = new AttachedCollection<MyView>(list);
+ Assert.IsNotNull(testingTarget2, "Can't create success object AttachedCollection.");
+
+ tlog.Debug(tag, $"AttachedCollectionConstructor END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("AttachedCollection AttachTo")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.AttachTo M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void AttachTo()
+ {
+ tlog.Debug(tag, $"AttachTo START");
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new AttachedCollection<MyView>(collection);
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ Assert.Throws<ArgumentNullException>(() => testingTarget.AttachTo(null));
+
+
+ tlog.Debug(tag, $"AttachTo END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AttachedCollection DetachFrom")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.DetachFrom M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void DetachFrom()
+ {
+ tlog.Debug(tag, $"DetachFrom START");
+ try
+ {
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new AttachedCollection<MyView>(collection);
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ var v = new MyView();
+ testingTarget.AttachTo(v);
+ testingTarget.DetachFrom(v);
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"DetachFrom END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AttachedCollection ClearItems")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.ClearItems M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void ClearItems()
+ {
+ tlog.Debug(tag, $"ClearItems START");
+ try
+ {
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new MyAttachedCollection<MyView>();
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ var v = new MyView();
+ testingTarget.AttachTo(v);
+ testingTarget.Clear();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"ClearItems END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AttachedCollection InsertItem")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.InsertItem M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void InsertItem()
+ {
+ tlog.Debug(tag, $"InsertItem START");
+ try
+ {
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new MyAttachedCollection<MyView>();
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ var v = new MyView();
+ testingTarget.AttachTo(v);
+ testingTarget.Insert(0, new MyView());
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"InsertItem END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AttachedCollection OnDetachingFrom")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.OnDetachingFrom M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void OnDetachingFrom()
+ {
+ tlog.Debug(tag, $"OnDetachingFrom START");
+ try
+ {
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new MyAttachedCollection<MyView>();
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ var v = new MyView();
+ testingTarget.AttachTo(v);
+ testingTarget.OnDetach(v);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"OnDetachingFrom END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AttachedCollection RemoveItem")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.RemoveItem M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void RemoveItem()
+ {
+ tlog.Debug(tag, $"RemoveItem START");
+ try
+ {
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new MyAttachedCollection<MyView>();
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ var v = new MyView();
+ testingTarget.AttachTo(v);
+ testingTarget.Insert(0, new MyView());
+ testingTarget.Remove(0);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"RemoveItem END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("AttachedCollection SetItem")]
+ [Property("SPEC", "Tizen.NUI.Binding.AttachedCollection.SetItem M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SetItem()
+ {
+ tlog.Debug(tag, $"SetItem START");
+ try
+ {
+ IEnumerable<MyView> collection = new List<MyView>() { new MyView() };
+ var testingTarget = new MyAttachedCollection<MyView>();
+ Assert.IsNotNull(testingTarget, "Can't create success object AttachedCollection.");
+
+ var v = new MyView();
+ testingTarget.AttachTo(v);
+ testingTarget.Insert(0, new MyView());
+ testingTarget.Set(0, new MyView());
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"SetItem END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/MultiCondition")]
+ public class InternalMultiConditionTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MultiCondition constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.MultiCondition.MultiCondition C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void MultiConditionConstructor()
+ {
+ tlog.Debug(tag, $"MultiConditionConstructor START");
+
+ var testingTarget = new MultiCondition();
+ Assert.IsNotNull(testingTarget, "Can't create success object MultiCondition.");
+ Assert.IsInstanceOf<MultiCondition>(testingTarget, "Should return MultiCondition instance.");
+
+ Assert.False(testingTarget.GetState(new View()), "Should be false");
+
+ tlog.Debug(tag, $"MultiConditionConstructor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MultiCondition OnSealed")]
+ [Property("SPEC", "Tizen.NUI.Binding.MultiCondition.OnSealed M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void OnSealed()
+ {
+ tlog.Debug(tag, $"OnSealed START");
+ try
+ {
+ var testingTarget = new MultiCondition();
+ Assert.IsNotNull(testingTarget, "Can't create success object MultiCondition.");
+
+ testingTarget.OnSealed();
+ var v = new View();
+ testingTarget.SetUp(v);
+ testingTarget.TearDown(v);
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"OnSealed END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/NumericExtensions")]
+ public class InternalNumericExtensionsTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("NumericExtensions constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.Internals.NumericExtensions.Clamp M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void Clamp()
+ {
+ tlog.Debug(tag, $"Clamp START");
+ double d = 1.0;
+ var testingTarget = NumericExtensions.Clamp(d, 0, 10);
+ Assert.AreEqual(d, testingTarget, "Should be equal.");
+
+ float f = 1.0f;
+ var testingTarget2 = NumericExtensions.Clamp(f, 0, 10);
+ Assert.AreEqual(f, testingTarget2, "Should be equal.");
+
+ int i = 1;
+ var testingTarget3 = NumericExtensions.Clamp(i, 0, 10);
+ Assert.AreEqual(i, testingTarget3, "Should be equal.");
+
+ tlog.Debug(tag, $"Clamp END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/PreserveAttribute")]
+ public class InternalPreserveAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PreserveAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.Internals.PreserveAttribute.PreserveAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void PreserveAttributeConstructor()
+ {
+ tlog.Debug(tag, $"PreserveAttributeConstructor START");
+ var testingTarget = new PreserveAttribute();
+ Assert.IsNotNull(testingTarget, "Can't create success object PreserveAttribute.");
+ Assert.IsInstanceOf<PreserveAttribute>(testingTarget, "Should return PreserveAttribute instance.");
+
+ var testingTarget2 = new PreserveAttribute(false, false);
+ Assert.IsNotNull(testingTarget2, "Can't create success object PreserveAttribute.");
+ Assert.IsInstanceOf<PreserveAttribute>(testingTarget2, "Should return PreserveAttribute instance.");
+
+ tlog.Debug(tag, $"PreserveAttributeConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/ResourceLoader")]
+ public class InternalResourceLoaderTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ResourceLoader constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.Internals.ResourceLoader.ResourceProvider A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ public void ResourceProvider()
+ {
+ tlog.Debug(tag, $"ResourceProvider START");
+ try
+ {
+ var testingTarget = ResourceLoader.ResourceProvider;
+ Assert.IsNotNull(testingTarget, "Should not be null.");
+ ResourceLoader.ResourceProvider = testingTarget;
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"ResourceProvider END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/CollectionSynchronizationContext")]
+ public class InternalCollectionSynchronizationContextTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("CollectionSynchronizationContext constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.CollectionSynchronizationContext.CollectionSynchronizationContext C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void CollectionSynchronizationContextConstructor()
+ {
+ tlog.Debug(tag, $"CollectionSynchronizationContextConstructor START");
+
+ var testingTarget = new CollectionSynchronizationContext(new View(), null);
+ Assert.IsNotNull(testingTarget, "Can't create success object CollectionSynchronizationContext.");
+ Assert.IsInstanceOf<CollectionSynchronizationContext>(testingTarget, "Should return CollectionSynchronizationContext instance.");
+
+ Assert.IsNull(testingTarget.Callback, "Should be null");
+ Assert.IsNotNull(testingTarget.ContextReference, "Should not be null");
+
+ tlog.Debug(tag, $"CollectionSynchronizationContextConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/ControlTemplate")]
+ public class InternalControlTemplateTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ControlTemplate constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.ControlTemplate.ControlTemplate C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void ControlTemplateConstructor()
+ {
+ tlog.Debug(tag, $"ControlTemplateConstructor START");
+
+ var testingTarget = new ControlTemplate();
+ Assert.IsNotNull(testingTarget, "Can't create success object ControlTemplate.");
+ Assert.IsInstanceOf<ControlTemplate>(testingTarget, "Should return ControlTemplate instance.");
+
+ var testingTarget2 = new ControlTemplate(typeof(View));
+ Assert.IsNotNull(testingTarget2, "Should not be null");
+ Assert.IsInstanceOf<ControlTemplate>(testingTarget2, "Should return ControlTemplate instance.");
+
+ tlog.Debug(tag, $"ControlTemplateConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/DependencyAttribute")]
+ public class InternalDependencyAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("DependencyAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.DependencyAttribute.DependencyAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void DependencyAttributeConstructor()
+ {
+ tlog.Debug(tag, $"DependencyAttributeConstructor START");
+
+ var testingTarget = new DependencyAttribute(typeof(int));
+ Assert.IsNotNull(testingTarget, "Can't create success object DependencyAttribute.");
+ Assert.IsInstanceOf<DependencyAttribute>(testingTarget, "Should return DependencyAttribute instance.");
+
+ Assert.IsNotNull(testingTarget.Implementor, "Should not be null");
+
+ tlog.Debug(tag, $"DependencyAttributeConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/DependencyResolver")]
+ public class InternalDependencyResolverTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("DependencyResolver ResolveUsing")]
+ [Property("SPEC", "Tizen.NUI.Binding.DependencyResolver.ResolveUsing M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void ResolveUsing()
+ {
+ tlog.Debug(tag, $"ResolveUsing START");
+ try
+ {
+ DependencyResolver.ResolveUsing((t, b) => null);
+ DependencyResolver.ResolveUsing((t) => null);
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"ResolveUsing END");
+ }
+ }
+}
[Test]
[Category("P1")]
[Description("DependencyService Resolve")]
- [Property("SPEC", "DependencyService Resolve M")]
+ [Property("SPEC", "Tizen.NUI.Binding.DependencyService.Resolve M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
public void DependencyServiceResolve()
var mIEnumerable = DependencyService.Resolve<IEnumerable<float>>(DependencyFetchTarget.GlobalInstance);
tlog.Error(tag, "IEnumerable : " + mIEnumerable);
- tlog.Debug(tag, $"ContentPropertyAttributeConstructor END");
+ tlog.Debug(tag, $"DependencyServiceResolve END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("DependencyService Register")]
+ [Property("SPEC", "Tizen.NUI.Binding.DependencyService.Register M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void Register()
+ {
+ tlog.Debug(tag, $"Register START");
+
+ try
+ {
+ DependencyService.Register<string>();
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"Register END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("DependencyService Register")]
+ [Property("SPEC", "Tizen.NUI.Binding.DependencyService.Initialize M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void Initialize()
+ {
+ tlog.Debug(tag, $"Initialize START");
+
+ try
+ {
+ DependencyService.Initialize(new Assembly[] { typeof(View).Assembly });
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"Initialize END");
}
}
}
using global::System;
using NUnit.Framework;
-using NUnit.Framework.TUnit;
-using Tizen.NUI.Components;
-using Tizen.NUI.BaseComponents;
-using System.Reflection;
-using System.Collections.Generic;
using Tizen.NUI.Binding;
namespace Tizen.NUI.Devel.Tests
tlog.Debug(tag, $"DeviceSetIdiom END");
}
+
+ [Test]
+ public void TestBeginInvokeOnMainThread()
+ {
+ bool calledFromMainThread = false;
+
+ bool invoked = false;
+ Device.BeginInvokeOnMainThread(() => invoked = true);
+
+ Assert.True(invoked, "Action not invoked.");
+ Assert.False(calledFromMainThread, "Action not invoked from main thread.");
+ }
+
+ [Test]
+ public void InvokeOnMainThreadThrowsWhenNull()
+ {
+ try{
+ Device.BeginInvokeOnMainThread(() => { });
+ }
+ catch(Exception e){
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ }
}
}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/DeviceInfo")]
+ public class InternalDeviceInfoTest
+ {
+ private const string tag = "NUITEST";
+
+ internal class MyDeviceInfo : DeviceInfo
+ {
+ public override Size PixelScreenSize => new Size(100,100);
+
+ public override Size ScaledScreenSize => new Size(100, 100);
+
+ public override double ScalingFactor => 1.0f;
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("DeviceInfo constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.DeviceInfo.DeviceInfo C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void DeviceInfoConstructor()
+ {
+ tlog.Debug(tag, $"DeviceInfoConstructor START");
+
+ var testingTarget = new MyDeviceInfo();
+ Assert.IsNotNull(testingTarget, "Can't create success object DeviceInfo.");
+ Assert.IsInstanceOf<MyDeviceInfo>(testingTarget, "Should return DeviceInfo instance.");
+
+ Assert.AreEqual(1.0, testingTarget.DisplayRound(1.0), "Should be equal");
+ var ret = testingTarget.CurrentOrientation;
+ testingTarget.CurrentOrientation = ret;
+ Assert.AreEqual(ret, testingTarget.CurrentOrientation, "Should be equal");
+ testingTarget.CurrentOrientation = DeviceOrientation.Other;
+ Assert.AreEqual(DeviceOrientation.Other, testingTarget.CurrentOrientation, "Should be equal");
+
+ testingTarget.Dispose();
+ tlog.Debug(tag, $"DeviceInfoConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/EnumerableExtensions")]
+ public class InternalEnumerableExtensionsTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("EnumerableExtensions GetGesturesFor")]
+ [Property("SPEC", "Tizen.NUI.Binding.EnumerableExtensions.GetGesturesFor M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void GetGesturesFor()
+ {
+ tlog.Debug(tag, $"GetGesturesFor START");
+ try
+ {
+
+ var list = new List<GestureRecognizer>() { new GestureRecognizer() };
+ var ret = EnumerableExtensions.GetGesturesFor<GestureRecognizer>(list, (g) => false);
+ Assert.IsNotNull(ret, "should not be null");
+ var ret2 = EnumerableExtensions.GetGesturesFor<GestureRecognizer>(null, (g) => false);
+ Assert.IsNotNull(ret2, "should not be null");
+ var ret3 = EnumerableExtensions.GetGesturesFor<GestureRecognizer>(null, (g) => false);
+ Assert.IsNotNull(ret3, "should not be null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"GetGesturesFor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("EnumerableExtensions Append")]
+ [Property("SPEC", "Tizen.NUI.Binding.EnumerableExtensions.Append M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void Append()
+ {
+ tlog.Debug(tag, $"Append START");
+ try
+ {
+
+ var list = new List<GestureRecognizer>() { new GestureRecognizer() };
+ var ret = EnumerableExtensions.Append<GestureRecognizer>(list, new GestureRecognizer());
+ Assert.IsNotNull(ret, "should not be null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"Append END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("EnumerableExtensions ForEach")]
+ [Property("SPEC", "Tizen.NUI.Binding.EnumerableExtensions.ForEach M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void ForEach()
+ {
+ tlog.Debug(tag, $"ForEach START");
+ try
+ {
+ var list = new List<GestureRecognizer>() { new GestureRecognizer() };
+ Action<GestureRecognizer> action = (g) => { };
+ EnumerableExtensions.ForEach<GestureRecognizer>(list, action);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"ForEach END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("EnumerableExtensions IndexOf")]
+ [Property("SPEC", "Tizen.NUI.Binding.EnumerableExtensions.IndexOf M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void IndexOf()
+ {
+ tlog.Debug(tag, $"IndexOf START");
+
+ Assert.Throws<ArgumentNullException>(() => EnumerableExtensions.IndexOf<GestureRecognizer>(null, new GestureRecognizer()));
+
+ tlog.Debug(tag, $"IndexOf END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("EnumerableExtensions IndexOf")]
+ [Property("SPEC", "Tizen.NUI.Binding.EnumerableExtensions.IndexOf M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void IndexOf2()
+ {
+ tlog.Debug(tag, $"IndexOf2 START");
+ try
+ {
+ var list = new List<GestureRecognizer>() { new GestureRecognizer() };
+ EnumerableExtensions.IndexOf<GestureRecognizer>(list, new GestureRecognizer());
+
+ EnumerableExtensions.IndexOf<GestureRecognizer>(list, (g) => true);
+ EnumerableExtensions.IndexOf<GestureRecognizer>(list, (g) => false);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"IndexOf2 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("EnumerableExtensions Prepend")]
+ [Property("SPEC", "Tizen.NUI.Binding.EnumerableExtensions.Prepend M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void Prepend()
+ {
+ tlog.Debug(tag, $"Prepend START");
+ try
+ {
+ var list = new List<GestureRecognizer>() { new GestureRecognizer() };
+ EnumerableExtensions.Prepend<GestureRecognizer>(list, new GestureRecognizer());
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"Prepend END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/EventArg")]
+ public class InternalEventArgTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("EventArg constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.EventArg.EventArg C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void EventArgConstructor()
+ {
+ tlog.Debug(tag, $"EventArgConstructor START");
+
+ var testingTarget = new EventArg<int>(10);
+ Assert.IsNotNull(testingTarget, "Can't create success object EventArg.");
+ Assert.IsInstanceOf<EventArg<int>>(testingTarget, "Should return EventArg instance.");
+
+ Assert.AreEqual(10, testingTarget.Data, "Should be equal");
+
+ tlog.Debug(tag, $"EventArgConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/ExportEffectAttribute")]
+ public class InternalExportEffectAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ExportEffectAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.ExportEffectAttribute.ExportEffectAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void ExportEffectAttributeConstructor()
+ {
+ tlog.Debug(tag, $"ExportEffectAttributeConstructor START");
+
+ var intt = typeof(int);
+ var testingTarget = new ExportEffectAttribute(intt, "Unique");
+ Assert.IsNotNull(testingTarget, "Can't create success object ExportEffectAttribute.");
+ Assert.IsInstanceOf<ExportEffectAttribute>(testingTarget, "Should return ExportEffectAttribute instance.");
+
+ Assert.AreEqual("Unique", testingTarget.Id, "Should be equal");
+ Assert.AreEqual(intt, testingTarget.Type, "Should be equal");
+
+ tlog.Debug(tag, $"ExportEffectAttributeConstructor END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("ExportEffectAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.ExportEffectAttribute.ExportEffectAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void ExportEffectAttributeConstructor2()
+ {
+ tlog.Debug(tag, $"ExportEffectAttributeConstructor2 START");
+ var intt = typeof(int);
+ Assert.Throws<ArgumentException>(() => new ExportEffectAttribute(intt, "Uni.que"));
+
+ tlog.Debug(tag, $"ExportEffectAttributeConstructor2 END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/ExtentsTypeConverter")]
+ public class InternalExtentsTypeConverterTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ExtentsTypeConverter constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.ExtentsTypeConverter.ExtentsTypeConverter C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void ExtentsTypeConverterConstructor()
+ {
+ tlog.Debug(tag, $"ExtentsTypeConverterConstructor START");
+
+ var testingTarget = new ExtentsTypeConverter();
+ Assert.IsNotNull(testingTarget, "Can't create success object ExtentsTypeConverter.");
+
+
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("1,2,3,4"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("1"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertToString(new Extents(1,2,3,4)), "Should not be null");
+
+ Assert.Throws<InvalidOperationException>(() => testingTarget.ConvertFromInvariantString(null));
+
+ tlog.Debug(tag, $"ExtentsTypeConverterConstructor END");
+ }
+
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/FlowDirectionConverter")]
+ public class InternalFlowDirectionConverterTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("FlowDirectionConverter constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.FlowDirectionConverter.FlowDirectionConverter C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void FlowDirectionConverterConstructor()
+ {
+ tlog.Debug(tag, $"FlowDirectionConverterConstructor START");
+
+ var testingTarget = new FlowDirectionConverter();
+ Assert.IsNotNull(testingTarget, "Can't create success object FlowDirectionConverter.");
+
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("MatchParent"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("ltr"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("rtl"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("inherit"), "Should not be null");
+
+ Assert.Throws<InvalidOperationException>(() => testingTarget.ConvertFromInvariantString("null"));
+ tlog.Debug(tag, $"FlowDirectionConverterConstructor END");
+ }
+
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/GestureRecognizer")]
+ public class InternalGestureRecognizerTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("GestureRecognizer constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.GestureRecognizer.GestureRecognizer C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void GestureRecognizerConstructor()
+ {
+ tlog.Debug(tag, $"GestureRecognizerConstructor START");
+
+ var testingTarget = new GestureRecognizer();
+ Assert.IsNotNull(testingTarget, "Can't create success object GestureRecognizer.");
+
+ tlog.Debug(tag, $"GestureRecognizerConstructor END");
+ }
+
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/HandlerAttribute")]
+ public class InternalHandlerAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ internal class MyHandlerAttribute : HandlerAttribute
+ {
+ public MyHandlerAttribute(Type handler, Type target) : base(handler, target)
+ {}
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("HandlerAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.HandlerAttribute.HandlerAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void HandlerAttributeConstructor()
+ {
+ tlog.Debug(tag, $"HandlerAttributeConstructor START");
+ var ft = typeof(float);
+ var it = typeof(int);
+ var testingTarget = new MyHandlerAttribute(it, ft);
+ Assert.IsNotNull(testingTarget, "Can't create success object HandlerAttribute.");
+ Assert.IsInstanceOf<MyHandlerAttribute>(testingTarget, "Should return HandlerAttribute instance.");
+
+ Assert.AreEqual(it, testingTarget.HandlerType, "Should be equal");
+ Assert.AreEqual(ft, testingTarget.TargetType, "Should be equal");
+ Assert.AreEqual(true, testingTarget.ShouldRegister(), "Should be equal");
+
+ tlog.Debug(tag, $"HandlerAttributeConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/InvalidationEventArgs")]
+ public class InternalInvalidationEventArgsTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("InvalidationEventArgs constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.InvalidationEventArgs.InvalidationEventArgs C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void InvalidationEventArgsConstructor()
+ {
+ tlog.Debug(tag, $"InvalidationEventArgsConstructor START");
+
+ var testingTarget = new InvalidationEventArgs(InvalidationTrigger.Undefined);
+ Assert.IsNotNull(testingTarget, "Can't create success object InvalidationEventArgs.");
+ Assert.IsInstanceOf<InvalidationEventArgs>(testingTarget, "Should return InvalidationEventArgs instance.");
+
+ Assert.AreEqual(InvalidationTrigger.Undefined, testingTarget.Trigger, "Should be equal");
+
+ tlog.Debug(tag, $"InvalidationEventArgsConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/ListStringTypeConverter")]
+ public class InternalListStringTypeConverterTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ListStringTypeConverter constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.ListStringTypeConverter.ListStringTypeConverter C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void ListStringTypeConverterConstructor()
+ {
+ tlog.Debug(tag, $"ListStringTypeConverterConstructor START");
+
+ var testingTarget = new ListStringTypeConverter();
+ Assert.IsNotNull(testingTarget, "Can't create success object ListStringTypeConverter.");
+
+ Assert.IsNull(testingTarget.ConvertFromInvariantString(null), "Should be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("A,B,C"), "Should not be null");
+
+ tlog.Debug(tag, $"ListStringTypeConverterConstructor END");
+ }
+
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/MergedStyle")]
+ public class InternalMergedStyleTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("MergedStyle constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.MergedStyle.MergedStyle C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void MergedStyleConstructor()
+ {
+ tlog.Debug(tag, $"MergedStyleConstructor START");
+
+ var testingTarget = new MergedStyle(typeof(View), new View());
+ Assert.IsNotNull(testingTarget, "Can't create success object MergedStyle.");
+
+ var sc = testingTarget.StyleClass;
+ testingTarget.StyleClass = sc;
+ Assert.AreEqual(sc, testingTarget.StyleClass, "Should be equal");
+
+ testingTarget.StyleClass = new List<string>() { "style" };
+ tlog.Debug(tag, $"MergedStyleConstructor END");
+ }
+
+ }
+}
public class InternalMessagingCenterTest
{
private const string tag = "NUITEST";
+ TestSubcriber _subscriber;
[SetUp]
public void Init()
[Test]
[Category("P1")]
[Description("MessagingCenter Instance")]
- [Property("SPEC", "MessagingCenter Instance A")]
+ [Property("SPEC", "Tizen.NUI.Binding.MessagingCenter.Instance A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRO")]
public void MessagingCenterInstance()
[Test]
[Category("P1")]
[Description("MessagingCenter ClearSubscribers")]
- [Property("SPEC", "MessagingCenter ClearSubscribers M")]
+ [Property("SPEC", "Tizen.NUI.Binding.MessagingCenter.ClearSubscribers M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
public void MessagingCenterClearSubscribers()
tlog.Debug(tag, $"ClearSubscribers END");
}
+
+ [Test]
+ public void SingleSubscriber()
+ {
+ string sentMessage = null;
+ MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(this, "SimpleTest", (sender, args) => sentMessage = args);
+
+ MessagingCenter.Send(this, "SimpleTest", "My Message");
+
+ Assert.That(sentMessage, Is.EqualTo("My Message"));
+
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(this, "SimpleTest");
+ }
+
+ [Test]
+ public void Filter()
+ {
+ string sentMessage = null;
+ MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(this, "SimpleTest", (sender, args) => sentMessage = args, this);
+
+ MessagingCenter.Send(new InternalMessagingCenterTest(), "SimpleTest", "My Message");
+
+ Assert.That(sentMessage, Is.Null);
+
+ MessagingCenter.Send(this, "SimpleTest", "My Message");
+
+ Assert.That(sentMessage, Is.EqualTo("My Message"));
+
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(this, "SimpleTest");
+ }
+
+ [Test]
+ public void MultiSubscriber()
+ {
+ var sub1 = new object();
+ var sub2 = new object();
+ string sentMessage1 = null;
+ string sentMessage2 = null;
+ MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(sub1, "SimpleTest", (sender, args) => sentMessage1 = args);
+ MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(sub2, "SimpleTest", (sender, args) => sentMessage2 = args);
+
+ MessagingCenter.Send(this, "SimpleTest", "My Message");
+
+ Assert.That(sentMessage1, Is.EqualTo("My Message"));
+ Assert.That(sentMessage2, Is.EqualTo("My Message"));
+
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(sub1, "SimpleTest");
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(sub2, "SimpleTest");
+ }
+
+ [Test]
+ public void Unsubscribe()
+ {
+ string sentMessage = null;
+ MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(this, "SimpleTest", (sender, args) => sentMessage = args);
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(this, "SimpleTest");
+
+ MessagingCenter.Send(this, "SimpleTest", "My Message");
+
+ Assert.That(sentMessage, Is.EqualTo(null));
+ }
+
+ [Test]
+ public void SendWithoutSubscribers()
+ {
+ Assert.DoesNotThrow(() => MessagingCenter.Send(this, "SimpleTest", "My Message"));
+ }
+
+ [Test]
+ public void NoArgSingleSubscriber()
+ {
+ bool sentMessage = false;
+ MessagingCenter.Subscribe<InternalMessagingCenterTest>(this, "SimpleTest", sender => sentMessage = true);
+
+ MessagingCenter.Send(this, "SimpleTest");
+
+ Assert.That(sentMessage, Is.True);
+
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(this, "SimpleTest");
+ }
+
+ [Test]
+ public void NoArgFilter()
+ {
+ bool sentMessage = false;
+ MessagingCenter.Subscribe(this, "SimpleTest", (sender) => sentMessage = true, this);
+
+ MessagingCenter.Send(new InternalMessagingCenterTest(), "SimpleTest");
+
+ Assert.That(sentMessage, Is.False);
+
+ MessagingCenter.Send(this, "SimpleTest");
+
+ Assert.That(sentMessage, Is.True);
+
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(this, "SimpleTest");
+ }
+
+ [Test]
+ public void NoArgMultiSubscriber()
+ {
+ var sub1 = new object();
+ var sub2 = new object();
+ bool sentMessage1 = false;
+ bool sentMessage2 = false;
+ MessagingCenter.Subscribe<InternalMessagingCenterTest>(sub1, "SimpleTest", (sender) => sentMessage1 = true);
+ MessagingCenter.Subscribe<InternalMessagingCenterTest>(sub2, "SimpleTest", (sender) => sentMessage2 = true);
+
+ MessagingCenter.Send(this, "SimpleTest");
+
+ Assert.That(sentMessage1, Is.True);
+ Assert.That(sentMessage2, Is.True);
+
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(sub1, "SimpleTest");
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(sub2, "SimpleTest");
+ }
+
+ [Test]
+ public void NoArgUnsubscribe()
+ {
+ bool sentMessage = false;
+ MessagingCenter.Subscribe<InternalMessagingCenterTest>(this, "SimpleTest", (sender) => sentMessage = true);
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(this, "SimpleTest");
+
+ MessagingCenter.Send(this, "SimpleTest", "My Message");
+
+ Assert.That(sentMessage, Is.False);
+ }
+
+ [Test]
+ public void NoArgSendWithoutSubscribers()
+ {
+ Assert.DoesNotThrow(() => MessagingCenter.Send(this, "SimpleTest"));
+ }
+
+ [Test]
+ public void ThrowOnNullArgs()
+ {
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(null, "Foo", (sender, args) => { }));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(this, null, (sender, args) => { }));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(this, "Foo", null));
+
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Subscribe<InternalMessagingCenterTest>(null, "Foo", (sender) => { }));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Subscribe<InternalMessagingCenterTest>(this, null, (sender) => { }));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Subscribe<InternalMessagingCenterTest>(this, "Foo", null));
+
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Send<InternalMessagingCenterTest, string>(null, "Foo", "Bar"));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Send<InternalMessagingCenterTest, string>(this, null, "Bar"));
+
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Send<InternalMessagingCenterTest>(null, "Foo"));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Send<InternalMessagingCenterTest>(this, null));
+
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(null, "Foo"));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(this, null));
+
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(null, "Foo"));
+ Assert.Throws<ArgumentNullException>(() => MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(this, null));
+ }
+
+ [Test]
+ public void UnsubscribeInCallback()
+ {
+ int messageCount = 0;
+
+ var subscriber1 = new object();
+ var subscriber2 = new object();
+
+ MessagingCenter.Subscribe<InternalMessagingCenterTest>(subscriber1, "SimpleTest", (sender) => {
+ messageCount++;
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(subscriber2, "SimpleTest");
+ });
+
+ MessagingCenter.Subscribe<InternalMessagingCenterTest>(subscriber2, "SimpleTest", (sender) => {
+ messageCount++;
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest>(subscriber1, "SimpleTest");
+ });
+
+ MessagingCenter.Send(this, "SimpleTest");
+
+ Assert.AreEqual(1, messageCount);
+ }
+
+ [Test]
+ public void SubscriberShouldBeCollected()
+ {
+ new Action(() =>
+ {
+ var subscriber = new TestSubcriber();
+ MessagingCenter.Subscribe<TestPublisher>(subscriber, "test", p => Assert.Fail());
+ })();
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ var pub = new TestPublisher();
+ pub.Test(); // Assert.Fail() shouldn't be called, because the TestSubcriber object should have ben GCed
+ }
+
+ [Test]
+ public void ShouldBeCollectedIfCallbackTargetIsSubscriber()
+ {
+ WeakReference wr = null;
+
+ new Action(() =>
+ {
+ var subscriber = new TestSubcriber();
+
+ wr = new WeakReference(subscriber);
+
+ subscriber.SubscribeToTestMessages();
+ })();
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ var pub = new TestPublisher();
+ pub.Test();
+
+ Assert.IsFalse(wr.IsAlive); // The Action target and subscriber were the same object, so both could be collected
+ }
+
+ [Test]
+ public void NotCollectedIfSubscriberIsNotTheCallbackTarget()
+ {
+ WeakReference wr = null;
+
+ new Action(() =>
+ {
+ var subscriber = new TestSubcriber();
+
+ wr = new WeakReference(subscriber);
+
+ // This creates a closure, so the callback target is not 'subscriber', but an instancce of a compiler generated class
+ // So MC has to keep a strong reference to it, and 'subscriber' won't be collectable
+ MessagingCenter.Subscribe<TestPublisher>(subscriber, "test", p => subscriber.SetSuccess());
+ })();
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ Assert.IsTrue(wr.IsAlive); // The closure in Subscribe should be keeping the subscriber alive
+ Assert.IsNotNull(wr.Target as TestSubcriber);
+
+ Assert.IsFalse(((TestSubcriber)wr.Target).Successful);
+
+ var pub = new TestPublisher();
+ pub.Test();
+
+ Assert.IsTrue(((TestSubcriber)wr.Target).Successful); // Since it's still alive, the subscriber should still have received the message and updated the property
+ }
+
+ [Test]
+ public void SubscriberCollectableAfterUnsubscribeEvenIfHeldByClosure()
+ {
+ WeakReference wr = null;
+
+ new Action(() =>
+ {
+ var subscriber = new TestSubcriber();
+
+ wr = new WeakReference(subscriber);
+
+ MessagingCenter.Subscribe<TestPublisher>(subscriber, "test", p => subscriber.SetSuccess());
+ })();
+
+ Assert.IsNotNull(wr.Target as TestSubcriber);
+
+ MessagingCenter.Unsubscribe<TestPublisher>(wr.Target, "test");
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ Assert.True(wr.IsAlive); // The Action target and subscriber were the same object, so both could be collected
+ }
+
+ [Test]
+ public void StaticCallback()
+ {
+ int i = 4;
+
+ _subscriber = new TestSubcriber(); // Using a class member so it doesn't get optimized away in Release build
+
+ MessagingCenter.Subscribe<TestPublisher>(_subscriber, "test", p => MessagingCenterTestsCallbackSource.Increment(ref i));
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ var pub = new TestPublisher();
+ pub.Test();
+
+ Assert.IsTrue(i == 5, "The static method should have incremented 'i'");
+ }
+
+ [Test]
+ public void NothingShouldBeCollected()
+ {
+ var success = false;
+
+ _subscriber = new TestSubcriber(); // Using a class member so it doesn't get optimized away in Release build
+
+ var source = new MessagingCenterTestsCallbackSource();
+ MessagingCenter.Subscribe<TestPublisher>(_subscriber, "test", p => source.SuccessCallback(ref success));
+
+ GC.Collect();
+ GC.WaitForPendingFinalizers();
+
+ var pub = new TestPublisher();
+ pub.Test();
+
+ Assert.True(success); // TestCallbackSource.SuccessCallback() should be invoked to make success == true
+ }
+
+ [Test]
+ public void MultipleSubscribersOfTheSameClass()
+ {
+ var sub1 = new object();
+ var sub2 = new object();
+
+ string args2 = null;
+
+ const string message = "message";
+
+ MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(sub1, message, (sender, args) => { });
+ MessagingCenter.Subscribe<InternalMessagingCenterTest, string>(sub2, message, (sender, args) => args2 = args);
+ MessagingCenter.Unsubscribe<InternalMessagingCenterTest, string>(sub1, message);
+
+ MessagingCenter.Send(this, message, "Testing");
+ Assert.That(args2, Is.EqualTo("Testing"), "unsubscribing sub1 should not unsubscribe sub2");
+ }
+
+ class TestSubcriber
+ {
+ public void SetSuccess()
+ {
+ Successful = true;
+ }
+
+ public bool Successful { get; private set; }
+
+ public void SubscribeToTestMessages()
+ {
+ MessagingCenter.Subscribe<TestPublisher>(this, "test", p => SetSuccess());
+ }
+ }
+
+ class TestPublisher
+ {
+ public void Test()
+ {
+ MessagingCenter.Send(this, "test");
+ }
+ }
+
+ public class MessagingCenterTestsCallbackSource
+ {
+ public void SuccessCallback(ref bool success)
+ {
+ success = true;
+ }
+
+ public static void Increment(ref int i)
+ {
+ i = i + 1;
+ }
+ }
+
+ [Test(Description = "This is a demonstration of what a test with a fake/mock/substitute IMessagingCenter might look like")]
+ public void TestMessagingCenterSubstitute()
+ {
+ var mc = new FakeMessagingCenter();
+
+ // In the real world, you'd construct this with `new ComponentWithMessagingDependency(MessagingCenter.Instance);`
+ var component = new ComponentWithMessagingDependency(mc);
+ component.DoAThing();
+
+ Assert.IsTrue(mc.WasSubscribeCalled, "ComponentWithMessagingDependency should have subscribed in its constructor");
+ Assert.IsTrue(mc.WasSendCalled, "The DoAThing method should send a message");
+ }
+
+ class ComponentWithMessagingDependency
+ {
+ readonly IMessagingCenter _messagingCenter;
+
+ public ComponentWithMessagingDependency(IMessagingCenter messagingCenter)
+ {
+ _messagingCenter = messagingCenter;
+ _messagingCenter.Subscribe<ComponentWithMessagingDependency>(this, "test", dependency => Console.WriteLine("test"));
+ }
+
+ public void DoAThing()
+ {
+ _messagingCenter.Send(this, "test");
+ }
+ }
+
+ internal class FakeMessagingCenter : IMessagingCenter
+ {
+ public bool WasSubscribeCalled { get; private set; }
+ public bool WasSendCalled { get; private set; }
+
+ public void Send<TSender, TArgs>(TSender sender, string message, TArgs args) where TSender : class
+ {
+ WasSendCalled = true;
+ }
+
+ public void Send<TSender>(TSender sender, string message) where TSender : class
+ {
+ WasSendCalled = true;
+ }
+
+ public void Subscribe<TSender, TArgs>(object subscriber, string message, Action<TSender, TArgs> callback, TSender source = default(TSender)) where TSender : class
+ {
+ WasSubscribeCalled = true;
+ }
+
+ public void Subscribe<TSender>(object subscriber, string message, Action<TSender> callback, TSender source = default(TSender)) where TSender : class
+ {
+ WasSubscribeCalled = true;
+ }
+
+ public void Unsubscribe<TSender, TArgs>(object subscriber, string message) where TSender : class
+ {
+
+ }
+
+ public void Unsubscribe<TSender>(object subscriber, string message) where TSender : class
+ {
+
+ }
+ }
}
}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/OnIdiom")]
+ public class InternalOnIdiomTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("OnIdiom constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.OnIdiom.OnIdiom C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void OnIdiomConstructor()
+ {
+ tlog.Debug(tag, $"OnIdiomConstructor START");
+
+ var testingTarget = new OnIdiom<TargetIdiom>();
+ Assert.IsNotNull(testingTarget, "Can't create success object OnIdiom.");
+ Device.SetIdiom(TargetIdiom.Phone);
+ testingTarget.Phone = TargetIdiom.Phone;
+ Assert.AreEqual(TargetIdiom.Phone, testingTarget.Phone, "Should be equal");
+
+ Device.SetIdiom(TargetIdiom.Tablet);
+ testingTarget.Tablet = TargetIdiom.Tablet;
+ Assert.AreEqual(TargetIdiom.Tablet, testingTarget.Tablet, "Should be equal");
+
+ Device.SetIdiom(TargetIdiom.Desktop);
+ testingTarget.Desktop = TargetIdiom.Desktop;
+ Assert.AreEqual(TargetIdiom.Desktop, testingTarget.Desktop, "Should be equal");
+
+ Device.SetIdiom(TargetIdiom.TV);
+ testingTarget.TV = TargetIdiom.TV;
+ Assert.AreEqual(TargetIdiom.TV, testingTarget.TV, "Should be equal");
+
+ Device.SetIdiom(TargetIdiom.Watch);
+ testingTarget.Watch = TargetIdiom.Watch;
+ Assert.AreEqual(TargetIdiom.Watch, testingTarget.Watch, "Should be equal");
+
+ tlog.Debug(tag, $"OnIdiomConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/OnPlatform")]
+ public class InternalOnPlatformTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("OnPlatform constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.OnPlatform.OnPlatform C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void OnPlatformConstructor()
+ {
+ tlog.Debug(tag, $"OnPlatformConstructor START");
+
+ var testingTarget = new OnPlatform<string>();
+ Assert.IsNotNull(testingTarget, "Can't create success object OnPlatform.");
+ Assert.IsInstanceOf<OnPlatform<string>>(testingTarget, "Should return OnPlatform instance.");
+
+ testingTarget.Android = "Android";
+ Assert.AreEqual("Android", testingTarget.Android, "Should be equal");
+ testingTarget.iOS = "iOS";
+ Assert.AreEqual("iOS", testingTarget.iOS, "Should be equal");
+ testingTarget.WinPhone = "WinPhone";
+ Assert.AreEqual("WinPhone", testingTarget.WinPhone, "Should be equal");
+ testingTarget.Default = "Default";
+ Assert.AreEqual("Default", testingTarget.Default, "Should be equal");
+
+ Assert.IsNotNull(testingTarget.Platforms, "Should not be null.");
+
+
+ tlog.Debug(tag, $"OnPlatformConstructor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("OnPlatform constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.On.On C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void OnConstructor()
+ {
+ tlog.Debug(tag, $"OnPlatformConstructor START");
+
+ var testingTarget = new On();
+ Assert.IsNotNull(testingTarget, "Can't create success object On.");
+ Assert.IsInstanceOf<On>(testingTarget, "Should return On instance.");
+
+ testingTarget.Platform = new List<string>() { "Android" };
+ Assert.AreEqual("Android", testingTarget.Platform[0], "Should be equal");
+ testingTarget.Value = "iOS";
+ Assert.AreEqual("iOS", testingTarget.Value, "Should be equal");
+
+ tlog.Debug(tag, $"OnPlatformConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/ParameterAttribute")]
+ public class InternalParameterAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ParameterAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.ParameterAttribute.ParameterAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void ParameterAttributeConstructor()
+ {
+ tlog.Debug(tag, $"ParameterAttributeConstructor START");
+
+ var testingTarget = new ParameterAttribute("string");
+ Assert.IsNotNull(testingTarget, "Can't create success object ParameterAttribute.");
+ Assert.IsInstanceOf<ParameterAttribute>(testingTarget, "Should return ParameterAttribute instance.");
+
+ Assert.AreEqual("string", testingTarget.Name, "Should be equal");
+
+ tlog.Debug(tag, $"ParameterAttributeConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/PositionTypeConverter")]
+ public class InternalPositionTypeConverterTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("PositionTypeConverter constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.PositionTypeConverter.PositionTypeConverter C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void PositionTypeConverterConstructor()
+ {
+ tlog.Debug(tag, $"PositionTypeConverterConstructor START");
+
+ var testingTarget = new PositionTypeConverter();
+ Assert.IsNotNull(testingTarget, "Can't create success object PositionTypeConverter.");
+
+
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("Top"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("Bottom"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("Left"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("Right"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("Middle"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("TopLeft"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("TopCenter"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("TopRight"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("CenterLeft"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("Center"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("CenterRight"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("BottomLeft"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("BottomCenter"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("BottomRight"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("1,2,3"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("1,3"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertToString(new Position(1, 2, 3)), "Should not be null");
+ Assert.IsNull(testingTarget.ConvertToString(null), "Should be null");
+
+ Assert.Throws<InvalidOperationException>(() => testingTarget.ConvertFromInvariantString(null));
+
+ tlog.Debug(tag, $"PositionTypeConverterConstructor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Position2DTypeConverter constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.Position2DTypeConverter.Position2DTypeConverter C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void Position2DTypeConverterConstructor()
+ {
+ tlog.Debug(tag, $"Position2DTypeConverterConstructor START");
+
+ var testingTarget = new Position2DTypeConverter();
+ Assert.IsNotNull(testingTarget, "Can't create success object Position2DTypeConverter.");
+
+
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("1,3"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertToString(new Position2D(1, 2)), "Should not be null");
+ Assert.IsNull(testingTarget.ConvertToString(null), "Should be null");
+
+ Assert.Throws<InvalidOperationException>(() => testingTarget.ConvertFromInvariantString(null));
+
+ tlog.Debug(tag, $"Position2DTypeConverterConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/RectangleTypeConverter")]
+ public class InternalRectangleTypeConverterTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RectangleTypeConverter constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.RectangleTypeConverter.RectangleTypeConverter C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void RectangleTypeConverterConstructor()
+ {
+ tlog.Debug(tag, $"RectangleTypeConverterConstructor START");
+
+ var testingTarget = new RectangleTypeConverter();
+ Assert.IsNotNull(testingTarget, "Can't create success object RectangleTypeConverter.");
+
+
+ Assert.IsNotNull(testingTarget.ConvertFromInvariantString("1,2,3,4"), "Should not be null");
+ Assert.IsNotNull(testingTarget.ConvertToString(new Rectangle(1,2,3,4)), "Should not be null");
+ Assert.IsNull(testingTarget.ConvertToString(null), "Should be null");
+
+ Assert.Throws<InvalidOperationException>(() => testingTarget.ConvertFromInvariantString(null));
+
+ tlog.Debug(tag, $"RectangleTypeConverterConstructor END");
+ }
+
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/RenderWithAttribute")]
+ public class InternalRenderWithAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("RenderWithAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.RenderWithAttribute.RenderWithAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void RenderWithAttributeConstructor()
+ {
+ tlog.Debug(tag, $"RenderWithAttributeConstructor START");
+
+ var it = typeof(int);
+ var testingTarget = new RenderWithAttribute(it);
+ Assert.IsNotNull(testingTarget, "Can't create success object RenderWithAttribute.");
+ Assert.IsInstanceOf<RenderWithAttribute>(testingTarget, "Should return RenderWithAttribute instance.");
+
+ Assert.AreEqual(it, testingTarget.Type, "Should be equal");
+
+ tlog.Debug(tag, $"RenderWithAttributeConstructor END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/ResolutionGroupNameAttribute")]
+ public class InternalResolutionGroupNameAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ResolutionGroupNameAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.ResolutionGroupNameAttribute.ResolutionGroupNameAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void ResolutionGroupNameAttributeConstructor()
+ {
+ tlog.Debug(tag, $"ResolutionGroupNameAttributeConstructor START");
+
+ var testingTarget = new ResolutionGroupNameAttribute("test");
+ Assert.IsNotNull(testingTarget, "Can't create success object ResolutionGroupNameAttribute.");
+ Assert.IsInstanceOf<ResolutionGroupNameAttribute>(testingTarget, "Should return ResolutionGroupNameAttribute instance.");
+
+ Assert.AreEqual("test", testingTarget.ShortName, "Should be equal");
+
+ tlog.Debug(tag, $"ResolutionGroupNameAttributeConstructor END");
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/SynchronizedList")]
+ internal class InternalSynchronizedListTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SynchronizedList SynchronizedList")]
+ [Property("SPEC", "Tizen.NUI.Binding.SynchronizedList<T>.SynchronizedList<T> C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TriggerConstructor()
+ {
+ tlog.Debug(tag, $"TriggerConstructor START");
+
+ try
+ {
+ var sl = new SynchronizedList<int>();
+
+ Assert.IsNotNull(sl, "null SynchronizedList");
+ Assert.IsInstanceOf<SynchronizedList<int>>(sl, "Should return SynchronizedList instance.");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"TriggerConstructor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SynchronizedList Add")]
+ [Property("SPEC", "Tizen.NUI.Binding.SynchronizedList.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SynchronizedListAddTest()
+ {
+ tlog.Debug(tag, $"SynchronizedListAddTest START");
+ try
+ {
+ var sl = new SynchronizedList<int>();
+ Assert.IsNotNull(sl, "null SynchronizedList");
+ sl.Add(1);
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"SynchronizedListAddTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SynchronizedList Add")]
+ [Property("SPEC", "Tizen.NUI.Binding.SynchronizedList.Clear M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SynchronizedListClearTest()
+ {
+ tlog.Debug(tag, $"SynchronizedListAddTest START");
+ try
+ {
+ var sl = new SynchronizedList<int>();
+ Assert.IsNotNull(sl, "null SynchronizedList");
+ sl.Add(1);
+ sl.Clear();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"SynchronizedListAddTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SynchronizedList Contains")]
+ [Property("SPEC", "Tizen.NUI.Binding.SynchronizedList.Contains M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void SynchronizedListContainsTest()
+ {
+ tlog.Debug(tag, $"SynchronizedListContainsTest START");
+ try
+ {
+ var sl = new SynchronizedList<int>();
+ Assert.IsNotNull(sl, "null SynchronizedList");
+ sl.Add(1);
+ var ret = sl.Contains(1);
+ Assert.AreEqual(true, ret, "Should be equal");
+ Assert.AreEqual(1, sl.Count, "Should be equal");
+
+ int[] ia= new int[] { 1, 2, 3 };
+ sl.CopyTo(ia, 0);
+
+ var ret2 = sl.GetEnumerator();
+ Assert.IsNotNull(ret2, "null SynchronizedList");
+ var ret3 = sl.IndexOf(1);
+ sl.Insert(0, 2);
+ var ret4 = sl[1];
+ sl[1] = 7;
+ sl.Remove(1);
+
+ sl.Insert(0, 3);
+ sl.RemoveAt(0);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"SynchronizedListContainsTest END");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/TemplateBinding")]
+ public class InternalTemplateBindingTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.TemplateBinding C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TemplateBindingConstructor()
+ {
+ tlog.Debug(tag, $"TemplateBindingConstructor START");
+
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ Assert.IsInstanceOf<TemplateBinding>(testingTarget, "Should return TemplateBinding instance.");
+
+ tlog.Debug(tag, $"TemplateBindingConstructor END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("TemplateBinding constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.TemplateBinding C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TemplateBindingConstructor2()
+ {
+ tlog.Debug(tag, $"TemplateBindingConstructor2 START");
+
+ Assert.Throws<ArgumentNullException>(() => new TemplateBinding(null), "Can't create success object TemplateBinding.");
+ Assert.Throws<ArgumentException>(() => new TemplateBinding(""), "Can't create success object TemplateBinding.");
+
+ tlog.Debug(tag, $"TemplateBindingConstructor2 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding Converter")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.Converter A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ public void Converter()
+ {
+ tlog.Debug(tag, $"Converter START");
+
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ var ret = testingTarget.Converter;
+ testingTarget.Converter = ret;
+ tlog.Debug(tag, $"Converter END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding ConverterParameter")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.ConverterParameter A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ public void ConverterParameter()
+ {
+ tlog.Debug(tag, $"ConverterParameter START");
+
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ var ret = testingTarget.ConverterParameter;
+ testingTarget.ConverterParameter = ret;
+ tlog.Debug(tag, $"ConverterParameter END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding Path")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.Path A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRW")]
+ public void Path()
+ {
+ tlog.Debug(tag, $"Path START");
+
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ var ret = testingTarget.Path;
+ testingTarget.Path = ret;
+ tlog.Debug(tag, $"Path END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding Apply")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.Apply M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void Apply()
+ {
+ tlog.Debug(tag, $"Apply START");
+ try
+ {
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ testingTarget.Apply(false);
+ testingTarget.Unapply(false);
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"Apply END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding Apply")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.Apply M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void Apply2()
+ {
+ tlog.Debug(tag, $"Apply2 START");
+ try
+ {
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ testingTarget.Apply(null, new View(), View.FocusableProperty);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"Apply2 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding Apply")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.Apply M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void Apply3()
+ {
+ tlog.Debug(tag, $"Apply3 START");
+ try{
+ var testingTarget = new TemplateBinding("{Binding template}");
+ testingTarget.Apply(null, null, View.FocusableProperty); //InvalidOperationException
+ }
+ catch(Exception e){
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"Apply3 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding Clone")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.Clone M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void Clone()
+ {
+ tlog.Debug(tag, $"Clone START");
+ try
+ {
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ testingTarget.Clone();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"Clone END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateBinding GetSourceValue")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateBinding.GetSourceValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetSourceValue()
+ {
+ tlog.Debug(tag, $"GetSourceValue START");
+ try
+ {
+ var testingTarget = new TemplateBinding("{Binding template}");
+ Assert.IsNotNull(testingTarget, "Can't create success object TemplateBinding.");
+ testingTarget.GetSourceValue(null, typeof(bool));
+ testingTarget.GetTargetValue(null, typeof(bool));
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"GetSourceValue END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/TemplateUtilities")]
+ public class InternalTemplateUtilitiesTest
+ {
+ private const string tag = "NUITEST";
+ internal class MyView : BaseHandle, IControlTemplated
+ {
+ public IList<Element> InternalChildren => new List<Element>() { };
+
+ public void OnControlTemplateChanged(ControlTemplate oldValue, ControlTemplate newValue)
+ {
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateUtilities constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateUtilities.FindTemplatedParentAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void FindTemplatedParentAsync()
+ {
+ tlog.Debug(tag, $"FindTemplatedParentAsync START");
+ try
+ {
+ var view = new BaseHandle();
+ var testingTarget = TemplateUtilities.FindTemplatedParentAsync(view);
+ Assert.IsNotNull(testingTarget, "Should not be null");
+ var parent = new BaseHandle();
+ view.Parent = parent;
+ var testingTarget2 = TemplateUtilities.FindTemplatedParentAsync(view);
+ Assert.IsNotNull(testingTarget, "Should not be null");
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception" + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"FindTemplatedParentAsync END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateUtilities constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateUtilities.GetRealParentAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void GetRealParentAsync()
+ {
+ tlog.Debug(tag, $"GetRealParentAsync START");
+ try
+ {
+ var view = new BaseHandle();
+ var testingTarget = TemplateUtilities.GetRealParentAsync(view);
+ Assert.IsNotNull(testingTarget, "Should not be null");
+ var parent = new BaseHandle();
+ view.Parent = parent;
+ var testingTarget2 = TemplateUtilities.GetRealParentAsync(view);
+ Assert.IsNotNull(testingTarget, "Should not be null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception" + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"GetRealParentAsync END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TemplateUtilities constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.TemplateUtilities.OnControlTemplateChanged M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void OnControlTemplateChanged()
+ {
+ tlog.Debug(tag, $"OnControlTemplateChanged START");
+ try
+ {
+ var view = new MyView();
+ var child = new MyView();
+ child.Parent = view;
+
+ TemplateUtilities.OnControlTemplateChanged(view, "old", "new");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception" + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"OnControlTemplateChanged END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using System.Threading;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/TizenPlatformServices")]
+ public class InternalTizenPlatformServicesTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.TizenPlatformServices C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TizenPlatformServicesConstructor()
+ {
+ tlog.Debug(tag, $"TizenPlatformServicesConstructor START");
+
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+ Assert.IsInstanceOf<TizenPlatformServices>(testingTarget, "Should return TizenPlatformServices instance.");
+
+ tlog.Debug(tag, $"TizenPlatformServicesConstructor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices BeginInvokeOnMainThread")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.BeginInvokeOnMainThread M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void BeginInvokeOnMainThread()
+ {
+ tlog.Debug(tag, $"BeginInvokeOnMainThread START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ testingTarget.BeginInvokeOnMainThread(() => new View());
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"BeginInvokeOnMainThread END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices StartTimer")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.StartTimer M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void StartTimer()
+ {
+ tlog.Debug(tag, $"StartTimer START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ testingTarget.StartTimer(new TimeSpan(10), () => false);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"StartTimer END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices GetStreamAsync")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.GetStreamAsync M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetStreamAsync()
+ {
+ tlog.Debug(tag, $"GetStreamAsync START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ testingTarget.GetStreamAsync(new Uri("https://www.tizen.org/sites/all/themes/tizen_theme/logo.png"), CancellationToken.None);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"GetStreamAsync END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices GetAssemblies")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.GetAssemblies M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void GetAssemblies()
+ {
+ tlog.Debug(tag, $"GetAssemblies START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ Assert.IsNotNull(testingTarget.GetAssemblies(), "Should not be null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"GetAssemblies END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices GetMD5Hash")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.GetMD5Hash M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void GetMD5Hash()
+ {
+ tlog.Debug(tag, $"GetMD5Hash START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ Assert.IsNotNull(testingTarget.GetMD5Hash("ABCDEFG"), "Should not be null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"GetMD5Hash END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices QuitApplication")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.QuitApplication M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void QuitApplication()
+ {
+ tlog.Debug(tag, $"QuitApplication START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ testingTarget.QuitApplication();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"QuitApplication END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices IsInvokeRequired")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.IsInvokeRequired M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void IsInvokeRequired()
+ {
+ tlog.Debug(tag, $"IsInvokeRequired START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ Assert.True(testingTarget.IsInvokeRequired, "Should be true");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"IsInvokeRequired END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TizenPlatformServices RuntimePlatform ")]
+ [Property("SPEC", "Tizen.NUI.Binding.TizenPlatformServices.RuntimePlatform M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void RuntimePlatform()
+ {
+ tlog.Debug(tag, $"RuntimePlatform START");
+
+ try
+ {
+ var testingTarget = new TizenPlatformServices();
+ Assert.IsNotNull(testingTarget, "Can't create success object TizenPlatformServices.");
+
+ Assert.AreEqual(Device.Tizen, testingTarget.RuntimePlatform, "Should be equal");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception " + e.Message.ToString());
+ }
+ tlog.Debug(tag, $"RuntimePlatform END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/TrackableCollection")]
+ public class InternalTrackableCollectionTest
+ {
+ private const string tag = "NUITEST";
+
+ internal class MyTrackableCollection<T> : TrackableCollection<T>
+ {
+ public void Clear()
+ {
+ ClearItems();
+ }
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TrackableCollection ClearItems")]
+ [Property("SPEC", "Tizen.NUI.Binding.TrackableCollection.ClearItems M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void ClearItems()
+ {
+ tlog.Debug(tag, $"ClearItems START");
+ try
+ {
+ var testingTarget = new MyTrackableCollection<int>();
+ Assert.IsNotNull(testingTarget, "Can't create success object TrackableCollection.");
+ testingTarget.Clear();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"ClearItems END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/TypeConverterAttribute")]
+ public class InternalTypeConverterAttributeTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TypeConverterAttribute constructor")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypeConverterAttribute.TypeConverterAttribute C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TypeConverterAttributeConstructor()
+ {
+ tlog.Debug(tag, $"TypeConverterAttributeConstructor START");
+
+ var testingTarget = new TypeConverterAttribute("string");
+ Assert.IsNotNull(testingTarget, "Can't create success object TypeConverterAttribute.");
+ Assert.IsInstanceOf<TypeConverterAttribute>(testingTarget, "Should return TypeConverterAttribute instance.");
+
+ Assert.AreEqual("string", testingTarget.ConverterTypeName, "Should be equal");
+
+ var testingTarget2 = new TypeConverterAttribute(typeof(string));
+ Assert.IsNotNull(testingTarget2, "Can't create success object TypeConverterAttribute.");
+ Assert.IsInstanceOf<TypeConverterAttribute>(testingTarget2, "Should return TypeConverterAttribute instance.");
+
+ Assert.AreEqual(typeof(string).AssemblyQualifiedName, testingTarget2.ConverterTypeName, "Should be equal");
+
+ Assert.AreEqual(typeof(string).AssemblyQualifiedName.GetHashCode(), testingTarget2.GetHashCode(), "Should be equal");
+
+ tlog.Debug(tag, $"TypeConverterAttributeConstructor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TypeConverterAttribute Equals")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypeConverterAttribute.Equals M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void Equals()
+ {
+ tlog.Debug(tag, $"Equals START");
+
+ var testingTarget = new TypeConverterAttribute("string");
+ Assert.IsNotNull(testingTarget, "Can't create success object TypeConverterAttribute.");
+
+ var testingTarget2 = new TypeConverterAttribute("int");
+ Assert.False(testingTarget.Equals(testingTarget2), "Should be equal");
+ Assert.False(testingTarget.Equals(null), "Should be equal");
+
+ tlog.Debug(tag, $"Equals END");
+ }
+ }
+}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/TypeTypeConverter")]
+ public class InternalTypeTypeConverterTest
+ {
+ private const string tag = "NUITEST";
+ private string selfpath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Test_Theme.xaml";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("TypeTypeConverter ConvertFromInvariantString")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypeTypeConverter.ConvertFromInvariantString M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void TypeTypeConverterConvertFromInvariantString()
+ {
+ tlog.Debug(tag, $"TypeTypeConverterConvertFromInvariantString START");
+
+ var testingTarget = new TypeTypeConverter();
+ Assert.IsNotNull(testingTarget, "Can't create success object TypeTypeConverter.");
+ Assert.IsInstanceOf<TypeTypeConverter>(testingTarget, "Should return TypeTypeConverter instance.");
+
+ Assert.Throws<NotImplementedException>(()=> testingTarget.ConvertFromInvariantString(null));
+
+ tlog.Debug(tag, $"TypeTypeConverterConvertFromInvariantString END");
+ }
+ }
+}
private const string tag = "NUITEST";
private string selfpath = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "Test_Theme.xaml";
- internal class UriTypeConverterImpl : Binding.UriTypeConverter
- {
- public UriTypeConverterImpl()
- { }
- }
-
[SetUp]
public void Init()
{
[Test]
[Category("P1")]
[Description("UriTypeConverter ConvertFromInvariantString")]
- [Property("SPEC", "Tizen.NUI.UriTypeConverter.ConvertFromInvariantString M")]
+ [Property("SPEC", "Tizen.NUI.Binding.UriTypeConverter.ConvertFromInvariantString M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
public void UriTypeConverterConvertFromInvariantString()
{
tlog.Debug(tag, $"UriTypeConverterConvertFromInvariantString START");
- var testingTarget = new UriTypeConverterImpl();
+ var testingTarget = new Binding.UriTypeConverter();
Assert.IsNotNull(testingTarget, "Can't create success object UriTypeConverter.");
- Assert.IsInstanceOf<Tizen.NUI.Binding.UriTypeConverter>(testingTarget, "Should return UriTypeConverter instance.");
+ Assert.IsInstanceOf<Binding.UriTypeConverter>(testingTarget, "Should return UriTypeConverter instance.");
- var result = testingTarget.ConvertFromInvariantString(selfpath);
- tlog.Debug(tag, "ConvertFromInvariantString : " + result);
+ var ret = testingTarget.ConvertFromInvariantString(selfpath);
+ Assert.IsNotNull(ret, "Should not be null");
+ var ret2 = testingTarget.ConvertFromInvariantString("");
+ Assert.IsNotNull(ret, "Should not be null");
tlog.Debug(tag, $"UriTypeConverterConvertFromInvariantString END");
}
-
- [Test]
- [Category("P2")]
- [Description("UriTypeConverter ConvertFromInvariantString")]
- [Property("SPEC", "Tizen.NUI.UriTypeConverter.ConvertFromInvariantString M")]
- [Property("SPEC_URL", "-")]
- [Property("CRITERIA", "MR")]
- public void UriTypeConverterConvertFromInvariantStringNullPath()
- {
- tlog.Debug(tag, $"UriTypeConverterConvertFromInvariantStringNullPath START");
-
- var testingTarget = new UriTypeConverterImpl();
- Assert.IsNotNull(testingTarget, "Can't create success object UriTypeConverter.");
- Assert.IsInstanceOf<Tizen.NUI.Binding.UriTypeConverter>(testingTarget, "Should return UriTypeConverter instance.");
-
- var result = testingTarget.ConvertFromInvariantString(" ");
- tlog.Debug(tag, "ConvertFromInvariantString : " + result);
-
- tlog.Debug(tag, $"UriTypeConverterConvertFromInvariantStringNullPath END");
- }
}
}
--- /dev/null
+using global::System;
+using NUnit.Framework;
+using NUnit.Framework.TUnit;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Reflection;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using static Tizen.NUI.BaseComponents.View;
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("internal/XamlBinding/WeakEventManager")]
+ public class InternalWeakEventManagerTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ internal EventHandler<VisibilityChangedEventArgs> visibilityChangedEventHandler;
+ internal EventHandler eventHandler;
+
+ [Test]
+ [Category("P1")]
+ [Description("WeakEventManager AddEventHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.WeakEventManager.AddEventHandler M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void AddEventHandler()
+ {
+ tlog.Debug(tag, $"AddEventHandler START");
+ try
+ {
+ var testingTarget = new WeakEventManager();
+ visibilityChangedEventHandler = (o, e) => { };
+ Assert.IsNotNull(testingTarget, "Can't create success object WeakEventManager.");
+ testingTarget.AddEventHandler<VisibilityChangedEventArgs>("visibilityChangedEventHandler", visibilityChangedEventHandler);
+
+ eventHandler = (o, e) => { };
+ testingTarget.AddEventHandler("eventHandler", eventHandler);
+ testingTarget.RemoveEventHandler<VisibilityChangedEventArgs>("visibilityChangedEventHandler", visibilityChangedEventHandler);
+ testingTarget.RemoveEventHandler("eventHandler", eventHandler);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"AddEventHandler END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("WeakEventManager AddEventHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.WeakEventManager.AddEventHandler M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void AddEventHandler2()
+ {
+ tlog.Debug(tag, $"AddEventHandler START");
+
+ var testingTarget = new WeakEventManager();
+ Assert.IsNotNull(testingTarget, "Can't create success object WeakEventManager.");
+ visibilityChangedEventHandler = (o, e) => { };
+ Assert.Throws<ArgumentNullException> (() => testingTarget.AddEventHandler<VisibilityChangedEventArgs>(null, visibilityChangedEventHandler));
+ Assert.Throws<ArgumentNullException>(() => testingTarget.AddEventHandler<VisibilityChangedEventArgs>("visibilityChangedEventHandler", null));
+ eventHandler = (o, e) => { };
+ Assert.Throws<ArgumentNullException>(() => testingTarget.AddEventHandler(null, eventHandler));
+ Assert.Throws<ArgumentNullException>(() => testingTarget.AddEventHandler("eventHandler", null));
+
+ tlog.Debug(tag, $"AddEventHandler END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("WeakEventManager HandleEvent")]
+ [Property("SPEC", "Tizen.NUI.Binding.WeakEventManager.HandleEvent M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void HandleEvent()
+ {
+ tlog.Debug(tag, $"HandleEvent START");
+ try
+ {
+ var testingTarget = new WeakEventManager();
+ Assert.IsNotNull(testingTarget, "Can't create success object WeakEventManager.");
+ visibilityChangedEventHandler = (o, e) => { };
+ testingTarget.AddEventHandler<VisibilityChangedEventArgs>("visibilityChangedEventHandler", visibilityChangedEventHandler);
+ eventHandler = (o, e) => { };
+ testingTarget.AddEventHandler("eventHandler", eventHandler);
+ testingTarget.HandleEvent(null, new EventArgs(), "eventHandler");
+ testingTarget.HandleEvent(null, new VisibilityChangedEventArgs(), "visibilityChangedEventHandler");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Catch exception: " + e.Message.ToString());
+ }
+
+ tlog.Debug(tag, $"HandleEvent END");
+ }
+ }
+}
using Tizen.NUI.Components;
using Tizen.NUI.Xaml;
+[assembly: global::Tizen.NUI.Xaml.XamlResourceIdAttribute("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.BaseXamlSample2.xaml",
+ "testcase.public.Xaml.TotalSample.BaseXamlSample2.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.BaseXamlSample2))]
+
namespace Tizen.NUI.Devel.Tests
{
+ [Tizen.NUI.Xaml.XamlFilePathAttribute("testcase\\public\\Xaml\\TotalSample\\BaseXamlSample2.xaml")]
+ [Tizen.NUI.Xaml.XamlCompilationAttribute(global::Tizen.NUI.Xaml.XamlCompilationOptions.Compile)]
public partial class BaseXamlSample2 : Layer
{
public BaseXamlSample2()
--- /dev/null
+<?xml version="1.0" encoding="utf-8" ?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.BindablePropertiesAccessModifiers">
+
+ <local:AccessModifiersControl PublicFoo="{Binding Foo}"
+ InternalBar="{Binding Bar}"
+ x:Name="AMC"
+ x:FieldModifier="public"/>
+
+</View>
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+
+[assembly: global::Tizen.NUI.Xaml.XamlResourceIdAttribute("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.BindablePropertiesAccessModifiers.xaml",
+ "testcase.public.Xaml.TotalSample.BindablePropertiesAccessModifiers.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.BindablePropertiesAccessModifiers))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ public class AccessModifiersControl : View
+ {
+ public static BindableProperty PublicFooProperty = BindableProperty.Create("PublicFoo",
+ typeof(string),
+ typeof(AccessModifiersControl),
+ "");
+
+ public string PublicFoo
+ {
+ get => (string)GetValue(PublicFooProperty);
+ set => SetValue(PublicFooProperty, value);
+ }
+
+ internal static BindableProperty InternalBarProperty = BindableProperty.Create("InternalBar",
+ typeof(string),
+ typeof(AccessModifiersControl),
+ "");
+
+ public string InternalBar
+ {
+ get => (string)GetValue(InternalBarProperty);
+ set => SetValue(InternalBarProperty, value);
+ }
+ }
+
+ [Tizen.NUI.Xaml.XamlFilePathAttribute("testcase\\public\\Xaml\\TotalSample\\BindablePropertiesAccessModifiers.xaml")]
+ [Tizen.NUI.Xaml.XamlCompilationAttribute(global::Tizen.NUI.Xaml.XamlCompilationOptions.Compile)]
+ public partial class BindablePropertiesAccessModifiers : View
+ {
+ class Data
+ {
+ public string Foo => "Foo";
+ public string Bar => "Bar";
+ }
+
+ public AccessModifiersControl AMC;
+
+ public BindablePropertiesAccessModifiers()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(BindablePropertiesAccessModifiers));
+ AMC = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<global::Tizen.NUI.Devel.Tests.AccessModifiersControl>(this, "AMC");
+ }
+
+ public BindablePropertiesAccessModifiers(bool useCompiledXaml)
+ {
+ //this stub will be replaced at compile time
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ //Device.PlatformServices = new MockPlatformServices();
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ //Device.PlatformServices = null;
+ }
+
+ [Test]
+ public void BindProperties()
+ {
+ var page = new BindablePropertiesAccessModifiers();
+ page.BindingContext = new Data();
+ Assert.AreEqual("Bar", page.AMC.GetValue(AccessModifiersControl.InternalBarProperty));
+ Assert.AreEqual("Foo", page.AMC.GetValue(AccessModifiersControl.PublicFooProperty));
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib"
+ x:Class="Tizen.NUI.Devel.Tests.BindingsCompiler" >
+
+ <View x:DataType="local:MockViewModel">
+ <TextLabel Text="{Binding Text}" x:Name="label0" />
+ <TextLabel Text="{Binding Path=Text}" x:Name="label1" />
+ <TextLabel Text="{Binding Model.Text}" x:Name="label2" />
+ <TextLabel Text="{Binding Model[3]}" x:Name="label3" />
+ <TextLabel Text="{Binding}" x:Name="label4" x:DataType="sys:String"/>
+ <TextLabel Text="{Binding I}" x:Name="label5" />
+ <TextLabel Text="{Binding Model.Text}" x:Name="label6" x:DataType="local:MockStructViewModel" />
+ <TextField Text="{Binding Text, Mode=TwoWay}" x:Name="entry0"/>
+ <TextField Text="{Binding Model.Text, Mode=TwoWay}" x:Name="entry1" />
+ <TextLabel Text="{Binding .}" x:Name="label7" x:DataType="sys:Int32"/>
+ <TextLabel Text="{Binding Text, Mode=OneTime}" x:Name="label8" />
+ <TextLabel Text="{Binding StructModel.Text, Mode=TwoWay}" x:Name="label9" />
+ <TextLabel Text="{Binding StructModel.Model.Text, Mode=TwoWay}" x:Name="label10" />
+ </View>
+ <TextLabel Text="{Binding Text}" x:Name="labelWithUncompiledBinding" />
+</View>
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
+using System.Diagnostics;
+using Tizen.NUI.BaseComponents;
+
+[assembly: global::Tizen.NUI.Xaml.XamlResourceIdAttribute("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.BindingsCompiler.xaml",
+ "testcase.public.Xaml.TotalSample.BindingsCompiler.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.BindingsCompiler))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [Tizen.NUI.Xaml.XamlFilePathAttribute("testcase\\public\\Xaml\\TotalSample\\BindingsCompiler.xaml")]
+ [Tizen.NUI.Xaml.XamlCompilationAttribute(global::Tizen.NUI.Xaml.XamlCompilationOptions.Compile)]
+ public partial class BindingsCompiler : View
+ {
+ public TextLabel label0;
+ public TextLabel label1;
+ public TextLabel label2;
+ public TextLabel label3;
+ public TextLabel label4;
+ public TextLabel label5;
+ public TextLabel label6;
+ public TextLabel label7;
+ public TextLabel label8;
+ public TextLabel label9;
+ public TextLabel label10;
+ public TextField entry0;
+ public TextField entry1;
+ public TextLabel labelWithUncompiledBinding;
+
+ public BindingsCompiler()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(BindingsCompiler));
+
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ label1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label1");
+ label2 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label2");
+ label3 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label3");
+ label4 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label4");
+ label5 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label5");
+ label6 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label6");
+ label7 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label7");
+ label8 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label8");
+ label9 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label9");
+ label10 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label10");
+ labelWithUncompiledBinding = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "labelWithUncompiledBinding");
+ entry0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextField>(this, "entry0");
+ entry1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextField>(this, "entry1");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void Test()
+ {
+ var vm = new MockViewModel {
+ Text = "Text0",
+ I = 42,
+ Model = new MockViewModel {
+ Text = "Text1"
+ },
+ StructModel = new MockStructViewModel {
+ Model = new MockViewModel {
+ Text = "Text9"
+ }
+ }
+ };
+ vm.Model [3] = "TextIndex";
+
+ var layout = new BindingsCompiler();
+ layout.BindingContext = vm;
+ layout.label6.BindingContext = new MockStructViewModel {
+ Model = new MockViewModel {
+ Text = "text6"
+ }
+ };
+
+ //testing paths
+ Assert.AreEqual("Text0", layout.label0.Text);
+ Assert.AreEqual("Text0", layout.label1.Text);
+ Assert.AreEqual("Text1", layout.label2.Text);
+ Assert.AreEqual("TextIndex", layout.label3.Text);
+ Assert.AreEqual("Text0", layout.label8.Text);
+
+ //value types
+ Assert.That(layout.label5.Text, Is.EqualTo("42"));
+ Assert.That(layout.label6.Text, Is.EqualTo("text6"));
+ Assert.AreEqual("Text9", layout.label9.Text);
+ Assert.AreEqual("Text9", layout.label10.Text);
+ layout.label9.Text = "Text from label9";
+ Assert.AreEqual("Text from label9", vm.StructModel.Text);
+ layout.label10.Text = "Text from label10";
+ Assert.AreEqual("Text from label10", vm.StructModel.Model.Text);
+
+ //testing selfPath
+ layout.label4.BindingContext = "Self";
+ Assert.AreEqual("Self", layout.label4.Text);
+ layout.label7.BindingContext = 42;
+ Assert.That(layout.label7.Text, Is.EqualTo("42"));
+
+ //testing INPC
+ GC.Collect();
+ vm.Text = "Text2";
+ Assert.AreEqual("Text2", layout.label0.Text);
+
+ //testing 2way
+ Assert.AreEqual("Text2", layout.entry0.Text);
+ layout.entry0.SetValue(TextField.TextProperty, "Text3");
+ Assert.AreEqual("Text3", layout.entry0.Text);
+ Assert.AreEqual("Text3", vm.Text);
+ layout.entry1.SetValue(TextField.TextProperty, "Text4");
+ Assert.AreEqual("Text4", layout.entry1.Text);
+ Assert.AreEqual("Text4", vm.Model.Text);
+ vm.Model = null;
+ layout.entry1.BindingContext = null;
+
+ //testing invalid bindingcontext type
+ layout.BindingContext = new object();
+ Assert.AreEqual(string.Empty, layout.label0.Text);
+ }
+ }
+ }
+
+ struct MockStructViewModel
+ {
+ public string Text {
+ get { return Model.Text; }
+ set { Model.Text = value; }
+ }
+ public int I { get; set; }
+ public MockViewModel Model { get; set; }
+ }
+
+ class MockViewModel : INotifyPropertyChanged
+ {
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ public MockViewModel(string text = null, int i = -1)
+ {
+ _text = text;
+ _i = i;
+ }
+
+ string _text;
+ public string Text {
+ get { return _text; }
+ set {
+ if (_text == value)
+ return;
+
+ _text = value;
+ OnPropertyChanged();
+ }
+ }
+
+ int _i;
+ public int I {
+ get { return _i; }
+ set {
+ if (_i == value)
+ return;
+ _i = value;
+ OnPropertyChanged();
+ }
+ }
+
+ MockViewModel _model;
+ public MockViewModel Model {
+ get { return _model; }
+ set {
+ if (_model == value)
+ return;
+ _model = value;
+ OnPropertyChanged();
+ }
+ }
+
+ MockStructViewModel _structModel;
+ public MockStructViewModel StructModel {
+ get { return _structModel; }
+ set {
+ _structModel = value;
+ OnPropertyChanged();
+ }
+ }
+
+ string [] values = new string [5];
+ [IndexerName("Indexer")]
+ public string this [int v] {
+ get { return values [v]; }
+ set {
+ if (values [v] == value)
+ return;
+
+ values [v] = value;
+ OnPropertyChanged("Indexer[" + v + "]");
+ }
+ }
+
+ protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
+ {
+ PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.BuiltInConversions">
+ <View>
+ <TextLabel x:Name="label0" Text="foobar"/>
+ <TextLabel x:Name="label1">
+ <TextLabel.Text>
+ foobar
+ </TextLabel.Text>
+ </TextLabel>
+ <TextLabel x:Name="label2">
+ foobar
+ </TextLabel>
+ </View>
+</View>
\ No newline at end of file
--- /dev/null
+using System;
+
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+
+[assembly: global::Tizen.NUI.Xaml.XamlResourceIdAttribute("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.BuiltInConversions.xaml",
+ "testcase.public.Xaml.TotalSample.BuiltInConversions.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.BuiltInConversions))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [Tizen.NUI.Xaml.XamlFilePathAttribute("testcase\\public\\Xaml\\TotalSample\\BuiltInConversions.xaml")]
+ [Tizen.NUI.Xaml.XamlCompilationAttribute(global::Tizen.NUI.Xaml.XamlCompilationOptions.Compile)]
+ public partial class BuiltInConversions : View
+ {
+ public TextLabel label0;
+ public TextLabel label1;
+ public TextLabel label2;
+
+ public BuiltInConversions ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(BuiltInConversions));
+
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ label1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label1");
+ label2 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label2");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void String ()
+ {
+ var layout = new BuiltInConversions ();
+
+ Assert.AreEqual ("foobar", layout.label0.Text);
+ Assert.AreEqual ("foobar", layout.label1.Text);
+
+ //Issue #2122, implicit content property not trimmed
+ Assert.AreEqual (string.Empty, layout.label2.Text);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<View
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.CustomXamlView">
+ <TextLabel x:Name="label0" Text="foobar"/>
+</View>
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.CustomXamlView.xaml",
+ "testcase.public.Xaml.TotalSample.CustomXamlView.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.CustomXamlView))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\CustomXamlView.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class CustomXamlView : View
+ {
+ public CustomXamlView ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(CustomXamlView));
+
+ }
+ }
+}
--- /dev/null
+<BindableObject xmlns="http://tizen.org/Tizen.NUI/2018/XAML" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.DuplicatePropertyElements">
+ <BindableObject.BindingContext>0</BindableObject.BindingContext>
+ <BindableObject.BindingContext>0</BindableObject.BindingContext>
+</BindableObject>
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+[assembly: global::Tizen.NUI.Xaml.XamlResourceIdAttribute("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.DuplicatePropertyElements.xaml",
+ "testcase.public.Xaml.TotalSample.DuplicatePropertyElements.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.DuplicatePropertyElements))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [Tizen.NUI.Xaml.XamlFilePathAttribute("testcase\\public\\Xaml\\TotalSample\\DuplicatePropertyElements.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class DuplicatePropertyElements : BindableObject
+ {
+ public DuplicatePropertyElements()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(DuplicatePropertyElements));
+ }
+
+ [TestFixture]
+ public static class Tests
+ {
+ [Test]
+ public static void ThrowXamlParseException()
+ {
+ Assert.Throws<ArgumentException>(() => new DuplicatePropertyElements());
+ }
+ }
+ }
+}
--- /dev/null
+<BindableObject xmlns="http://tizen.org/Tizen.NUI/2018/XAML" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:system="clr-namespace:System;assembly=mscorlib.dll" x:Class="Tizen.NUI.Devel.Tests.DuplicateXArgumentsElements">
+ <BindableObject.BindingContext>
+ <system:Uri>
+ <x:Arguments>https://example.com/</x:Arguments>
+ <x:Arguments>https://example.com/</x:Arguments>
+ </system:Uri>
+ </BindableObject.BindingContext>
+</BindableObject>
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+[assembly: global::Tizen.NUI.Xaml.XamlResourceIdAttribute("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.DuplicateXArgumentsElements.xaml",
+ "testcase.public.Xaml.TotalSample.DuplicateXArgumentsElements.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.DuplicateXArgumentsElements))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\DuplicateXArgumentsElements.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class DuplicateXArgumentsElements : BindableObject
+ {
+ public DuplicateXArgumentsElements()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(DuplicateXArgumentsElements));
+ }
+
+ [TestFixture]
+ public static class Tests
+ {
+ [Test]
+ public static void ThrowXamlParseException()
+ {
+ Assert.Throws<ArgumentException>(() => new DuplicateXArgumentsElements());
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ContentPage xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.DynamicResource">
+ <TextLabel Text="{DynamicResource FooBar}" x:Name="label0" />
+</ContentPage>
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.Generic;
+
+using NUnit.Framework;
+
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+[assembly: global::Tizen.NUI.Xaml.XamlResourceIdAttribute("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.DynamicResource.xaml",
+ "testcase.public.Xaml.TotalSample.DynamicResource.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.DynamicResource))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\DynamicResource.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class DynamicResource : View
+ {
+ public TextLabel label0;
+
+ public DynamicResource ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(DynamicResource));
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void TestDynamicResources ()
+ {
+ var layout = new DynamicResource();
+ var label = layout.label0;
+
+ Assert.AreEqual(string.Empty, label.Text, "Should be equal");
+
+ layout.XamlResources = new ResourceDictionary {
+ {"FooBar", "FOOBAR"},
+ };
+ Assert.AreEqual (string.Empty, label.Text);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<local:MockView xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.FactoryMethodMissingCtor">
+ <local:MockView.Content>
+ <local:MockFactory>
+ <x:Arguments>
+ <x:Object/>
+ <x:String>bar</x:String>
+ <x:Int32>42</x:Int32>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+</local:MockView>
\ No newline at end of file
--- /dev/null
+using System;
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.FactoryMethodMissingCtor.xaml",
+ "testcase.public.Xaml.TotalSample.FactoryMethodMissingCtor.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.FactoryMethodMissingCtor))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\FactoryMethodMissingCtor.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class FactoryMethodMissingCtor : MockView
+ {
+ public FactoryMethodMissingCtor()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(FactoryMethodMissingCtor));
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp] public void Setup() { }
+
+ [TearDown] public void TearDown() { }
+
+ [Test]
+ public void Throw()
+ {
+ Assert.Throws<MissingMethodException>(() => new FactoryMethodMissingCtor());
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<local:MockView xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.FactoryMethodMissingMethod">
+ <local:MockView.Content>
+ <local:MockFactory x:FactoryMethod="Factory">
+ <x:Arguments>
+ <x:Object/>
+ <x:String>bar</x:String>
+ <x:Int32>42</x:Int32>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+</local:MockView>
\ No newline at end of file
--- /dev/null
+using System;
+using NUnit.Framework;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.FactoryMethodMissingMethod.xaml",
+ "testcase.public.Xaml.TotalSample.FactoryMethodMissingMethod.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.FactoryMethodMissingCtor))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\FactoryMethodMissingMethod.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class FactoryMethodMissingMethod : MockView
+ {
+ public FactoryMethodMissingMethod()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(FactoryMethodMissingMethod));
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [Test]
+ public void Throw()
+ {
+ Assert.Throws<XamlParseException>(() => new FactoryMethodMissingMethod());
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.FactoryMethods">
+ <View>
+ <local:MockView x:Name="v0">
+ <local:MockView.Content>
+ <local:MockFactory/>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v1">
+ <local:MockView.Content>
+ <local:MockFactory>
+ <x:Arguments>
+ <x:String>foo</x:String>
+ <x:String>bar</x:String>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v2">
+ <local:MockView.Content>
+ <local:MockFactory>
+ <x:Arguments>
+ <x:Int32>42</x:Int32>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v3">
+ <local:MockView.Content>
+ <local:MockFactory x:FactoryMethod="ParameterlessFactory">
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v4">
+ <local:MockView.Content>
+ <local:MockFactory x:FactoryMethod="Factory">
+ <x:Arguments>
+ <x:String>foo</x:String>
+ <x:Int32>42</x:Int32>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v5">
+ <local:MockView.Content>
+ <local:MockFactory x:FactoryMethod="Factory">
+ <x:Arguments>
+ <x:Int32>42</x:Int32>
+ <x:String>foo</x:String>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v6">
+ <local:MockView.Content>
+ <local:MockFactory>
+ <x:Arguments>
+ <StaticExtension Member="local:MockxStatic.MockStaticProperty"/>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v7">
+ <local:MockView.Content>
+ <local:MockFactory x:Arguments="{x:Static local:MockxStatic.MockStaticProperty}"/>
+ </local:MockView.Content>
+ </local:MockView>
+ <local:MockView x:Name="v8">
+ <local:MockView.Content>
+ <local:MockFactory >
+ <x:Arguments>
+ <x:Array Type="{x:Type x:Object}">
+ <x:String>Foo</x:String>
+ <x:String>Bar</x:String>
+ </x:Array>
+ </x:Arguments>
+ </local:MockFactory>
+ </local:MockView.Content>
+ </local:MockView>
+ </View>
+</View>
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.FactoryMethods.xaml",
+ "testcase.public.Xaml.TotalSample.FactoryMethods.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.FactoryMethods))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ public class MockView : View
+ {
+ public MockFactory Content { get; set; }
+ }
+
+ public class MockFactory
+ {
+ public string Content { get; set; }
+ public MockFactory ()
+ {
+ Content = "default ctor";
+ }
+
+ public MockFactory(string arg0, string arg1)
+ {
+ Content = "alternate ctor " + arg0 + arg1;
+ }
+
+ public MockFactory(string arg0)
+ {
+ Content = "alternate ctor " + arg0;
+ }
+
+ public MockFactory (int arg)
+ {
+ Content = "int ctor " + arg.ToString ();
+ }
+
+ public MockFactory(object [] args)
+ {
+ Content = string.Join(" ", args);
+ }
+
+ public static MockFactory ParameterlessFactory ()
+ {
+ return new MockFactory {
+ Content = "parameterless factory",
+ };
+ }
+
+ public static MockFactory Factory (string arg0, int arg1)
+ {
+ return new MockFactory {
+ Content = "factory " + arg0 + arg1,
+ };
+ }
+
+ public static MockFactory Factory (int arg0, string arg1)
+ {
+ return new MockFactory {
+ Content = "factory " + arg0 + arg1,
+ };
+ }
+ }
+
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\FactoryMethods.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class FactoryMethods : View
+ {
+ public MockView v0;
+ public MockView v1;
+ public MockView v2;
+ public MockView v3;
+ public MockView v4;
+ public MockView v5;
+ public MockView v6;
+ public MockView v7;
+ public MockView v8;
+
+ public FactoryMethods ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(FactoryMethods));
+
+ v0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v0");
+ v1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v1");
+ v2 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v2");
+ v3 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v3");
+ v4 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v4");
+ v5 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v5");
+ v6 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v6");
+ v7 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v7");
+ v8 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<MockView>(this, "v8");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void SetUp()
+ {
+ }
+
+ [Test]
+ public void TestDefaultCtor ()
+ {
+ var layout = new FactoryMethods ();
+ Assert.AreEqual ("default ctor", layout.v0.Content.Content);
+ }
+
+ [Test]
+ public void TestStringCtor ()
+ {
+ var layout = new FactoryMethods ();
+ Assert.AreEqual ("alternate ctor foobar", layout.v1.Content.Content);
+ }
+
+ [Test]
+ public void TestIntCtor ()
+ {
+ var layout = new FactoryMethods ();
+ Assert.AreEqual ("int ctor 42", layout.v2.Content.Content);
+ }
+
+ [Test]
+ public void TestArgumentlessFactoryMethod ()
+ {
+ var layout = new FactoryMethods ();
+ Assert.AreEqual ("parameterless factory", layout.v3.Content.Content);
+ }
+
+ [Test]
+ public void TestFactoryMethod ()
+ {
+ var layout = new FactoryMethods ();
+ Assert.AreEqual ("factory foo42", layout.v4.Content.Content);
+ }
+
+ [Test]
+ public void TestFactoryMethodParametersOrder ()
+ {
+ var layout = new FactoryMethods ();
+ Assert.AreEqual ("factory 42foo", layout.v5.Content.Content);
+ }
+
+ [Test]
+ public void TestCtorWithxStatic()
+ {
+ var layout = new FactoryMethods();
+ Assert.AreEqual("alternate ctor Property", layout.v6.Content.Content);
+ }
+
+ [Test]
+ public void TestCtorWithxStaticAttribute()
+ {
+ var layout = new FactoryMethods();
+ Assert.AreEqual("alternate ctor Property", layout.v7.Content.Content);
+ }
+
+ [Test]
+ public void TestCtorWithArrayParameter()
+ {
+ var layout = new FactoryMethods();
+ Assert.AreEqual("Foo Bar", layout.v8.Content.Content);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.FieldModifier">
+ <View>
+ <TextLabel x:Name="privateLabel" />
+ <TextLabel x:Name="internalLabel" x:FieldModifier="NotPublic" />
+ <TextLabel x:Name="publicLabel" x:FieldModifier="Public" />
+ </View>
+</View>
\ No newline at end of file
--- /dev/null
+using System.Linq;
+using System.Reflection;
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.FieldModifier.xaml",
+ "testcase.public.Xaml.TotalSample.FieldModifier.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.FieldModifier))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\FieldModifier.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class FieldModifier : View
+ {
+ public TextLabel privateLabel;
+ public TextLabel internalLabel;
+ public TextLabel publicLabel;
+
+ public FieldModifier()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(FieldModifier));
+
+ privateLabel = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "privateLabel");
+ internalLabel = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "internalLabel");
+ publicLabel = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "publicLabel");
+ }
+
+ [TestFixture]
+ public class FindByNameTests
+ {
+ [Test]
+ public void TestFieldModifier ()
+ {
+ var layout = new FieldModifier();
+ Assert.That(layout.privateLabel, Is.Not.Null);
+ Assert.That(layout.internalLabel, Is.Not.Null);
+ Assert.That(layout.publicLabel, Is.Not.Null);
+
+ var fields = typeof(FieldModifier).GetTypeInfo().DeclaredFields;
+
+ Assert.That(fields.First(fi => fi.Name == "privateLabel").IsPrivate, Is.False);
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.FindByName"
+ x:Name="root">
+ <View>
+ <TextLabel Text="Foo" x:Name="label0"/>
+ </View>
+</View>
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.FindByName.xaml",
+ "testcase.public.Xaml.TotalSample.FindByName.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.FindByName))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\FindByName.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class FindByName : View
+ {
+ public FindByName root;
+ public TextLabel label0;
+
+ public FindByName ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(FindByName));
+ root = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<FindByName>(this, "root");
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ }
+
+ [TestFixture]
+ public class FindByNameTests
+ {
+ [Test]
+ public void TestRootName ()
+ {
+ var page = new FindByName ();
+ Assert.AreSame (page, page.root);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.GenericCollections">
+ <TextLabel x:Name="label0">
+ <local:AttachedBP.AttachedBP>
+ <local:GenericCollection>
+ <x:String>Foo</x:String>
+ </local:GenericCollection>
+ </local:AttachedBP.AttachedBP>
+ </TextLabel>
+</View>
\ No newline at end of file
--- /dev/null
+using System;
+using System.Collections.ObjectModel;
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.GenericCollections.xaml",
+ "testcase.public.Xaml.TotalSample.GenericCollections.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.GenericCollections))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ public class AttachedBP
+ {
+ public static readonly BindableProperty AttachedBPProperty = BindableProperty.CreateAttached (
+ "AttachedBP",
+ typeof(GenericCollection),
+ typeof(AttachedBP),
+ null);
+
+ public static GenericCollection GetAttachedBP(BindableObject bindable)
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public class GenericCollection : ObservableCollection<object>
+ {
+ }
+
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\GenericCollections.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class GenericCollections : View
+ {
+ public TextLabel label0;
+
+ public GenericCollections ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(GenericCollections));
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [Test]
+ public void SupportsCrookedGenericScenarios ()
+ {
+ var p = new GenericCollections ();
+ Assert.AreEqual ("Foo", (p.label0.GetValue (AttachedBP.AttachedBPProperty) as GenericCollection) [0]);
+ }
+ }
+ }
+}
\ No newline at end of file
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
- <View x:Name="view" BackgroundColor="{Binding Color}" Size2D="440,400" Position2D="20,10" >
- <View.BindingContext>
- <l:HslViewModel x:Name="hsl" Color="Red" />
- </View.BindingContext>
- </View>
+ <View.XamlResources>
+ <ResourceDictionary>
+ <l:FloatToIntConverter x:Key="floatToInt" />
+ </ResourceDictionary>
+ </View.XamlResources>
+ <View x:Name="view" BackgroundColor="{Binding Color}" Size2D="440,400" Position2D="20,10" >
+ <View.BindingContext>
+ <l:HslViewModel x:Name="hsl" Color="Red" />
+ </View.BindingContext>
+
+ <TextLabel Text="{Binding Hue, Converter={StaticResource floatToInt}, ConverterParameter=255, StringFormat='Hue = {0:F2}'}"
+ Position2D="20,480" HorizontalAlignment="Center" VerticalAlignment="Center" />
- <TextLabel BindingContext="{x:Reference hsl}" Text="{Binding Hue, StringFormat='Hue = {0:F2}'}"
- Position2D="20,480" HorizontalAlignment="Center" VerticalAlignment="Center" />
-
- <TextLabel BindingContext="{x:Reference hsl}" Text="{Binding Saturation, StringFormat='Saturation = {0:F2}'}"
- Position2D="20,590" HorizontalAlignment="Center" VerticalAlignment="Center" />
-
- <TextLabel BindingContext="{x:Reference hsl}" Text="{Binding Luminosity, StringFormat='Luminosity = {0:F2}'}"
- Position2D="20,690" HorizontalAlignment="Center" VerticalAlignment="Center" />
+ <TextLabel Text="{Binding Saturation, StringFormat='Saturation = {0:F2}'}"
+ Position2D="20,590" HorizontalAlignment="Center" VerticalAlignment="Center" />
+ <TextLabel Text="{Binding Luminosity, StringFormat='Luminosity = {0:F2}'}"
+ Position2D="20,690" HorizontalAlignment="Center" VerticalAlignment="Center" >
+ <TextLabel.Text>
+ <Binding Path="Luminosity" StringFormat="Luminosity = {0:X2}" Converter="{StaticResource floatToInt}">
+ <Binding.ConverterParameter>
+ <x:Single>255</x:Single>
+ </Binding.ConverterParameter>
+ </Binding>
+ </TextLabel.Text>
+ </TextLabel>
+ </View>
</View>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.I8"
+ l0="0"
+ l1="2147483647"
+ l2="4294967295"
+ l3="9223372036854775807"
+ l4="-2147483647"
+ l5="-4294967295"
+ l6="-9223372036854775807"
+ l7="256"
+ l8="-256"
+ l9="127"
+ ul0="0"
+ ul1="2147483647"
+ ul2="4294967295"
+ ul3="9223372036854775807"
+ ul4="18446744073709551615"
+ ul5="256">
+</View>
--- /dev/null
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.I8.xaml",
+ "testcase.public.Xaml.TotalSample.I8.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.I8))]
+
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\I8.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class I8 : View
+ {
+ public long l0 { get; set; }
+ public long l1 { get; set; }
+ public long l2 { get; set; }
+ public long l3 { get; set; }
+ public long l4 { get; set; }
+ public long l5 { get; set; }
+ public long l6 { get; set; }
+ public long l7 { get; set; }
+ public long l8 { get; set; }
+ public long l9 { get; set; }
+ public ulong ul0 { get; set; }
+ public ulong ul1 { get; set; }
+ public ulong ul2 { get; set; }
+ public ulong ul3 { get; set; }
+ public ulong ul4 { get; set; }
+ public ulong ul5 { get; set; }
+
+ public I8()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(I8));
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void I8AreConverted()
+ {
+ var p = new I8();
+ Assert.AreEqual(0L, p.l0);
+ Assert.AreEqual((long)int.MaxValue, p.l1);
+ Assert.AreEqual((long)uint.MaxValue, p.l2);
+ Assert.AreEqual(long.MaxValue, p.l3);
+ Assert.AreEqual((long)-int.MaxValue, p.l4);
+ Assert.AreEqual((long)-uint.MaxValue, p.l5);
+ Assert.AreEqual(-long.MaxValue, p.l6);
+ Assert.AreEqual((long)256, p.l7);
+ Assert.AreEqual((long)-256, p.l8);
+ Assert.AreEqual((long)127, p.l9);
+ Assert.AreEqual(0L, p.ul0);
+ Assert.AreEqual((long)int.MaxValue, p.ul1);
+ Assert.AreEqual((long)uint.MaxValue, p.ul2);
+ Assert.AreEqual(long.MaxValue, p.ul3);
+ Assert.AreEqual(ulong.MaxValue, p.ul4);
+ Assert.AreEqual((ulong)256, p.ul5);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:d="ignoreme"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ mc:Ignorable="d"
+ x:Class="Tizen.NUI.Devel.Tests.McIgnorable"
+ d:DesignWidth="320"
+ d:DesignHeight="800">
+ <View.BindingContext>
+ <d:FooBar />
+ </View.BindingContext>
+ <View x:Name="stack">
+ <d:FakeControlWithContent>
+ <d:Invalid />
+ <TextLabel />
+ </d:FakeControlWithContent>
+ </View>
+</View>
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.McIgnorable.xaml",
+ "testcase.public.Xaml.TotalSample.McIgnorable.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.McIgnorable))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\McIgnorable.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Compile)]
+ public partial class McIgnorable : View
+ {
+ public McIgnorable ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(McIgnorable));
+ }
+
+
+ [TestFixture]
+ public class Tests
+ {
+ [Test]
+ public void DoesNotThrow ()
+ {
+ var layout = new McIgnorable ();
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<View
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.ResourceDictionaryWithInvalidSource">
+ <View.XamlResources>
+ <ResourceDictionary>
+ <ResourceDictionary Source="foobar.xaml" x:Key="foobar"/>
+ </ResourceDictionary>
+ </View.XamlResources>
+</View>
\ No newline at end of file
--- /dev/null
+using System;
+using System.IO;
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.ResourceDictionaryWithInvalidSource.xaml",
+ "testcase.public.Xaml.TotalSample.ResourceDictionaryWithInvalidSource.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.ResourceDictionaryWithInvalidSource))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\ResourceDictionaryWithInvalidSource.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class ResourceDictionaryWithInvalidSource : View
+ {
+ public ResourceDictionaryWithInvalidSource()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(ResourceDictionaryWithInvalidSource));
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void InvalidSourceThrows()
+ {
+ Assert.Throws<FileNotFoundException>(() => new ResourceDictionaryWithInvalidSource());
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.SetStyleIdFromXName">
+ <View>
+ <TextLabel x:Name="label0" />
+ <TextLabel x:Name="label1" StyleId="foo" />
+ <TextLabel StyleId="bar" x:Name="label2" />
+ </View>
+</View>
\ No newline at end of file
--- /dev/null
+using System;
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.SetStyleIdFromXName.xaml",
+ "testcase.public.Xaml.TotalSample.SetStyleIdFromXName.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.SetStyleIdFromXName))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\SetStyleIdFromXName.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class SetStyleIdFromXName : View
+ {
+ public TextLabel label0;
+ public TextLabel label1;
+ public TextLabel label2;
+
+ public SetStyleIdFromXName()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(SetStyleIdFromXName));
+
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ label1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label1");
+ label2 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label2");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void SetStyleId()
+ {
+ var layout = new SetStyleIdFromXName();
+ Assert.That(layout.label0.StyleId, Is.EqualTo("label0"));
+ Assert.That(layout.label1.StyleId, Is.EqualTo("foo"));
+ Assert.That(layout.label2.StyleId, Is.EqualTo("bar"));
+ }
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.StringLiterals">
+ <View>
+ <TextLabel x:Name="label0" Text="{}Foo" />
+ <TextLabel x:Name="label1" Text="{}{Foo}" />
+ <TextLabel x:Name="label2">
+ {}Foo
+ </TextLabel>
+ <TextLabel x:Name="label3">
+ <TextLabel.Text>
+ {}Foo
+ </TextLabel.Text>
+ </TextLabel>
+ </View>
+</View>
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.StringLiterals.xaml",
+ "testcase.public.Xaml.TotalSample.StringLiterals.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.StringLiterals))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\StringLiterals.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class StringLiterals : View
+ {
+ public TextLabel label0;
+ public TextLabel label1;
+ public TextLabel label2;
+ public TextLabel label3;
+
+ public StringLiterals ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(StringLiterals));
+
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ label1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label1");
+ label2 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label2");
+ label3 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label3");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void EscapedStringsAreTreatedAsLiterals ()
+ {
+ var layout = new StringLiterals ();
+ Assert.AreEqual ("Foo", layout.label0.Text);
+ Assert.AreEqual ("{Foo}", layout.label1.Text);
+ Assert.AreEqual (string.Empty, layout.label2.Text);
+ Assert.AreEqual ("Foo", layout.label3.Text);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="using:Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.TestXmlnsUsing">
+
+ <local:CustomXamlView x:Name="view0"/>
+</View>
--- /dev/null
+using System;
+using System.Collections.Generic;
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.TestXmlnsUsing.xaml",
+ "testcase.public.Xaml.TotalSample.TestXmlnsUsing.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.TestXmlnsUsing))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\TestXmlnsUsing.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class TestXmlnsUsing : View
+ {
+ public CustomXamlView view0;
+
+ public TestXmlnsUsing()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(TestXmlnsUsing));
+
+ view0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<CustomXamlView>(this, "view0");
+ }
+
+ [TestFixture]
+ class Tests
+ {
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ Application.Current = null;
+ }
+
+ [Test]
+ public void SupportUsingXmlns()
+ {
+ var page = new TestXmlnsUsing();
+ Assert.That(page.view0, Is.Not.Null);
+ Assert.That(page.view0, Is.TypeOf<CustomXamlView>());
+ }
+ }
+ }
+}
private void LoadEXaml()
{
eXamlData = global::Tizen.NUI.EXaml.EXamlExtensions.LoadFromEXamlByRelativePath(this, @"examl/Tizen.NUI.Devel.Tests.TotalSample.examl");
- t1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<global::Tizen.NUI.Devel.Tests.UIElement>(this, "t1");
- t2 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<global::Tizen.NUI.Devel.Tests.UIElement>(this, "t2");
- t3 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<global::Tizen.NUI.Devel.Tests.UIElement>(this, "t3");
+ global::Tizen.NUI.EXaml.EXamlExtensions.RemoveEventsInXaml(eXamlData);
+ global::Tizen.NUI.EXaml.EXamlExtensions.DisposeXamlElements(this);
}
private void UIElementEvent(object sender, EventArgs e)
}
}
+ private string[] stringIndexer;
+ public string[] StringIndexer
+ {
+ get
+ {
+ if (null == stringIndexer)
+ {
+ stringIndexer = new string[1];
+ stringIndexer[0] = "Indexer";
+ }
+
+ return stringIndexer;
+ }
+ set
+ {
+ stringIndexer = value;
+ }
+ }
+
public float FloatP
{
get
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<local:MockBindableForArray
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:sys="clr-namespace:System;assembly=mscorlib"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.XArray">
+ <x:Array Type="{x:Type sys:String}" x:Key="array">
+ <x:String>Hello</x:String>
+ <x:String>World</x:String>
+ </x:Array>
+</local:MockBindableForArray>
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.Binding;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.XArray.xaml",
+ "testcase.public.Xaml.TotalSample.XArray.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.XArray))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [ContentProperty ("Content")]
+ public class MockBindableForArray : View
+ {
+ public object Content { get; set; }
+ }
+
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\XArray.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class XArray : MockBindableForArray
+ {
+ public XArray ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(XArray));
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [Test]
+ public void SupportsXArray ()
+ {
+ var layout = new XArray ();
+ var array = layout.Content;
+ Assert.NotNull (array);
+ Assert.That (array, Is.TypeOf<string[]> ());
+ Assert.AreEqual (2, ((string[])layout.Content).Length);
+ Assert.AreEqual ("Hello", ((string[])layout.Content) [0]);
+ Assert.AreEqual ("World", ((string[])layout.Content) [1]);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View
+ xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ x:Class="Tizen.NUI.Devel.Tests.XReference">
+
+ <View>
+ <TextLabel x:Name="label0" Text="foo" BindingContext="{x:Reference label1}"/>
+ <TextLabel x:Name="label1" Text="bar" BindingContext="{x:Reference label0}"/>
+ <TextField x:Name="entry" Text="{Binding Text, Source={x:Reference label0}}" PlaceholderText="{Binding Text, Source={x:Reference label1}}"/>
+
+ <!-- <ListView x:Name="listView">
+ <ListView.ItemTemplate>
+ <DataTemplate>
+ <ViewCell>
+ <StackLayout>
+ <Label x:Name="foo" BindingContext="{x:Reference bar}"/>
+ <Label x:Name="bar" BindingContext="{x:Reference foo}"/>
+ </StackLayout>
+ </ViewCell>
+ </DataTemplate>
+ </ListView.ItemTemplate>
+ </ListView>-->
+ </View>
+</View>
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.XReference.xaml",
+ "testcase.public.Xaml.TotalSample.XReference.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.XReference))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\XReference.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class XReference : View
+ {
+ public TextLabel label0;
+ public TextLabel label1;
+ public TextField entry;
+
+ public XReference ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(XReference));
+
+ label0 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label0");
+ label1 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "label1");
+ entry = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextField>(this, "entry");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ [Test]
+ public void XReferenceAsBindingSource ()
+ {
+ var layout = new XReference ();
+
+ Assert.AreEqual ("foo", layout.entry.Text);
+ Assert.AreEqual ("bar", layout.entry.PlaceholderText);
+ }
+
+ [Test]
+ public void CrossXReference ()
+ {
+ var layout = new XReference ();
+
+ Assert.AreSame (layout.label0, layout.label1.BindingContext);
+ Assert.AreSame (layout.label1, layout.label0.BindingContext);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.XStatic">
+
+ <View>
+ <TextLabel x:Name="staticproperty"
+ Text="{x:Static Member=local:MockxStatic.MockStaticProperty}" />
+ <TextLabel x:Name="memberisoptional"
+ Text="{x:Static local:MockxStatic.MockStaticProperty}" />
+ <TextLabel x:Name="color"
+ TextColor="{x:Static local:MockxStatic.BackgroundColor}" />
+ <TextLabel x:Name="constant"
+ Text="{x:Static local:MockxStatic.MockConstant}"/>
+ <TextLabel x:Name="field"
+ Text="{x:Static local:MockxStatic.MockField}"/>
+ <TextLabel x:Name="field2"
+ Text="{x:Static local:MockxStatic.MockFieldRef}" />
+ <TextLabel x:Name="nestedField"
+ Text="{x:Static local:MockxStatic+Nested.Foo}" />
+ </View>
+</View>
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.XStatic.xaml",
+ "testcase.public.Xaml.TotalSample.XStatic.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.XStatic))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+
+ public class Icons
+ {
+ public const string CLOSE = "ic_close.png";
+ }
+
+ public class MockxStatic
+ {
+ public static string MockStaticProperty { get { return "Property"; } }
+ public const string MockConstant = "Constant";
+ public static string MockField = "Field";
+ public static string MockFieldRef = Icons.CLOSE;
+ public string InstanceProperty { get { return "InstanceProperty"; } }
+ public static readonly Color BackgroundColor = Color.Fuchsia;
+
+ public class Nested {
+ public static string Foo = "FOO";
+ }
+ }
+
+ public enum MockEnum : long
+ {
+ First,
+ Second,
+ Third,
+ }
+
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\XStatic.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class XStatic : View
+ {
+ public TextLabel staticproperty;
+ public TextLabel memberisoptional;
+ public TextLabel color;
+ public TextLabel constant;
+ public TextLabel field;
+ public TextLabel field2;
+ public TextLabel nestedField;
+
+
+ public XStatic ()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(XStatic));
+ staticproperty = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "staticproperty");
+ memberisoptional = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "memberisoptional");
+ color = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "color");
+ constant = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "constant");
+ field = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "field");
+ field2 = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "field2");
+ nestedField = global::Tizen.NUI.Binding.NameScopeExtensions.FindByName<TextLabel>(this, "nestedField");
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ //{x:Static Member=prefix:typeName.staticMemberName}
+ //{x:Static prefix:typeName.staticMemberName}
+
+ //The code entity that is referenced must be one of the following:
+ // - A constant
+ // - A static property
+ // - A field
+ // - An enumeration value
+ // All other cases should throw
+
+ [SetUp]
+ public void Setup()
+ {
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void StaticProperty ()
+ {
+ var layout = new XStatic ();
+ Assert.AreEqual ("Property", layout.staticproperty.Text);
+ }
+
+ [Test]
+ public void MemberOptional ()
+ {
+ var layout = new XStatic ();
+ Assert.AreEqual ("Property", layout.memberisoptional.Text);
+ }
+
+ [Test]
+ public void FieldColor ()
+ {
+ var layout = new XStatic ();
+ Assert.AreEqual (Color.Fuchsia, layout.color.TextColor);
+ }
+
+ [Test]
+ public void Constant()
+ {
+ var layout = new XStatic();
+ Assert.AreEqual("Constant", layout.constant.Text);
+ }
+
+ [Test]
+ public void Field()
+ {
+ var layout = new XStatic();
+ Assert.AreEqual("Field", layout.field.Text);
+ }
+
+ [Test]
+ public void FieldRef()
+ {
+ var layout = new XStatic();
+ Assert.AreEqual("ic_close.png", layout.field2.Text);
+ }
+
+
+ [Test]
+ // https://bugzilla.xamarin.com/show_bug.cgi?id=55096
+ public void xStaticAndNestedClasses()
+ {
+ var layout = new XStatic();
+ Assert.AreEqual(MockxStatic.Nested.Foo, layout.nestedField.Text);
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<View xmlns="http://tizen.org/Tizen.NUI/2018/XAML"
+ xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
+ xmlns:local="clr-namespace:Tizen.NUI.Devel.Tests;assembly=Tizen.NUI.Devel.Tests"
+ x:Class="Tizen.NUI.Devel.Tests.XStaticException">
+ <TextLabel x:Name="shouldThrow"
+ Text="{x:Static Member=local:MockxStatic.InstanceProperty}" />
+</View>
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding.Internals;
+using Tizen.NUI.Xaml;
+
+[assembly: XamlResourceId("Tizen.NUI.Devel.Tests.testcase.public.Xaml.TotalSample.XStaticException.xaml",
+ "testcase.public.Xaml.TotalSample.XStaticException.xaml",
+ typeof(global::Tizen.NUI.Devel.Tests.XStaticException))]
+
+namespace Tizen.NUI.Devel.Tests
+{
+ [XamlFilePath("testcase\\public\\Xaml\\TotalSample\\XStaticException.xaml")]
+ [XamlCompilation(XamlCompilationOptions.Skip)]
+ public partial class XStaticException : View
+ {
+ public XStaticException()
+ {
+ global::Tizen.NUI.Xaml.Extensions.LoadFromXaml(this, typeof(XStaticException));
+ }
+
+ [TestFixture]
+ public class Tests
+ {
+ //{x:Static Member=prefix:typeName.staticMemberName}
+ //{x:Static prefix:typeName.staticMemberName}
+
+ //The code entity that is referenced must be one of the following:
+ // - A constant
+ // - A static property
+ // - A field
+ // - An enumeration value
+ // All other cases should throw
+
+ [SetUp]
+ public void Setup()
+ {
+
+ //there's a test not resetting the values correctly, but can't find which one...
+#pragma warning disable 0618
+ ResourceLoader.ExceptionHandler = null;
+ Xaml.Internals.XamlLoader.DoNotThrowOnExceptions = false;
+#pragma warning restore 0618
+ }
+
+ [TearDown]
+ public void TearDown()
+ {
+ }
+
+ [Test]
+ public void ThrowOnInstanceProperty()
+ {
+ Assert.Throws<XamlParseException>(() => new XStaticException());
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using global::System;
+using Tizen.NUI.Components;
+using Tizen.NUI.BaseComponents;
+using System.Collections.Generic;
+using Tizen.NUI.Binding;
+using NUnit.Framework;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ internal class CustomBindableObject : BindableObject
+ {
+ /// <summary> Bindable property of SizeWidth. Please do not open it. </summary>
+ public static readonly BindableProperty SizeWidthProperty = BindableProperty.Create("SizeWidth", typeof(float?), typeof(CustomBindableObject), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ if (bindable is CustomBindableObject bindableObject)
+ {
+ bindableObject.size = new Size((float)newValue, 0);
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ if (bindable is CustomBindableObject bindableObject)
+ {
+ return bindableObject.size.Width;
+ }
+ else
+ {
+ return null;
+ }
+ });
+
+ /// <summary> Bindable property of SizeWidth. Please do not open it. </summary>
+ public static readonly BindableProperty SizeProperty = BindableProperty.Create("Size", typeof(Size), typeof(CustomBindableObject), null, propertyChanged: (bindable, oldValue, newValue) =>
+ {
+ if (bindable is CustomBindableObject bindableObject)
+ {
+ bindableObject.size = newValue as Size;
+ }
+ },
+ defaultValueCreator: (bindable) =>
+ {
+ if (bindable is CustomBindableObject bindableObject)
+ {
+ return bindableObject.size;
+ }
+ else
+ {
+ return null;
+ }
+ });
+
+ private Size size;
+ }
+
+ [TestFixture]
+ [Description("public/Xaml")]
+ public class TSBindableObject
+ {
+ private const string tag = "NUITEST";
+ private string path = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "index.xml";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObject CopyFrom.")]
+ [Property("SPEC", "Tizen.NUI.XamlBinding.BindableObject.CopyFrom M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "xiaohui.fang@samsung.com")]
+ public void CopyFrom()
+ {
+ tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPath START");
+
+ using (View view = new View())
+ {
+ Assert.IsNotNull(view, "Create View failed");
+ try
+ {
+ var viewTo = new View();
+ //viewTo.CopyFrom(view);
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception: Failed!");
+ }
+
+ view.Dispose();
+ }
+
+ tlog.Debug(tag, $"CopyFrom END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObject ClearValue.")]
+ [Property("SPEC", "Tizen.NUI.XamlBinding.BindableObject.ClearValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "xiaohui.fang@samsung.com")]
+ public void ClearValue()
+ {
+ tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPath START");
+
+ try
+ {
+ CustomBindableObject customBindableObject = new CustomBindableObject();
+ Assert.IsNotNull(customBindableObject, "Create object failed");
+
+ customBindableObject.ClearValue(CustomBindableObject.SizeProperty, true);
+
+ var key = new BindablePropertyKey(CustomBindableObject.SizeProperty);
+ customBindableObject.ClearValue(key);
+
+ var size = new Size(300, 200);
+
+ customBindableObject.IsBinded = true;
+ customBindableObject.SetValue(CustomBindableObject.SizeProperty, size);
+ customBindableObject.SetValue(CustomBindableObject.SizeWidthProperty, 100);
+
+ customBindableObject.ClearValue(CustomBindableObject.SizeProperty);
+
+ size.Dispose();
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception: Failed!");
+ }
+
+ tlog.Debug(tag, $"ClearValue END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObject IsSet.")]
+ [Property("SPEC", "Tizen.NUI.XamlBinding.BindableObject.IsSet M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "xiaohui.fang@samsung.com")]
+ public void IsSet()
+ {
+ tlog.Debug(tag, $"IsSet START");
+
+ using (View view = new View())
+ {
+ Assert.IsNotNull(view, "Create View failed");
+ try
+ {
+ bool isSet = view.IsSet(View.PositionProperty);
+ Assert.AreEqual(false, isSet, "Should be false");
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception: Failed!");
+ }
+
+ view.Dispose();
+ }
+
+ tlog.Debug(tag, $"IsSet END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("BindableObject IsSet.")]
+ [Property("SPEC", "Tizen.NUI.XamlBinding.BindableObject.IsSet M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "xiaohui.fang@samsung.com")]
+ public void IsSet2()
+ {
+ tlog.Debug(tag, $"IsSet2 START");
+ View view = new View();
+ Assert.Throws<ArgumentNullException>(() => view.IsSet(null));
+
+ tlog.Debug(tag, $"IsSet2 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObject RemoveBinding.")]
+ [Property("SPEC", "Tizen.NUI.XamlBinding.BindableObject.RemoveBinding M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "xiaohui.fang@samsung.com")]
+ public void RemoveBinding()
+ {
+ tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPath START");
+
+ using (View view = new View())
+ {
+ Assert.IsNotNull(view, "Create View failed");
+ try
+ {
+ view.RemoveBinding(View.PositionProperty);
+
+ Binding.Binding binding = new Binding.Binding();
+ view.SetBinding(View.PositionProperty, binding);
+
+ view.RemoveBinding(View.PositionProperty);
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception: Failed!");
+ }
+
+ view.Dispose();
+ }
+
+ tlog.Debug(tag, $"RemoveBinding END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObject RemoveBinding.")]
+ [Property("SPEC", "Tizen.NUI.XamlBinding.BindableObject.SetValue M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "xiaohui.fang@samsung.com")]
+ public void BindableObjectSetValueWithBindablePropertyKey()
+ {
+ tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPath START");
+
+ using (View view = new View())
+ {
+ Assert.IsNotNull(view, "Create View failed");
+ try
+ {
+ var pos = new Position(1, 2);
+ var key = new BindablePropertyKey(View.PositionProperty);
+ view.SetValue(key, pos);
+ Assert.AreEqual(pos, view.Position, "Should be equal");
+
+ pos.Dispose();
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception: Failed!");
+ }
+
+ view.Dispose();
+ }
+
+ tlog.Debug(tag, $"SetValue END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObject GetValues.")]
+ [Property("SPEC", "Tizen.NUI.XamlBinding.BindableObject.GetValues M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ [Property("AUTHOR", "xiaohui.fang@samsung.com")]
+ public void BindableObjectGetValues()
+ {
+ tlog.Debug(tag, $"EXamlExtensionsLoadFromEXamlPath START");
+
+ try
+ {
+ var pos = new Position(1, 2);
+
+ {
+ View view = new View();
+ view.Position = pos;
+
+ var values = view.GetValues(View.PositionXProperty, View.PositionYProperty);
+ Assert.AreEqual(1.0f, (float)values[0], "Should be equal");
+ Assert.AreEqual(2.0f, (float)values[1], "Should be equal");
+
+ values = view.GetValues(View.PositionXProperty, View.PositionYProperty);
+ Assert.AreEqual(1.0f, (float)values[0], "Should be equal");
+ Assert.AreEqual(2.0f, (float)values[1], "Should be equal");
+
+ view.Dispose();
+ }
+
+ {
+ View view = new View();
+ view.Position = pos;
+
+ var values = view.GetValues(View.PositionXProperty, View.PositionYProperty, View.PositionZProperty);
+ Assert.AreEqual(1.0f, (float)values[0], "Should be equal");
+ Assert.AreEqual(2.0f, (float)values[1], "Should be equal");
+ Assert.AreEqual(0.0f, (float)values[2], "Should be equal");
+
+ values = view.GetValues(View.PositionXProperty, View.PositionYProperty, View.PositionZProperty);
+ Assert.AreEqual(1.0f, (float)values[0], "Should be equal");
+ Assert.AreEqual(2.0f, (float)values[1], "Should be equal");
+ Assert.AreEqual(0.0f, (float)values[2], "Should be equal");
+
+ view.Dispose();
+ }
+
+ {
+ View view = new View();
+ view.Position = pos;
+
+ var values = view.GetValues(new BindableProperty[] { View.PositionXProperty, View.PositionYProperty });
+ Assert.AreEqual(1.0f, (float)values[0], "Should be equal");
+ Assert.AreEqual(2.0f, (float)values[1], "Should be equal");
+
+ values = view.GetValues(new BindableProperty[] { View.PositionXProperty, View.PositionYProperty });
+ Assert.AreEqual(1.0f, (float)values[0], "Should be equal");
+ Assert.AreEqual(2.0f, (float)values[1], "Should be equal");
+
+ view.Dispose();
+ }
+
+ pos.Dispose();
+ }
+ catch (Exception e)
+ {
+ tlog.Debug(tag, e.Message.ToString());
+ Assert.Fail("Caught Exception: Failed!");
+ }
+
+ tlog.Debug(tag, $"GetValues END");
+ }
+ }
+}
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/XamlBinding/BindableObjectExtensions")]
+ internal class PublicBindableObjectExtensionsTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObjectExtensions SetBinding")]
+ [Property("SPEC", "Tizen.NUI.Binding.BindableObjectExtensions.SetBinding M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SetBindingTest1()
+ {
+ tlog.Debug(tag, $"SetBindingTest1 START");
+ try
+ {
+ var view = new View();
+ BindableObjectExtensions.SetBinding(view, View.FocusableProperty, "Focusable");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"SetBindingTest1 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("BindableObjectExtensions SetBinding")]
+ [Property("SPEC", "Tizen.NUI.Binding.BindableObjectExtensions.SetBinding M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SetBindingTest2()
+ {
+ tlog.Debug(tag, $"SetBindingTest2 START");
+
+ var view = new View();
+ Assert.Throws<ArgumentNullException>(() => BindableObjectExtensions.SetBinding(null, View.FocusableProperty, "Focusable"));
+ Assert.Throws<ArgumentNullException>(() => BindableObjectExtensions.SetBinding(view, null, "Focusable"));
+
+ tlog.Debug(tag, $"SetBindingTest2 END");
+ }
+ }
+}
\ No newline at end of file
Assert.Throws<ArgumentNullException>(() => re.GetHandlerTypeForObject(null));
tlog.Debug(tag, $"RegisterTest2 END");
}
+
+ [Test]
+ [Category("P1")]
+ [Description("Registrar GetHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.Registrar<TRegistrable>.GetHandler M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetHandlerTest()
+ {
+ tlog.Debug(tag, $"GetHandlerTest START");
+ try
+ {
+ var re = new Registrar<View>();
+ re.Register(typeof(View), typeof(View));
+ var ret = re.GetHandler(typeof(View));
+ Assert.IsNotNull(ret, "Should not be null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"GetHandlerTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Registrar GetHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.Registrar<TRegistrable>.GetHandler M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetHandlerTest2()
+ {
+ tlog.Debug(tag, $"GetHandlerTest2 START");
+ try
+ {
+ var re = new Registrar<View>();
+ re.Register(typeof(View), typeof(View));
+
+ var ret = re.GetHandler(typeof(View), new object[] { "" });
+ //Assert.IsNull(ret, "Should be null");
+ }
+ catch (MissingMethodException e)
+ {
+ Assert.True(true, "Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"GetHandlerTest2 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Registrar GetHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.Registrar<TRegistrable>.GetHandler M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetHandlerTest3()
+ {
+ tlog.Debug(tag, $"GetHandlerTest3 START");
+ try
+ {
+ var re = new Registrar<View>();
+ re.Register(typeof(View), typeof(View));
+
+ var ret = re.GetHandler<View>(typeof(View));
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"GetHandlerTest3 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("Registrar GetHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.Registrar<TRegistrable>.GetHandler M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetHandlerTest4()
+ {
+ tlog.Debug(tag, $"GetHandlerTest4 START");
+ try
+ {
+ var re = new Registrar<View>();
+ re.Register(typeof(View), typeof(View));
+
+ var ret = re.GetHandler<View>(typeof(View), new object[] { "" });
+ //Assert.IsNull(ret, "Should be null");
+ }
+ catch (MissingMethodException e)
+ {
+ Assert.True(true, "Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"GetHandlerTest4 END");
+ }
+
+
+ [Test]
+ [Category("P1")]
+ [Description("Registrar GetHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.Registrar<TRegistrable>.GetHandlerForObject<TOut> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetHandlerForObjectTest()
+ {
+ tlog.Debug(tag, $"GetHandlerForObjectTest START");
+ try
+ {
+ var re = new Registrar<View>();
+ var ret = re.GetHandlerForObject<View>(new View());
+ Assert.IsNull(ret, "Should be null");
+
+ ret = re.GetHandlerForObject<View>(new View(), new object[] { "" });
+ Assert.IsNull(ret, "Should be null");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"GetHandlerForObjectTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Registrar GetHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.Registrar<TRegistrable>.GetHandlerForObject<TOut> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetHandlerForObjectTest2()
+ {
+ tlog.Debug(tag, $"GetHandlerForObjectTest2 START");
+ try
+ {
+ var re = new Registrar<View>();
+ var ret = re.GetHandlerForObject<View>(new View());
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"GetHandlerForObjectTest2 END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("Registrar GetHandler")]
+ [Property("SPEC", "Tizen.NUI.Binding.Registrar<TRegistrable>.GetHandlerForObject<TOut> M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void GetHandlerForObjectTest3()
+ {
+ tlog.Debug(tag, $"GetHandlerForObjectTest3 START");
+ try{
+ var re = new Registrar<View>();
+ var ret = re.GetHandlerForObject<View>(new View(), new object[] { "" });
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"GetHandlerForObjectTest3 END");
+ }
}
}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using static Tizen.NUI.Binding.TriggerBase;
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/XamlBinding/TriggerBase")]
+ internal class PublicSealedListTest
+ {
+ private const string tag = "NUITEST";
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SealedList SealedList")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList<T>.SealedList C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TriggerConstructor()
+ {
+ tlog.Debug(tag, $"TriggerConstructor START");
+
+ try
+ {
+ var sl = new SealedList<int>();
+
+ Assert.IsNotNull(sl, "null SealedList");
+ Assert.IsInstanceOf<SealedList<int>>(sl, "Should return SealedList instance.");
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+
+ tlog.Debug(tag, $"TriggerConstructor END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SealedList Add")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SealedListAddTest()
+ {
+ tlog.Debug(tag, $"SealedListAddTest START");
+ try
+ {
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.Add(1);
+ }
+ catch(Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"SealedListAddTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList Add")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.Add M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SealedListAddTest2()
+ {
+ tlog.Debug(tag, $"SealedListAddTest2 START");
+ var sl = new SealedList<int>();
+
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.IsReadOnly = true;
+ Assert.Throws<InvalidOperationException>(() => sl.Add(1));
+
+ tlog.Debug(tag, $"SealedListAddTest2 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SealedList Add")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.Clear M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SealedListClearTest()
+ {
+ tlog.Debug(tag, $"SealedListAddTest START");
+ try
+ {
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.Clear();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"SealedListAddTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList Clear")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.Clear M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SealedListClearTest2()
+ {
+ tlog.Debug(tag, $"SealedListClearTest2 START");
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.IsReadOnly = true;
+ Assert.Throws<InvalidOperationException>(() => sl.Clear());
+ tlog.Debug(tag, $"SealedListClearTest2 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("SealedList Contains")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.Contains M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void SealedListContainsTest()
+ {
+ tlog.Debug(tag, $"SealedListContainsTest START");
+ try
+ {
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.Add(1);
+ var ret = sl.Contains(1);
+ Assert.AreEqual(true, ret, "Should be equal");
+
+ int[] ia= new int[] { 1, 2, 3 };
+ sl.CopyTo(ia, 0);
+
+ var ret2 = sl.GetEnumerator();
+ var ret3 = sl.IndexOf(1);
+ sl.Insert(0, 2);
+ var ret4 = sl[1];
+ sl.Remove(1);
+
+ sl.Insert(0, 3);
+ sl.RemoveAt(0);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"SealedListContainsTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList IsFixedSize")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.IsFixedSize A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ public void SealedListIsFixedSizeTest()
+ {
+ tlog.Debug(tag, $"SealedListIsFixedSizeTest START");
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ bool bl;
+ Assert.Throws<NotImplementedException>(() => bl = sl.IsFixedSize);
+ tlog.Debug(tag, $"SealedListIsFixedSizeTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList IsSynchronized")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.IsSynchronized A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ public void SealedListIsSynchronizedTest()
+ {
+ tlog.Debug(tag, $"SealedListIsSynchronizedTest START");
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ bool bl;
+ Assert.Throws<NotImplementedException>(() => bl = sl.IsSynchronized);
+ tlog.Debug(tag, $"SealedListIsSynchronizedTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList SyncRoot")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.SyncRoot A")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "PRO")]
+ public void SealedListSyncRootTest()
+ {
+ tlog.Debug(tag, $"SealedListSyncRootTest START");
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ object bl;
+ Assert.Throws<NotImplementedException>(() => bl = sl.SyncRoot);
+ tlog.Debug(tag, $"SealedListSyncRootTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList RemoveAt")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.RemoveAt M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void SealedListRemoveAtTest()
+ {
+ tlog.Debug(tag, $"SealedListRemoveAtTest START");
+
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.Add(1);
+ sl.IsReadOnly = true;
+ Assert.Throws<InvalidOperationException>(() => sl.RemoveAt(0));
+
+ tlog.Debug(tag, $"SealedListRemoveAtTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList this[]")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.this[] M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void SealedListThisTest()
+ {
+ tlog.Debug(tag, $"SealedListThisTest START");
+
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.Add(1);
+ sl.IsReadOnly = true;
+ var i = sl[0];
+ Assert.Throws<InvalidOperationException>(() => sl[0] = 2);
+
+ tlog.Debug(tag, $"SealedListThisTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList Insert")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.Insert M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SealedListInsertTest()
+ {
+ tlog.Debug(tag, $"SealedListInsertTest START");
+
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.Add(1);
+ sl.IsReadOnly = true;
+ int i;
+ Assert.Throws<InvalidOperationException>(() => sl.Insert(0, 2));
+ tlog.Debug(tag, $"SealedListInsertTest END");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("SealedList Remove")]
+ [Property("SPEC", "Tizen.NUI.Binding.Trigger.SealedList.Remove M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void SealedListRemoveTest()
+ {
+ tlog.Debug(tag, $"SealedListRemoveTest START");
+
+ var sl = new SealedList<int>();
+ Assert.IsNotNull(sl, "null SealedList");
+ sl.Add(1);
+ sl.IsReadOnly = true;
+ int i;
+ Assert.Throws<InvalidOperationException>(() => sl.Remove(1));
+ tlog.Debug(tag, $"SealedListRemoveTest END");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+using NUnit.Framework;
+using System;
+using Tizen.NUI.Binding;
+using Tizen.NUI.Xaml;
+
+namespace Tizen.NUI.Devel.Tests
+{
+ using tlog = Tizen.Log;
+
+ [TestFixture]
+ [Description("public/XamlBinding/TypeConverter")]
+ internal class PublicTypeConverterTest
+ {
+ private const string tag = "NUITEST";
+
+ internal class MyTypeConverter : TypeConverter
+ {
+ }
+
+ [SetUp]
+ public void Init()
+ {
+ tlog.Info(tag, "Init() is called!");
+ }
+
+ [TearDown]
+ public void Destroy()
+ {
+ tlog.Info(tag, "Destroy() is called!");
+ }
+
+ [Test]
+ [Category("P2")]
+ [Description("TypeConverter CanConvertFrom")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypeConverter.CanConvertFrom M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void CanConvertFromTest1()
+ {
+ tlog.Debug(tag, $"CanConvertFromTest1 START");
+ MyTypeConverter tc = new MyTypeConverter();
+ Assert.IsNotNull(tc, "null TypeConverter");
+ Assert.Throws<ArgumentNullException>(() => tc.CanConvertFrom(null));
+
+ tlog.Debug(tag, $"CanConvertFromTest1 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TypeConverter ConvertFrom")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypeConverter.ConvertFrom M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ConvertFromTest1()
+ {
+ tlog.Debug(tag, $"ConvertFromTest1 START");
+
+ MyTypeConverter tc = new MyTypeConverter();
+ Assert.IsNotNull(tc, "null TypeConverter");
+ var ret = tc.ConvertFrom(null);
+ Assert.IsNull(ret, "Should be null");
+
+ ret = tc.ConvertFrom(null, null);
+ Assert.IsNull(ret, "Should be null");
+ tlog.Debug(tag, $"ConvertFromTest1 END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("ImageTypeConverter ConvertFromInvariantString")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypeConverter.ConvertFromInvariantString M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MR")]
+ public void ConvertFromInvariantStringTestc()
+ {
+ tlog.Debug(tag, $"ConvertFromInvariantStringTestc START");
+ MyTypeConverter tc = new MyTypeConverter();
+ Assert.IsNotNull(tc, "null TypeConverter");
+ var ret1 = tc.ConvertFromInvariantString(null);
+ Assert.IsNull(ret1, "Should be null");
+
+ ret1 = tc.ConvertToString(null);
+ Assert.IsNull(ret1, "Should be null");
+
+ tlog.Debug(tag, $"ConvertFromInvariantStringTestc END");
+ }
+
+ }
+}
\ No newline at end of file
using NUnit.Framework;
using System;
+using Tizen.NUI.BaseComponents;
using Tizen.NUI.Binding;
+using Tizen.NUI.Binding.Internals;
using Tizen.NUI.Xaml;
namespace Tizen.NUI.Devel.Tests
{
private const string tag = "NUITEST";
+ internal class MyTypedBindingBase : TypedBindingBase
+ {
+ internal override BindingBase Clone()
+ {
+ return null;
+ }
+ }
+
[SetUp]
public void Init()
{
[Test]
[Category("P1")]
- [Description("TypedBinding Mode")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.Mode A")]
+ [Description("TypedBindingBase Converter")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBindingBase.Converter A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRW")]
- public void ModeTest()
+ public void ConverterTest()
{
- tlog.Debug(tag, $"ModeTest START");
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- Assert.IsInstanceOf<Binding.Binding>(t2, "Should return TypedBinding instance.");
- var ret = t2.Mode;
- Assert.AreEqual(BindingMode.Default, ret, "Should be equal");
+ tlog.Debug(tag, $"ConverterTest START");
+ MyTypedBindingBase mt = new MyTypedBindingBase();
+ Assert.IsNotNull(mt, "null Binding");
+ var ret = mt.Converter;
+ mt.Converter = ret;
+ Assert.AreEqual(ret, mt.Converter, "Should be equal");
- tlog.Debug(tag, $"ModeTest END");
+ tlog.Debug(tag, $"ConverterTest END");
}
[Test]
[Category("P1")]
- [Description("TypedBinding StringFormat")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.StringFormat A")]
+ [Description("TypedBindingBase ConverterParameter")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBindingBase.ConverterParameter A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRW")]
- public void StringFormatTest()
+ public void ConverterParameterTest()
{
- tlog.Debug(tag, $"StringFormatTest START");
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- Assert.IsInstanceOf<Binding.Binding>(t2, "Should return TypedBinding instance.");
+ tlog.Debug(tag, $"ConverterParameterTest START");
+ MyTypedBindingBase mt = new MyTypedBindingBase();
+ Assert.IsNotNull(mt, "null Binding");
+ var ret = mt.ConverterParameter;
+ mt.ConverterParameter = ret;
+ Assert.AreEqual(ret, mt.ConverterParameter, "Should be equal");
- var ret = t2.StringFormat;
- Assert.IsNull(ret, "null StringFormat");
-
- tlog.Debug(tag, $"StringFormatTest END");
+ tlog.Debug(tag, $"ConverterParameterTest END");
}
[Test]
[Category("P1")]
- [Description("TypedBinding TargetNullValue")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.TargetNullValue A")]
+ [Description("TypedBindingBase Source")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBindingBase.Source A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRW")]
- public void TargetNullValueTest()
+ public void SourceTest()
{
- tlog.Debug(tag, $"TargetNullValueTest START");
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- Assert.IsInstanceOf<Binding.Binding>(t2, "Should return Binding instance.");
-
- var ret = t2.TargetNullValue;
- Assert.IsNull(ret, "null TargetNullValue");
+ tlog.Debug(tag, $"SourceTest START");
+ MyTypedBindingBase mt = new MyTypedBindingBase();
+ Assert.IsNotNull(mt, "null Binding");
+ var ret = mt.Source;
+ mt.Source = ret;
+ Assert.AreEqual(ret, mt.Source, "Should be equal");
- tlog.Debug(tag, $"TargetNullValueTest END");
+ tlog.Debug(tag, $"SourceTest END");
}
[Test]
[Category("P1")]
- [Description("TypedBinding FallbackValue")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.FallbackValue A")]
+ [Description("TypedBindingBase UpdateSourceEventName")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBindingBase.UpdateSourceEventName A")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "PRW")]
- public void FallbackValueTest()
+ public void UpdateSourceEventNameTest()
{
- tlog.Debug(tag, $"FallbackValueTest START");
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- Assert.IsInstanceOf<Binding.Binding>(t2, "Should return Binding instance.");
+ tlog.Debug(tag, $"UpdateSourceEventNameTest START");
+ MyTypedBindingBase mt = new MyTypedBindingBase();
+ Assert.IsNotNull(mt, "null Binding");
+ var ret = mt.UpdateSourceEventName;
+ mt.UpdateSourceEventName = ret;
+ Assert.AreEqual(ret, mt.UpdateSourceEventName, "Should be equal");
+
+ tlog.Debug(tag, $"UpdateSourceEventNameTest END");
+ }
- var ret = t2.FallbackValue;
- Assert.IsNull(ret, "null FallbackValue");
+ [Test]
+ [Category("P1")]
+ [Description("TypedBinding<TSource, TProperty> TypedBinding<TSource, TProperty>")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.TypedBinding<TSource, TProperty> C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TypedBindingConstructor()
+ {
+ tlog.Debug(tag, $"TypedBindingConstructor START");
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+ Assert.IsInstanceOf<TypedBinding<View, FocusEffect>>(mt, "Should return TypedBinding instance.");
+ tlog.Debug(tag, $"TypedBindingConstructor END");
+ }
- tlog.Debug(tag, $"FallbackValueTest END");
+ [Test]
+ [Category("P2")]
+ [Description("TypedBinding<TSource, TProperty> TypedBinding<TSource, TProperty>")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.TypedBinding<TSource, TProperty> C")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "CONSTR")]
+ public void TypedBindingConstructor2()
+ {
+ tlog.Debug(tag, $"TypedBindingConstructor2 START");
+ Assert.Throws<ArgumentNullException>(() => new TypedBinding<View, FocusEffect>(null, null, null));
+ tlog.Debug(tag, $"TypedBindingConstructor2 END");
}
[Test]
[Category("P1")]
- [Description("TypedBinding AllowChaining")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.AllowChaining A")]
+ [Description("TypedBinding<TSource, TProperty> Apply")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.Apply M")]
[Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- public void AllowChainingTest()
+ [Property("CRITERIA", "MCST")]
+ public void ApplyTest()
{
- tlog.Debug(tag, $"AllowChainingTest START");
+ tlog.Debug(tag, $"ApplyTest START");
try
{
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- t2.AllowChaining = true;
- Assert.True(t2.AllowChaining, "Should be true");
- t2.AllowChaining = false;
- Assert.False(t2.AllowChaining, "Should be false"); ;
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+
+ mt.Apply();
+ }
+ catch (InvalidOperationException e)
+ {
+ Assert.True(true, "Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"ApplyTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TypedBinding<TSource, TProperty> Apply")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.Apply M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void ApplyTest2()
+ {
+ tlog.Debug(tag, $"ApplyTest2 START");
+ try
+ {
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+
+ mt.Apply(null, new View(), View.FocusableProperty);
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
- tlog.Debug(tag, $"AllowChainingTest END");
+ tlog.Debug(tag, $"ApplyTest2 END");
}
[Test]
[Category("P1")]
- [Description("TypedBinding Context ")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.Context A")]
+ [Description("TypedBinding<TSource, TProperty> Clone")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.Clone M")]
[Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- public void ContextTest()
+ [Property("CRITERIA", "MR")]
+ public void CloneTest()
{
- tlog.Debug(tag, $"ContextTest START");
+ tlog.Debug(tag, $"CloneTest START");
try
{
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- t2.Context = null;
- Assert.IsNull(t2.Context, "Should go here");
-
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+
+ var ret = mt.Clone();
+ Assert.IsNotNull(mt, "null TypedBinding");
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
- tlog.Debug(tag, $"ContextTest END");
+ tlog.Debug(tag, $"CloneTest END");
}
[Test]
[Category("P1")]
- [Description("TypedBinding IsApplied ")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.IsApplied A")]
+ [Description("TypedBinding<TSource, TProperty> GetSourceValue")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.GetSourceValue M")]
[Property("SPEC_URL", "-")]
- [Property("CRITERIA", "PRW")]
- public void IsAppliedTest()
+ [Property("CRITERIA", "MR")]
+ public void GetSourceValueTest()
{
- tlog.Debug(tag, $"ContextTest START");
+ tlog.Debug(tag, $"GetSourceValueTest START");
try
{
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- Assert.IsFalse(t2.IsApplied, "Should be false by default");
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+ var ret = mt.GetSourceValue(new View(), typeof(bool));
+ Assert.IsNotNull(mt, "null TypedBinding");
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
- tlog.Debug(tag, $"ContextTest END");
+ tlog.Debug(tag, $"GetSourceValueTest END");
}
[Test]
[Category("P1")]
- [Description("TypedBinding Apply")]
- [Property("SPEC", "Tizen.NUI.Binding.TypedBinding.Clone M")]
+ [Description("TypedBinding<TSource, TProperty> GetTargetValue")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.GetTargetValue M")]
[Property("SPEC_URL", "-")]
[Property("CRITERIA", "MR")]
- public void CloneTest()
+ public void GetTargetValueTest()
{
- tlog.Debug(tag, $"CloneTest START");
+ tlog.Debug(tag, $"GetTargetValueTest START");
try
{
- Binding.Binding t2 = new Binding.Binding("Test");
- Assert.IsNotNull(t2, "null Binding");
- Binding.Binding c = t2.Clone() as Binding.Binding;
- Assert.IsNotNull(c, "null Binding");
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+
+ var ret = mt.GetTargetValue(new View(), typeof(bool));
+ Assert.IsNotNull(mt, "null TypedBinding");
}
catch (Exception e)
{
Assert.Fail("Caught Exception" + e.ToString());
}
- tlog.Debug(tag, $"CloneTest END");
+ tlog.Debug(tag, $"GetTargetValueTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TypedBinding<TSource, TProperty> Unapply")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.Unapply M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void UnapplyTest()
+ {
+ tlog.Debug(tag, $"UnapplyTest START");
+ try
+ {
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+
+ mt.Unapply();
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"UnapplyTest END");
+ }
+
+ [Test]
+ [Category("P1")]
+ [Description("TypedBinding<TSource, TProperty> ApplyCore")]
+ [Property("SPEC", "Tizen.NUI.Binding.TypedBinding<TSource, TProperty>.ApplyCore M")]
+ [Property("SPEC_URL", "-")]
+ [Property("CRITERIA", "MCST")]
+ public void ApplyCoreTest()
+ {
+ tlog.Debug(tag, $"ApplyCoreTest START");
+ try
+ {
+ Func<View, FocusEffect> getter = (v) => new FocusEffect();
+ var mt = new TypedBinding<View, FocusEffect>(getter, null, null);
+ Assert.IsNotNull(mt, "null TypedBinding");
+
+ mt.ApplyCore(new View(), new View(), View.FocusableProperty);
+ }
+ catch (Exception e)
+ {
+ Assert.Fail("Caught Exception" + e.ToString());
+ }
+ tlog.Debug(tag, $"ApplyCoreTest END");
}
+
}
}
\ No newline at end of file