public void CircleHotSpot_DefaultProperties() { CircleHotSpot circle = new CircleHotSpot(); Assert.AreEqual(0, circle.Radius, "Radius"); Assert.AreEqual(0, circle.X, "X-coordinate"); Assert.AreEqual(0, circle.Y, "Y-coordinate"); }
public void HotSpotCollection_Add() { HotSpotCollection spots = new HotSpotCollection(); Assert.AreEqual(0, spots.Count, "BeforeAdd"); CircleHotSpot circle = new CircleHotSpot(); spots.Add(circle); Assert.AreEqual(1, spots.Count, "AfterAdd"); Assert.AreEqual(circle.ToString(), spots[0].ToString(), "AfterAdd"); }
public void CircleHotSpot_GetCoordinates() { CircleHotSpot circle = new CircleHotSpot(); circle.Radius = 20; circle.X = 50; circle.Y = 40; Assert.AreEqual(20, circle.Radius, "BeforeGetCoordinates-Radius"); Assert.AreEqual(50, circle.X, "BeforeGetCoordinates-X"); Assert.AreEqual(40, circle.Y, "BeforeGetCoordinates-Y"); Assert.AreEqual("50,40,20", circle.GetCoordinates(), "AfterGetCoordinates"); }
public void HotSpotCollection_RemoveAt() { HotSpotCollection spots = new HotSpotCollection(); CircleHotSpot circle1 = new CircleHotSpot(); spots.Add(circle1); RectangleHotSpot rect = new RectangleHotSpot(); spots.Add(rect); CircleHotSpot circle2 = new CircleHotSpot(); spots.Add(circle2); Assert.AreEqual(3, spots.Count, "BeforeRemoveAt"); spots.RemoveAt(1); Assert.AreEqual(2, spots.Count, "AfterRemoveAt"); Assert.AreEqual(circle1.ToString(), spots[0].ToString(), "AfterRemoveAt"); Assert.AreEqual(circle2.ToString(), spots[1].ToString(), "AfterRemoveAt"); }
public static void myPageLoad (Page page) { WebTest.CurrentTest.UserData = "Init"; ImageMap imgmap = new ImageMap (); imgmap.ID = "imgmap"; imgmap.HotSpotMode = HotSpotMode.NotSet; imgmap.Click += new ImageMapEventHandler (ImageMapClickHandler2); RectangleHotSpot rect = new RectangleHotSpot (); rect.HotSpotMode = HotSpotMode.PostBack; rect.PostBackValue = "Rectangle"; imgmap.HotSpots.Add (rect); PolygonHotSpot poly = new PolygonHotSpot (); poly.HotSpotMode = HotSpotMode.PostBack; poly.PostBackValue = "Polygon"; imgmap.HotSpots.Add (poly); imgmap.HotSpotMode = HotSpotMode.PostBack; CircleHotSpot circle = new CircleHotSpot (); circle.PostBackValue = "Circle"; imgmap.HotSpots.Add (circle); // Two marks for getting controls from form LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG); LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG); page.Form.Controls.Add (lcb); page.Form.Controls.Add (imgmap); page.Form.Controls.Add (lce); }
public void ImageMap_EventCircle () { PokerImageMap imageMap = new PokerImageMap (); ResetEvents (); imageMap.HotSpotMode = HotSpotMode.NotSet; CircleHotSpot circle = new CircleHotSpot (); circle.HotSpotMode = HotSpotMode.PostBack; circle.PostBackValue = "myCircle"; imageMap.HotSpots.Add (circle); imageMap.Click += new ImageMapEventHandler (ImageMapClickHandler); Assert.AreEqual ("Init", pbValue, "BeforeClick"); imageMap.DoOnClick (new ImageMapEventArgs (circle.PostBackValue)); Assert.AreEqual ("myCircle", pbValue, "AfterClick"); }
public void ImageMap_AssignedValues_RenderDisabled () { // Enabled = false //---------------- PokerImageMap imageMap = new PokerImageMap (); imageMap.Enabled = false; imageMap.HotSpotMode = HotSpotMode.Navigate; imageMap.Target = "Target"; CircleHotSpot circle = new CircleHotSpot (); circle.NavigateUrl = "NavigateURL"; imageMap.HotSpots.Add (circle); string originalHtml = "<img class=\"aspNetDisabled\" src=\"\" usemap=\"#ImageMap\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"circle\" coords=\"0,0,0\" target=\"Target\" title=\"\" alt=\"\" />\r\n</map>"; string renderedHtml = imageMap.Render (); HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "RenderDisabledTextAssigne"); }
public void ImageMap_AssignedValues_RenderNavigateCircle () { // Circle.HotSpotMode = Navigate //------------------------------ PokerImageMap imageMap = new PokerImageMap (); imageMap.Enabled = true; CircleHotSpot circle = new CircleHotSpot (); circle.AccessKey = "A"; circle.AlternateText = "Circle"; circle.HotSpotMode = HotSpotMode.Navigate; circle.NavigateUrl = "NavigateURL"; circle.TabIndex = 1; circle.Radius = 10; circle.X = 30; circle.Y = 40; imageMap.HotSpots.Add (circle); string originalHtml = "<img src=\"\" usemap=\"#ImageMap\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"circle\" coords=\"30,40,10\" href=\"NavigateURL\" title=\"Circle\" alt=\"Circle\" accesskey=\"A\" tabindex=\"1\" />\r\n</map>"; string renderedHtml = imageMap.Render (); HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "RenderNavigateCircleTextAssigned"); }
public void CircleHotSpot_ToString() { CircleHotSpot circle = new CircleHotSpot(); Assert.AreEqual("CircleHotSpot", circle.ToString(), "After-ToString"); }
public void CircleHotSpot_ExpRadius() { // The specified value is less than 0 CircleHotSpot circle = new CircleHotSpot(); circle.Radius = -1; }
public void ImageMap_AssignedValues_RenderNavigate () { // HotSpotMode = Navigate using NavigateURL //----------------------------------------- PokerImageMap imageMap = new PokerImageMap (); imageMap.Enabled = true; imageMap.HotSpotMode = HotSpotMode.Navigate; imageMap.Target = "Target"; CircleHotSpot circle = new CircleHotSpot (); circle.NavigateUrl = "NavigateURL"; imageMap.HotSpots.Add (circle); #if NET_4_0 string originalHtml = "<img src=\"\" usemap=\"#ImageMap\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"circle\" coords=\"0,0,0\" href=\"NavigateURL\" target=\"Target\" title=\"\" alt=\"\" />\r\n</map>"; #else string originalHtml = "<img src=\"\" usemap=\"#ImageMap\" style=\"border-width:0px;\" /><map name=\"ImageMap\" id=\"ImageMap\">\r\n\t<area shape=\"circle\" coords=\"0,0,0\" href=\"NavigateURL\" target=\"Target\" title=\"\" alt=\"\" />\r\n</map>"; #endif string renderedHtml = imageMap.Render (); HtmlDiff.AssertAreEqual (originalHtml, renderedHtml, "RenderNavigateTextAssigned"); }