11 def grid_scaling(binname, x0, y0, w0, h0, s, steps=100,testsvg="svg-tests/grid.svg"):
13 n = open("/dev/null", "w")
14 p = subprocess.Popen(binname + " -s stdin", bufsize=0, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=n, shell=True)
15 p.stdin.write("setbounds %s %s %s %s\n" % (str(x0),str(y0),str(w0),str(h0)))
16 p.stdin.write("loadsvg %s\n" % testsvg)
17 p.stdin.write("querygpubounds original.dat\n")
18 p.stdin.write("screenshot original.bmp\n")
19 for i in xrange(steps):
20 p.stdin.write("clear\n")
21 p.stdin.write("loop 1 zoom 0.5 0.5 %s\n" % str(s))
22 p.stdin.write("loadsvg %s\n" % testsvg)
23 p.stdin.write("querygpubounds step%d.dat\n" % i)
24 while not os.path.isfile("step%d.dat" % i):
26 p.stdin.write("clearperf\n")
27 p.stdin.write("loop 10 wait\n")
28 p.stdin.write("recordperf\n")
29 p.stdin.write("printperf\n")
30 perf = p.stdout.readline()
32 data += [gpubounds_error.ComputeError("original.dat", "step%d.dat" % i)]
33 #data += [gpubounds_error.UniqueBounds("step%d.dat" % i)]
37 p.stdin.write("screenshot final.bmp\n")
38 p.stdin.write("quit\n")
46 if __name__ == "__main__":
47 binname = "../src/ipdf"
50 grid_scaling(binname, 0.5, 0.5, 1, 1, 0.5)