public void Image_GET_VALUE_After_Set_ResourceUrl() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); string resultUrl1 = ""; PropertyMap map1 = testView.Image; bool ret1 = (map1.Find(ImageVisualProperty.URL)?.Get(out resultUrl1) ?? false) && string.IsNullOrEmpty(resultUrl1); Assert.AreEqual(false, ret1, "map don't have ResourceUrl"); // Note : Current version of ANIMATED_IMAGE Visual works well only ResourceUrl's suffix is *.gif or *.webp string testUrl1 = "test1.gif"; testView.ResourceUrl = testUrl1; PropertyMap map2 = testView.Image; bool ret2 = (map2.Find(ImageVisualProperty.URL)?.Get(out resultUrl1) ?? false) && !string.IsNullOrEmpty(resultUrl1); Assert.AreEqual(true, ret2, "map must have ResourceUrl"); Assert.AreEqual(testUrl1, resultUrl1, "...and That value must be equal what we added"); testView.Dispose(); }
public void AnimatedImageViewCurrentFrame() { tlog.Debug(tag, $"AnimatedImageViewCurrentFrame START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); using (PropertyMap map = new PropertyMap()) { map.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)); map.Insert(ImageVisualProperty.URL, new PropertyValue(url)); map.Insert(ImageVisualProperty.Border, new PropertyValue(new Extents(4, 4, 4, 4))); map.Insert(ImageVisualProperty.TotalFrameNumber, new PropertyValue(30)); map.Insert(ImageVisualProperty.CurrentFrameNumber, new PropertyValue(0)); testingTarget.Image = map; try { testingTarget.CurrentFrame = 15; var resutl = testingTarget.CurrentFrame; } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception: Failed!"); } } testingTarget.Dispose(); tlog.Debug(tag, $"AnimatedImageViewCurrentFrame END (OK)"); }
public void AnimatedImageViewConstructor() { tlog.Debug(tag, $"AnimatedImageViewConstructor START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); testingTarget.Dispose(); tlog.Debug(tag, $"AnimatedImageViewConstructor END (OK)"); }
public void ResourceUrl_SET_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); // Note : Current version of ANIMATED_IMAGE Visual works well only ResourceUrl's suffix is *.gif or *.webp string testUrl1 = "test1.gif"; testView.ResourceUrl = testUrl1; Assert.AreEqual(testView.ResourceUrl, testUrl1, "ResourceUrl is not equal"); testView.Dispose(); }
public void NaturalSize2D_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); testView.ResourceUrl = animated_image_path; Size2D result = new Size2D(326, 171); // The size of animated_image_path image. Size2D size = testView.NaturalSize2D; Assert.AreEqual(result.Width, size.Width, "NaturalSize Width is not equal"); Assert.AreEqual(result.Height, size.Height, "NaturalSize Height is not equal"); testView.Dispose(); }
public void TotalFrame_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); int expectedTotalFrame = 15; // The total frame of animated_image_path image Assert.AreEqual(-1, testView.TotalFrame, "Total frame should be -1 when ResourceUrl is not setup"); testView.ResourceUrl = animated_image_path; Assert.AreEqual(expectedTotalFrame, testView.TotalFrame, "Total frame doesn't matched!"); testView.Dispose(); }
public void NaturalSize_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); testView.ResourceUrl = animated_image_path; Vector3 result = new Vector3(326, 171, 0); // The size of animated_image_path image. Vector3 size = testView.NaturalSize; Assert.AreEqual(result.X, size.X, "NaturalSize Width is not equal"); Assert.AreEqual(result.Y, size.Y, "NaturalSize Height is not equal"); testView.Dispose(); }
public void AnimatedImageViewResourceUrl() { tlog.Debug(tag, $"AnimatedImageViewResourceUrl START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); testingTarget.ResourceUrl = url; Assert.AreEqual(url, testingTarget.ResourceUrl, "Should be equal"); testingTarget.Dispose(); tlog.Debug(tag, $"AnimatedImageViewResourceUrl END (OK)"); }
public void AnimatedImageViewStopBehavior() { tlog.Debug(tag, $"AnimatedImageViewStopBehavior START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); testingTarget.StopBehavior = AnimatedImageView.StopBehaviorType.MinimumFrame; Assert.AreEqual(AnimatedImageView.StopBehaviorType.MinimumFrame, testingTarget.StopBehavior, "Should be equal!"); testingTarget.Dispose(); tlog.Debug(tag, $"AnimatedImageViewStopBehavior END (OK)"); }
public void AnimatedImageViewLoopCount() { tlog.Debug(tag, $"AnimatedImageViewLoopCount START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); testingTarget.LoopCount = 3; Assert.AreEqual(3, testingTarget.LoopCount, "Should be equal!"); testingTarget.Dispose(); tlog.Debug(tag, $"AnimatedImageViewLoopCount END (OK)"); }
public void AnimatedImageViewFrameDelay() { tlog.Debug(tag, $"AnimatedImageViewFrameDelay START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); testingTarget.FrameDelay = 300; Assert.AreEqual(300, testingTarget.FrameDelay, "Should be equal!"); testingTarget.Dispose(); tlog.Debug(tag, $"AnimatedImageViewFrameDelay END (OK)"); }
public void NaturalSize_GET_VALUE_as_View_class() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); testView.ResourceUrl = animated_image_path; Vector3 result = new Vector3(326, 171, 0); // The size of animated_image_path image. View testView2 = testView; // Convert class as View. Vector3 size = testView2.NaturalSize; // Check whether virtual ImageView.GetNaturalSize() called well. Assert.AreEqual(result.X, size.X, "NaturalSize Width is not equal"); Assert.AreEqual(result.Y, size.Y, "NaturalSize Height is not equal"); testView.Dispose(); testView2.Dispose(); }
public void StopBehavior_SET_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); testView.ResourceUrl = animated_image_path; testView.StopBehavior = AnimatedImageView.StopBehaviorType.CurrentFrame; Assert.AreEqual(AnimatedImageView.StopBehaviorType.CurrentFrame, testView.StopBehavior, "StopBehavior is not equal"); testView.StopBehavior = AnimatedImageView.StopBehaviorType.MinimumFrame; Assert.AreEqual(AnimatedImageView.StopBehaviorType.MinimumFrame, testView.StopBehavior, "StopBehavior is not equal"); testView.StopBehavior = AnimatedImageView.StopBehaviorType.MaximumFrame; Assert.AreEqual(AnimatedImageView.StopBehaviorType.MaximumFrame, testView.StopBehavior, "StopBehavior is not equal"); testView.Dispose(); }
public void AnimatedImageViewCacheSize() { tlog.Debug(tag, $"AnimatedImageViewCacheSize START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); Assert.AreEqual(1, testingTarget.CacheSize, "Should be equal!"); testingTarget.CacheSize = 2; Assert.AreEqual(2, testingTarget.CacheSize, "Should be equal!"); testingTarget.Dispose(); tlog.Debug(tag, $"AnimatedImageViewCacheSize END (OK)"); }
public void AnimatedImageViewPlay() { tlog.Debug(tag, $"AnimatedImageViewPlay START"); var testingTarget = new AnimatedImageView(); Assert.IsNotNull(testingTarget, "Can't create success object AnimatedImageView"); Assert.IsInstanceOf <AnimatedImageView>(testingTarget, "Should be an instance of AnimatedImageView type."); using (PropertyMap map = new PropertyMap()) { map.Insert(Visual.Property.Type, new PropertyValue((int)Visual.Type.Image)); map.Insert(ImageVisualProperty.URL, new PropertyValue(url)); map.Insert(ImageVisualProperty.AlphaMaskURL, new PropertyValue(url)); map.Insert(ImageVisualProperty.AuxiliaryImageURL, new PropertyValue(url)); map.Insert(ImageVisualProperty.Border, new PropertyValue(new Extents(4, 4, 4, 4))); map.Insert(ImageVisualProperty.TotalFrameNumber, new PropertyValue(30)); map.Insert(ImageVisualProperty.CurrentFrameNumber, new PropertyValue(0)); testingTarget.Image = map; testingTarget.BatchSize = 2; testingTarget.CacheSize = 2; testingTarget.LoopCount = 3; testingTarget.StopBehavior = AnimatedImageView.StopBehaviorType.MinimumFrame; try { testingTarget.Play(); } catch (Exception e) { testingTarget.Dispose(); tlog.Debug(tag, e.Message.ToString()); tlog.Debug(tag, $"AnimatedImageViewPlay END (OK)"); Assert.Pass("Passed!"); } } testingTarget?.Dispose(); tlog.Debug(tag, $"AnimatedImageViewPlay END (OK)"); }
public void LoopCount_SET_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); Assert.AreEqual(-1, testView.LoopCount, "LoopCount should be -1 when ResourceUrl is not setup"); testView.ResourceUrl = animated_image_path; Assert.AreEqual(-1, testView.LoopCount, "LoopCount should be -1 (mean infinite loop) even ResourceUrl is setup"); int expectLoopCount = 3; testView.LoopCount = expectLoopCount; Assert.AreEqual(expectLoopCount, testView.LoopCount, "LoopCount doesn't matched!"); testView.LoopCount++; Assert.AreEqual(expectLoopCount + 1, testView.LoopCount, "LoopCount doesn't matched!"); testView.Dispose(); }
public void CurrentFrame_SET_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); Assert.AreEqual(-1, testView.CurrentFrame, "Current frame should be -1 when ResourceUrl is not setup"); testView.ResourceUrl = animated_image_path; Assert.AreEqual(0, testView.CurrentFrame, "Current frame doesn't matched!"); // Set CurrentFrame will works well only if view is scene on. NUIApplication.GetDefaultWindow().Add(testView); int expectFrame = 3; testView.CurrentFrame = expectFrame; Assert.AreEqual(expectFrame, testView.CurrentFrame, "Current frame doesn't matched!"); testView.Unparent(); testView.Dispose(); }
public void URLs_SET_GET_VALUE() { /* TEST CODE */ AnimatedImageView testView = new AnimatedImageView(); List <string> urls = testView.URLs; urls.Add(image_path); urls.Add(image_path); urls.Add(image_path); // URLs don't have any change notifier. So we have to update property forcely by SetValues API. testView.SetValues(); int expectedTotalFrame = urls.Count; int defaultFrameDelay = 100; ///< It can be changed in dali engine side int expectFrameDelay = 300; Assert.AreEqual(expectedTotalFrame, testView.TotalFrame, "Total frame doesn't matched!"); Assert.AreEqual(defaultFrameDelay, testView.FrameDelay, "Default frame delay doesn't matched!"); testView.FrameDelay = expectFrameDelay; Assert.AreEqual(expectFrameDelay, testView.FrameDelay, "frame delay doesn't matched!"); testView.Dispose(); }