public void PropertyMapInsertKeyWithString() { tlog.Debug(tag, $"PropertyMapInsertKeyWithString START"); var testingTarget = new PropertyMap(); Assert.IsNotNull(testingTarget, "should not be null."); Assert.IsInstanceOf <PropertyMap>(testingTarget, "should be an instance of PropertyMap class!"); var dummy = new PropertyValue(14.0f); Assert.IsNotNull(dummy, "should not be null."); Assert.IsInstanceOf <PropertyValue>(dummy, "should be an instance of PropertyValue class!"); testingTarget.Insert("A", dummy); PropertyValue value = testingTarget["A"]; float result = 0; value.Get(out result); Assert.IsTrue(result == 14); dummy.Dispose(); testingTarget.Dispose(); tlog.Debug(tag, $"PropertyMapInsertKeyWithString END (OK)"); }
public void PropertyBufferSetData() { tlog.Debug(tag, $"PropertyBufferSetData START"); PropertyMap buffer = new PropertyMap(); Assert.IsNotNull(buffer, "should be not null"); Assert.IsInstanceOf <PropertyMap>(buffer, "should be an instance of PropertyMap class!"); buffer.Add("aIndex", new PropertyValue((int)PropertyType.Float)); buffer.Add("aValue", new PropertyValue((int)PropertyType.Float)); var testingTarget = new PropertyBuffer(buffer); Assert.IsNotNull(testingTarget, "should be not null"); Assert.IsInstanceOf <PropertyBuffer>(testingTarget, "Should be an instance of PropertyBuffer class!"); try { global::System.IntPtr data = new global::System.IntPtr(); testingTarget.SetData(data, 0); } catch (Exception e) { LogUtils.Write(LogUtils.DEBUG, LogUtils.TAG, "Caught Exception" + e.ToString()); Assert.Fail("Caught Exception" + e.ToString()); } Assert.AreEqual(0, testingTarget.GetSize(), "Should be Equal."); testingTarget.Dispose(); buffer.Dispose(); tlog.Debug(tag, $"PropertyBufferSetData END (OK)"); }
public void PropertyMapFindWithIntAndStringKey() { tlog.Debug(tag, $"PropertyMapFindWithIntAndStringKey START"); var testingTarget = new PropertyMap(); Assert.IsNotNull(testingTarget, "should not be null."); Assert.IsInstanceOf <PropertyMap>(testingTarget, "should be an instance of PropertyMap class!"); var dummy = new PropertyValue("DALI"); Assert.IsNotNull(dummy, "should not be null."); Assert.IsInstanceOf <PropertyValue>(dummy, "should be an instance of PropertyValue class!"); testingTarget.Add("A", dummy); PropertyValue value = testingTarget.Find(10, "A"); string result = ""; value.Get(out result); Assert.AreEqual("DALI", result, "Retrive result should equal to the set value."); dummy.Dispose(); testingTarget.Dispose(); tlog.Debug(tag, $"PropertyMapFindWithIntAndStringKey END (OK)"); }
public void PropertyMapAddWithKeyValue() { tlog.Debug(tag, $"PropertyMapAddWithKeyValue START"); var testingTarget = new PropertyMap(); Assert.IsNotNull(testingTarget, "should not be null."); Assert.IsInstanceOf <PropertyMap>(testingTarget, "should be an instance of PropertyMap class!"); var dummy = new KeyValue(); Assert.IsNotNull(dummy, "should not be null."); Assert.IsInstanceOf <KeyValue>(dummy, "should be an instance of KeyValue class!"); dummy.KeyInt = 300; dummy.SingleValue = 4.0f; testingTarget.Add(dummy); // keyValue.KeyString != null //KeyValue dummy2 = new KeyValue() //{ // KeyString = "myKey" //}; //testingTarget.Add(dummy2); Assert.AreEqual(1, testingTarget.Count(), "Add with string and PropertyValue parameter function does not work"); dummy.Dispose(); //dummy2.Dispose(); testingTarget.Dispose(); tlog.Debug(tag, $"PropertyMapAddWithKeyValue END (OK)"); }
public void SetValues() { if (mDirtyFlag == false) { return; } mDirtyFlag = false; PropertyMap tMap = new PropertyMap(); PropertyValue animatiedImage = new PropertyValue((int)Visual.Type.AnimatedImage); tMap.Insert(Visual.Property.Type, animatiedImage); if (mResourceURLs?.Count != 0) { PropertyArray mArray = new PropertyArray(); PropertyArray returnedArr = new PropertyArray(); PropertyValue index = new PropertyValue(); foreach (var iter in mResourceURLs) { index = new PropertyValue(iter); returnedArr = mArray.Add(index); } index.Dispose(); returnedArr.Dispose(); PropertyValue array = new PropertyValue(mArray); tMap.Insert(ImageVisualProperty.URL, array); PropertyValue batchSize = new PropertyValue(mBatchSize); tMap.Insert(ImageVisualProperty.BatchSize, batchSize); PropertyValue cacheSize = new PropertyValue(mCacheSize); tMap.Insert(ImageVisualProperty.CacheSize, cacheSize); PropertyValue frameDelay = new PropertyValue(mFrameDelay); tMap.Insert(ImageVisualProperty.FrameDelay, frameDelay); PropertyValue loopCount = new PropertyValue(mLoopCount); tMap.Insert(ImageVisualProperty.LoopCount, loopCount); loopCount.Dispose(); frameDelay.Dispose(); cacheSize.Dispose(); batchSize.Dispose(); mArray.Dispose(); array.Dispose(); } else { PropertyValue url = new PropertyValue(mUrl); tMap.Insert(ImageVisualProperty.URL, url); url.Dispose(); } mMap = tMap; PropertyValue map = new PropertyValue(mMap); SetProperty(ImageView.Property.IMAGE, map); map.Dispose(); tMap.Dispose(); animatiedImage.Dispose(); }
public void TextMapHelperGetPlaceholderMap() { tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap START"); var placeholder = new Tizen.NUI.Text.Placeholder() { Text = "placeholder text", TextFocused = "placeholder textFocused", Color = new Color("#45B39D"), FontFamily = "BreezeSans", FontStyle = new Tizen.NUI.Text.FontStyle() { Width = FontWidthType.Expanded, Weight = FontWeightType.Bold, Slant = FontSlantType.Italic, }, PointSize = 25.0f, Ellipsis = true }; string text = ""; string textFocused = ""; Color color = new Color(); string fontFamily = null; var fontStyle = new PropertyMap(); float pointSize; bool ellipsis = false; using (PropertyMap map = TextMapHelper.GetPlaceholderMap(placeholder)) { map.Find(0).Get(out text); map.Find(1).Get(out textFocused); map.Find(2).Get(color); map.Find(3).Get(out fontFamily); map.Find(4).Get(fontStyle); map.Find(5).Get(out pointSize); map.Find(7).Get(out ellipsis); fontStyle.Find(0, "width").Get(out string width); fontStyle.Find(0, "weight").Get(out string weight); fontStyle.Find(0, "slant").Get(out string slant); Assert.AreEqual(text, placeholder.Text, "Should be equal!"); Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!"); Assert.AreEqual(true, CheckColor(color, placeholder.Color), "Should be true!"); Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!"); Assert.AreEqual(width, "expanded", "Should be equal!"); Assert.AreEqual(weight, "bold", "Should be equal!"); Assert.AreEqual(slant, "italic", "Should be equal!"); Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!"); Assert.AreEqual(ellipsis, placeholder.Ellipsis, "Should be equal!"); } color.Dispose(); fontStyle.Dispose(); tlog.Debug(tag, $"TextMapHelperGetPlaceholderMap END (OK)"); }
public void KeyValuePropertyMapValue() { tlog.Debug(tag, $"KeyValuePropertyMapValue START"); PropertyMap b1 = new PropertyMap(); KeyValue a1 = new KeyValue { PropertyMapValue = b1 }; b1 = a1.PropertyMapValue; b1.Dispose(); a1.Dispose(); tlog.Debug(tag, $"KeyValuePropertyMapValue END (OK)"); Assert.Pass("KeyValuePropertyMapValue"); }
public void TextMapHelperGetPlaceholderStruct() { tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct START"); string text = "placeholder text"; string textFocused = "placeholder textFocused"; Color color = new Color("#45B39D"); string fontFamily = "BreezeSans"; var fontStyle = new PropertyMap(); fontStyle.Add("width", "expanded"); fontStyle.Add("weight", "bold"); fontStyle.Add("slant", "italic"); float pointSize = 25.0f; bool ellipsis = false; using (var map = new PropertyMap()) { map.Add(0, text); map.Add(1, textFocused); map.Add(2, color); map.Add(3, fontFamily); map.Add(4, new PropertyValue(fontStyle)); map.Add(5, (float)pointSize); map.Add(7, ellipsis); var placeholder = TextMapHelper.GetPlaceholderStruct(map); Assert.AreEqual(text, placeholder.Text, "Should be equal!"); Assert.AreEqual(textFocused, placeholder.TextFocused, "Should be equal!"); Assert.AreEqual(true, CheckColor(color, placeholder.Color), "Should be true!"); Assert.AreEqual(fontFamily, placeholder.FontFamily, "Should be equal!"); Assert.AreEqual(FontWidthType.Expanded, placeholder.FontStyle?.Width, "Should be equal!"); Assert.AreEqual(FontWeightType.Bold, placeholder.FontStyle?.Weight, "Should be equal!"); Assert.AreEqual(FontSlantType.Italic, placeholder.FontStyle?.Slant, "Should be equal!"); Assert.AreEqual(pointSize, placeholder.PointSize, "Should be equal!"); Assert.AreEqual(ellipsis, false, "Should be equal!"); } color.Dispose(); fontStyle.Dispose(); tlog.Debug(tag, $"TextMapHelperGetPlaceholderStruct END (OK)"); }
public void PropertyMapAddNullKeyValue() { tlog.Debug(tag, $"PropertyMapAddNullKeyValue START"); var testingTarget = new PropertyMap(); Assert.IsNotNull(testingTarget, "should not be null."); Assert.IsInstanceOf <PropertyMap>(testingTarget, "should be an instance of PropertyMap class!"); try { KeyValue dummy = null; testingTarget.Add(dummy); } catch (ArgumentNullException) { testingTarget.Dispose(); tlog.Debug(tag, $"PropertyMapAddNullKeyValue END (OK)"); Assert.Pass("Caught ArgumentNullException : Passed!"); } }