/// <summary> /// Handler for the ManipulationDelta event. It may or may not be a pinch. If it is not a /// pinch, the ViewportControl will take care of it. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void OnManipulationDelta(object sender, ManipulationDeltaEventArgs e) { if (e.PinchManipulation != null) { e.Handled = true; if (!_pinching) { _pinching = true; Point center = e.PinchManipulation.Original.Center; _relativeMidpoint = new Point(center.X / MiniImage.ActualWidth, center.Y / MiniImage.ActualHeight); var xform = MiniImage.TransformToVisual(viewport); _screenMidpoint = xform.Transform(center); } _scale = _originalScale * e.PinchManipulation.CumulativeScale; CoerceScale(false); ResizeImage(false); } else if (_pinching) { _pinching = false; _originalScale = _scale = _coercedScale; } }
public void MiniImageToStringTest() { // Arrange MiniImage miniImage = new MiniImage(); // Act string result = miniImage.ToString(); // Assert Assert.IsTrue(result.Contains("@default")); }
public void MiniImagePropertyTest() { // Arrange string testUrl = "<url to png>"; MiniImage miniImage = new MiniImage(); // Act miniImage.@default = testUrl; // Assert Assert.AreEqual(testUrl, miniImage.@default); }
public override void OnInspectorGUI() { MiniImage image = (MiniImage)target; base.OnInspectorGUI(); if (GUILayout.Button("Change Texture")) { image.ChangeTexture(); } if (GUILayout.Button("Change Reference Texture")) { image.ChangeReferenceTexture(); } }
public void CardListPropertyTest() { // Arrange int cardId = 1000; int baseCardId = 1000; string cardType = "Stronghold"; CardName cardName = new CardName(); CardText cardText = new CardText(); MiniImage miniImage = new MiniImage(); LargeImage largeImage = new LargeImage(); IngameImage ingameImage = new IngameImage(); int hitPoints = 80; List <object> references = new List <object>(); string illustrator = "Forrest Imel"; int? manaCost = 3; int? attack = 2; bool? isBlack = true; string subType = "Accessory"; int? goldCost = 3; bool? isGreen = false; bool? isRed = false; int? armor = 5; bool? isBlue = false; // Act CardList list = new CardList(); list.card_id = cardId; list.base_card_id = baseCardId; list.card_type = cardType; list.card_name = cardName; list.card_text = cardText; list.mini_image = miniImage; list.large_image = largeImage; list.ingame_image = ingameImage; list.hit_points = hitPoints; list.references = references; list.illustrator = illustrator; list.mana_cost = manaCost; list.attack = attack; list.is_black = isBlack; list.sub_type = subType; list.gold_cost = goldCost; list.is_green = isGreen; list.is_red = isRed; list.armor = armor; list.is_blue = isBlue; // Assert Assert.AreEqual(cardId, list.card_id); Assert.AreEqual(baseCardId, list.base_card_id); Assert.AreEqual(cardType, list.card_type); Assert.AreEqual(cardName, list.card_name); Assert.AreEqual(cardText, list.card_text); Assert.AreEqual(miniImage, list.mini_image); Assert.AreEqual(largeImage, list.large_image); Assert.AreEqual(ingameImage, list.ingame_image); Assert.AreEqual(hitPoints, list.hit_points); Assert.AreEqual(references, list.references); Assert.AreEqual(illustrator, list.illustrator); Assert.AreEqual(manaCost, list.mana_cost); Assert.AreEqual(attack, list.attack); Assert.AreEqual(isBlack, list.is_black); Assert.AreEqual(subType, list.sub_type); Assert.AreEqual(goldCost, list.gold_cost); Assert.AreEqual(isGreen, list.is_green); Assert.AreEqual(isRed, list.is_red); Assert.AreEqual(armor, list.armor); Assert.AreEqual(isBlue, list.is_blue); }