public void QGPathFinderConstructorTest() { Image myimage = new Bitmap("../../testImage.jpg"); FloorPlan floorPlan = new FloorPlan(myimage, 5); // TODO: Initialize to an appropriate value QGPathFinder target = new QGPathFinder(floorPlan); Type actual = target.GetType(); Type expected = typeof(QGPathFinder); Assert.AreEqual(expected, actual); }
public void getPathTest() { TextWriter tw = new StreamWriter("../../getPathResult.txt"); Image myimage = new Bitmap("../../floorplan.bmp"); FloorPlan floorPlan = new FloorPlan(myimage, 3); // TODO: Initialize to an appropriate value int StartX = 106; int StartY = 74; int TargetX = 107; int TargetY = 43; floorPlan.setStartTile(StartX, StartY); floorPlan.setTargetTile(TargetX, TargetY); String TargetString = TargetX + "_" + TargetY; QGPathFinder qgpf = new QGPathFinder(floorPlan); //show neighbors List <FloorTile> TargetNeighbors = floorPlan.getTargetTile().getNeighbours(); String neighborString = ""; for (int i = 0; i < TargetNeighbors.Count; i++) { neighborString = TargetNeighbors[i].Position.X + "_" + TargetNeighbors[i].Position.Y; //tw.WriteLine("Target Neighbors: " + neighborString + ": " + isContainEdge); } List <FloorTile> actual; actual = qgpf.getPath(); tw.WriteLine(qgpf.GetMessages()); tw.Close(); visualizeFloorPlan(floorPlan, StartX, StartY, TargetX, TargetY); List <FloorTile> expected = new List <FloorTile>(); FloorTile t1 = new FloorTile(0, 0, true, floorPlan); FloorTile t2 = new FloorTile(0, 1, true, floorPlan); FloorTile t3 = new FloorTile(0, 2, true, floorPlan); expected.Add(t1); expected.Add(t2); expected.Add(t3); //String actualString = actual[1].Position.X + "," + actual[1].Position.Y; //String expectedString = expected[1].Position.X + "," + expected[1].Position.Y; //Assert.AreEqual(expectedString, actualString); }
public void getTileByIndexTest() { Image myimage = new Bitmap("../../testImage.jpg"); FloorPlan floorPlan = new FloorPlan(myimage, 5); // TODO: Initialize to an appropriate value String index = "1_1"; // TODO: Initialize to an appropriate value FloorTile expected = floorPlan.getTile(1, 1); // TODO: Initialize to an appropriate value FloorTile actual; actual = QGPathFinder.getTileByIndex(floorPlan, index); Assert.AreEqual(expected, actual); }
public void buildGraphTest() { Image myimage = new Bitmap("../../testImage.jpg"); FloorPlan floorPlan = new FloorPlan(myimage, 5); // TODO: Initialize to an appropriate value QGPathFinder target = new QGPathFinder(floorPlan); // TODO: Initialize to an appropriate value int expected = 6354; // TODO: Initialize to an appropriate value int actual; actual = target.buildGraph().VertexCount; Assert.AreEqual(expected, actual); }
public void getPathTest() { Image myimage = new Bitmap("../../testImage.jpg"); // TODO: Initialize to an appropriate value //FloorPlan fp = new FloorPlan(myimage); // TODO: Initialize to an appropriate value Status status = new Status(myimage, 2.0); // TODO: Initialize to an appropriate value QGPathFinder target = new QGPathFinder(status, null); // TODO: Initialize to an appropriate value List <FloorTile> expected = null; // TODO: Initialize to an appropriate value List <FloorTile> actual; actual = target.getPath(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Verify the correctness of this test method."); }
/// <summary> ///get executing time for a path ///</summary> public void visualizeFloorPlan(FloorPlan floorPlan, int StartX, int StartY, int TargetX, int TargetY) { floorPlan.setStartTile(StartX, StartY); floorPlan.setTargetTile(TargetX, TargetY); QGPathFinder target = new QGPathFinder(floorPlan); List <FloorTile> actual; actual = target.getPath(); Form f = new WindowsFormsApplication1.Form1(floorPlan, actual); Application.Run(f); //f.Invoke(); //f.Draw(floorPlan, actual); }
/// <summary> ///get executing time for a path ///</summary> public Int64 getPathExecutingTime(FloorPlan floorPlan, int StartX, int StartY, int TargetX, int TargetY) { Int64 ExecutingTime = 0; floorPlan.setStartTile(StartX, StartY); floorPlan.setTargetTile(TargetX, TargetY); QGPathFinder target = new QGPathFinder(floorPlan); List <FloorTile> actual; DateTime StartTime = DateTime.Now; actual = target.getPath(); DateTime EndTime = DateTime.Now; TimeSpan t = EndTime - StartTime; if (actual != null) { ExecutingTime = (Int64)t.TotalMilliseconds; } return(ExecutingTime); }