describe("Turtle", function () {
    'use strict';
	var c,
        ref = document.createElement('canvas'),
        loadImage = function (file) {
            var a = new Image();
            a.src = file;
            a.addEventListener('load', function () {
                ref.getContext('2d').drawImage(a, 0, 0);
            });
        };
        
    beforeEach(function () {
		jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
        jasmine.addMatchers(imagediff.jasmine);
        TurtleGraphics = { 
			defaults: {
				canvasID: 'turtlecanvas',
				animate: true,
				degrees: true
			},
			doneDelegates: [],
		};
        Sk.configure({
            output: function(s) {
                console.log(s);
            },
        });
        c = document.createElement('canvas');
        c.id = "turtlecanvas";
        c.width = "200";
        c.height = "200";
        c.style.display = "none";
        ref.id = "reffw100";
        ref.width = "200";
        ref.height = "200";
        document.body.appendChild(c);
    });
    
    afterEach(function () {
        document.body.removeChild(c);
    });
    
    it("should be able to draw the example on the home page", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle\nt = turtle.Turtle()\nc = [ \"red\", \"green\", \"blue\", \"yellow\" ]\nfor color in c:\n    t.color(color)\n    t.forward(50)\n    t.left(360/len(c))",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAG90lEQVR4Xu3aPXJcZRBG4TtFYkggICCDEDJ7JbAMQlgB8g5MQA4rgCWYFQCRneGQgCogsojEvUbFj2AsulUz1Zf3UZXLhd3fjPqce/gk24fFBwIIHCVwwAYBBI4TEIinA4GXEBCIxwMBgXgGEOgRcIP0uDkVQkAgIaKt2SMgkB43p0IICCREtDV7BATS4+ZUCAGBhIi2Zo+AQHrcnAohIJAQ0dbsERBIj5tTIQQEEiLamj0CAulxcyqEgEBCRFuzR0AgPW5OhRAQSIhoa/YICKTHzakQAgIJEW3NHgGB9Lg5FUJAICGirdkjIJAeN6dCCAgkRLQ1ewQE0uPmVAgBgYSItmaPgEB63JwKISCQENHW7BEQSI+bUyEEBBIi2po9AgLpcXMqhIBAQkRbs0dAID1uToUQEEiIa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Le/BNz+qcn2x7gfHfunJmf6VLxNgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcICKQAy2geAYHkObdxgYBACrCM5hEQSJ5zGxcI/AaC8zTYdteqRgAAAABJRU5ErkJggg==");
        TurtleGraphics.doneDelegates.push(function () {
            //1 for tolerance
            expect(cctx).toImageDiffEqual(refctx, 1);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });
    
    it("should be able to move 50 px forward", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle\nt = turtle.Turtle()\nt.forward(50)",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base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nwBB+juSMEiAIEH4VvcTIEh/RxIGCfwLl9cgyWDhTh4AAAAASUVORK5CYII=");
        TurtleGraphics.doneDelegates.push(function () {
            expect(cctx).toImageDiffEqual(refctx);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });
    
    it("should be able to change the color", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle\nt = turtle.Turtle()\nt.color('red')\nt.forward(50)",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAGVUlEQVR4Xu3awY1cBRCE4fURLpABZEAopAIRYGdgZwAZEILJgAxwCHCCG7yR5mRpsNTr2Zp6/a1k+dSvq/96v2Z37VdPvhBA4CaBV9gggMBtAgTxdiDwPwQI4vVAgCDeAQRmBHyCzLiZWkKAIEuKduaMAEFm3EwtIUCQJUU7c0aAIDNuppYQIMiSop05I0CQGTdTSwgQZEnRzpwRIMiMm6klBAiypGhnzggQZMbN1BICBFlStDNnBAgy42ZqCQGCLCnamTMCBJlxM7WEAEGWFO3MGQGCzLiZWkKAIEuKduaMAEFm3EwtIUCQJUU7c0aAIDNuppYQIMiSop05I0CQGTdTSwgQZEnRzpwRIMiMm6klBAiypGhnzggQZMbN1BICBFlStDNnBAgy42ZqCQGCLCnamTMCBJlxM7WEAEGWFO3MGQGCzLiZWkKAIEuKduaMAEFm3EwtIUCQJUU7c0aAIDNuppYQIMiSop05I0CQGTdTSwgQZEnRzpwRIMiMm6klBAiypGhnzggQZMbN1BICBFlStDNnBAgy42ZqCQGCLCnamTMCBJlxM7WEAEGWFO3MGQGCzLiZWkKAIEuKduaMAEFm3EwtIUCQJUU7c0aAIDNuppYQIMiSop05I0CQGTdTSwgQZEnRzpwRIMiMm6klBAiypGhnzggQZMbN1BICBFlStDNnBAgy42ZqCQGCLCnamTMCBJlxM7WEAEGWFO3MGQGCzLiZWkKAIEuKduaMAEFm3EwtIUCQJUU7c0aAIDNuppYQIMiSop05I0CQGTdTSw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am5IwQIEgEu6UtBAjS0pScEQIEiWC3tIUAQVqakjNCgCAR7Ja2ECBIS1NyRggQJILd0hYCBGlpSs4IAYJEsFvaQoAgLU3JGSFAkAh2S1sIEKSlKTkjBAgSwW5pCwGCtDQlZ4QAQSLYLW0hQJCWpuSMECBIBLulLQQI0tKUnBECBIlgt7SFAEFampIzQoAgEeyWthAgSEtTckYIECSC3dIWAgRpaUrOCAGCRLBb2kKAIC1NyRkhQJAIdktbCBCkpSk5IwQIEsFuaQsBgrQ0JWeEwH/a2izJtYny0AAAAABJRU5ErkJggg==");
        TurtleGraphics.doneDelegates.push(function () {
            expect(cctx).toImageDiffEqual(refctx);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });
    
    it("should be able to draw a circle", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle\nt = turtle.Turtle()\nt.circle(50, 360)",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base64,[encoded data, 4932 characters]");
		TurtleGraphics.doneDelegates.push(function () {
            expect(cctx).toImageDiffEqual(refctx);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });
    
	it("it should be able to stamp a grid", function (done) {
		var cctx = c.getContext("2d"),
			code = "import turtle\n\nt = turtle.Turtle()\nt.up()\nt.speed(10)\nt.left(30)\nfor i in range(-90, 110, 20):\n    for j in range(-90, 110, 20):\n        t.goto(i, j)\n        t.color(i,j,i+j)\n        t.stamp()",
			refctx = ref.getContext("2d");
		loadImage("data:image/png;base64,[encoded data, 19608 characters]");
		TurtleGraphics.doneDelegates.push(function () {
			expect(cctx).toImageDiffEqual(refctx, 16);
			done();
		});
		Sk.importMainWithBody("", false, code);
	});
    
	it("it should be able to run \"Our First Turtle Program\"", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle               # allows us to use the turtles library\nwn = turtle.Screen()        # creates a graphics window\nalex = turtle.Turtle()      # create a turtle named alex\nalex.forward(150/2)         # tell alex to move forward by 150 units\nalex.left(90)               # turn by 90 degrees\nalex.forward(75/2)          # complete the second side of a rectangle",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAGfElEQVR4Xu3c0W1cVRSFYfIIT3RAUgF0AFQAVEBKgAqACqCEUAFQASmBDkgJeYM3uFcykoUwztq6B81hfSONnNj77DnrX/PLsiz5yVseCCDwIIEn2CCAwMMECOLdgcC/ECCItwcCBPEeQGBGwHeQGTenSggQpKRoMWcECDLj5lQJAYKUFC3mjABBZtycKiFAkJKixZwRIMiMm1MlBAhSUrSYMwIEmXFzqoQAQUqKFnNGgCAzbk6VECBISdFizggQZMbNqRICBCkpWswZAYLMuDlVQoAgJUWLOSNAkBk3p0oIEKSkaDFnBAgy4+ZUCQGClBQt5owAQWbcnCohQJCSosWcESDIjJtTJQQIUlK0mDMCBJlxc6qEAEFKihZzRoAgM25OlRAgSEnRYs4IEGTGzakSAgQpKVrMGQGCzLg5VUKAICVFizkjQJAZN6dKCBCkpGgxZwQIMuPmVAkBgpQULeaMAEFm3JwqIUCQkqLFnBEgyIybUyUECFJStJgzAgSZcXOqhABBSooWc0aAIDNuTpUQIEhJ0WLOCBBkxs2pEgIEKSlazBkBgsy4OVVCgCAlRYs5I0CQGTenSggQpKRoMWcECDLj5lQJAYKUFC3mjABBZtycKiFAkJKixZwRIMiMm1MlBAhSUrSYMwIEmXFzqoQAQUqK/h/G/O3I9MfxfGdlNoKspGv3KgJfHIu/vVv+5fHxu1UvRJBVZO1dReDdY/Gvx/P8eD5eH89ndx8vf02CXI7UwsUEvj72f/W31/jm+P/5+csfBLkcqYULCTy9++7xTy9xfhd5dfVrE+RqovatJPDiWP75Ay/w/fH551e/OEGuJmrfKgIfHYt/fmT5x8fXX155AYJcSdOulQTON/6Hj7zAOXNKctmDIJehtGghgU+P3T+84f7Pjrkf33D20TGCPIrIwA0QeHXc4b179zh/3vjrZ5Gfjn9/cu9r5+z5A/slD4JcgtGSxQR+Ofafv/c4fyH44niev/s4f4t+Ps738NP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JcRIEhZ4eJmBAiS8TJdRoAgZYWLmxEgSMbLdBkBgpQVLm5GgCAZL9NlBAhSVri4GQGCZLxMlxEgSFnh4mYECJLxMl1GgCBlhYubESBIxst0GQGClBUubkaAIBkv02UE/gQMKTrJHO4RhwAAAABJRU5ErkJggg==");
        TurtleGraphics.doneDelegates.push(function () {
            expect(cctx).toImageDiffEqual(refctx);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });
    
	it("it should be able to run \"The second example\"", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle\n\nwn = turtle.Screen()\nwn.bgcolor(\"lightgreen\")        # set the window background color\n\ntess = turtle.Turtle()\ntess.color(\"blue\")              # make tess blue\ntess.pensize(3)                 # set the width of her pen\n\ntess.forward(50)\ntess.left(120)\ntess.forward(50)\n\nwn.exitonclick()                # wait for a user click on the canvas",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAIH0lEQVR4Xu2dT48sUxiHexIbKxIRERJXxFZYsMVKIhKsJDauhDU+gesTYI24VpZYSKyYxEJCBB9AXAtiYWFlY1HOmVsT3fOn5zdvZkp1PU8nnfn3nq7ze97zpLqrq2v2Vt4kIIFTCezJRgISOJ2Agrg6JLCFgIK4PCSgIK4BCdQIuAepcXMUhICCQBptzBoBBalxcxSEgIJAGm3MGgEFqXFzFISAgkAabcwaAQWpcXMUhICCQBptzBoBBalxcxSEgIJAGm3MGgEFqXFzFISAgkAabcwaAQWpcXMUhICCQBptzBoBBalxcxSEgIJAGm3MGgEFqXFzFISAgkAabcwaAQWpcXMUhICCQBptzBoBBalxcxSEgIJAGm3MGgEFqXFzFISAgkAabcwaAQWpcXMUhICCQBptzBoBBalxcxSEgIJAGm3MGgEFqXFzFISAgkAabcwaAQWpcXMUhICCQBptzBoBBalxcxSEgIJAGm3MGgEFqXFzFISAgkAabcwaAQWpcXMUhICCQBptzBoBBalxcxSEgIJAGm3MGgEFqXFzFISAg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5QEBBAkiWcAkoCLf3Jg8IKEgAyRIuAQXh9t7kAYF/AW8Nr8lmG41xAAAAAElFTkSuQmCC");
        TurtleGraphics.doneDelegates.push(function () {
            expect(cctx).toImageDiffEqual(refctx);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });

	it("it should be able to draw \"A herd of turtles\"", function (done) {
		var cctx = c.getContext("2d"),
			code = "import turtle\nwn = turtle.Screen()             # Set up the window and its attributes\nwn.bgcolor(\"lightgreen\")\n\n\ntess = turtle.Turtle()           # create tess and set some attributes\ntess.color(\"hotpink\")\ntess.pensize(5)\n\nalex = turtle.Turtle()           # create alex\n\ntess.forward(80)                 # Let tess draw an equilateral triangle\ntess.left(120)\ntess.forward(80)\ntess.left(120)\ntess.forward(80)\ntess.left(120)                   # complete the triangle\n\ntess.right(180)                  # turn tess around\ntess.forward(80)                 # move her away from the origin\n\nalex.forward(50)                 # make alex draw a square\nalex.left(90)\nalex.forward(50)\nalex.left(90)\nalex.forward(50)\nalex.left(90)\nalex.forward(50)\nalex.left(90)\n",
			refctx = ref.getContext("2d");
		loadImage("data:image/png;base64,[encoded data, 5628 characters]");
		TurtleGraphics.doneDelegates.push(function () {
			expect(cctx).toImageDiffEqual(refctx, 16);
			done();
		});
		Sk.importMainWithBody("", false, code);
	});
    
    it("it should be able to run \"Iteration Simplifies our Turtle Program\"", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle            #set up alex\nwn = turtle.Screen()\nalex = turtle.Turtle()\n\nfor i in [0,1,2,3]:      #repeat four times\n    alex.forward(50)\n    alex.left(90)\n\nwn.exitonclick()",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAGrklEQVR4Xu3a0Y0cRRSFYe8b8AIZ4IwgFIgAyAAygAggBJMBGeAMgCd4gx5pLZDR2Me1rlHPPd9KK0twq3rOf+7vZo0fnvlCAIGrBB6wQQCB6wQIYjsQeAMBglgPBAhiBxBYI+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Dxzrf8n9/PMfAAAAAElFTkSuQmCC");
        TurtleGraphics.doneDelegates.push(function () {
            expect(cctx).toImageDiffEqual(refctx);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });
    
    it("it should be able to create a spiral of turtles.", function (done) {
        var cctx = c.getContext("2d"),
            code = "import turtle\ntess = turtle.Turtle()\ntess.color(\"blue\")\ntess.shape(\"turtle\")\n\ntess.up()                       # this is new\nfor size in range(5,60,2):      # start with size = 5 and grow by 2\n    tess.stamp()                # leave an impression on the canvas\n    tess.forward(size)          # move tess along\n    tess.right(24)              # and turn her",
            refctx = ref.getContext("2d");
        loadImage("data:image/png;base64,[encoded data, 9228 characters]");
        TurtleGraphics.doneDelegates.push(function () {
            expect(cctx).toImageDiffEqual(refctx);
            done();
        });
		Sk.importMainWithBody("", false, code);
    });
	
	it("should be able to run the example from \"How to Think Like a Computer Scientist\"", function (done) {
		var cctx = c.getContext("2d"),
			code = "import turtle\nimport random\n\ndef main():\n    tList = []\n    head = 0\n    numTurtles = 10\n    for i in range(numTurtles):\n        nt = turtle.Turtle()   # Make a new turtle, initialize values\n        nt.setheading(head)\n        nt.pensize(2)\n        nt.speed(10)\n        nt.tracer(30,0)\n        tList.append(nt)       # Add the new turtle to the list\n        head = head + 360/numTurtles\n\n    for i in range(100):\n        moveTurtles(tList,15,i)\n\n    w = tList[0]\n    w.up()\n    w.goto(-130/2,40/2)\n    w.write(\"How to Think Like a \",True,\"center\",\"30px Arial\")\n    w.goto(-130/2,-35/2)\n    w.write(\"Computer Scientist\",True,\"center\",\"30px Arial\")\n\ndef moveTurtles(turtleList,dist,angle):\n    for turtle in turtleList:   # Make every turtle on the list do the same actions.\n        turtle.forward(dist/2)\n        turtle.right(angle/2)\n\nmain()",
			refctx = ref.getContext("2d");
		loadImage("data:image/png;base64,[encoded data, 29960 characters]");
		TurtleGraphics.doneDelegates.push(function () {
			expect(cctx).toImageDiffEqual(refctx);
			done();
		});
		Sk.importMainWithBody("", false, code);
	});
});

describe("Turtle (non-animated)", function () {
	'use strict';
	var c,
		ref = document.createElement('canvas'),
		loadImage = function (file, done) {
			var a = new Image();
			a.src = file;
			a.addEventListener('load', function () {
				ref.getContext('2d').drawImage(a, 0, 0);
				if (done) { done(); }
			});
		};

	beforeEach(function () {
		jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
		jasmine.addMatchers(imagediff.jasmine);
		TurtleGraphics = { 
			doneDelegates: [],
			defaults: {
				animate: false,
				canvasID: 'turtlecanvas',
				degrees: true,
			}
		};
		Sk.configure({
			output: function(s) {
				console.log(s);
			},
		});
		c = document.createElement('canvas')
		c.id = "turtlecanvas";
		c.width = "200";
		c.height = "200";
		c.style.display = "none";
		ref.id = "reffw100";
		ref.width = "200";
		ref.height = "200";
		document.body.appendChild(c);
	});

	afterEach(function () {
		document.body.removeChild(c);
	});

	it("should be able to draw the example on the home page", function (done) {
		var cctx = c.getContext("2d"),
			code = "import turtle\nt = turtle.Turtle()\nc = [ \"red\", \"green\", \"blue\", \"yellow\" ]\nfor color in c:\n    t.color(color)\n    t.forward(50)\n    t.left(360/len(c))",
			refctx = ref.getContext("2d");
		loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAGEUlEQVR4Xu3VMW6dVRRF4d/QYNEiMQRERTIrhuFJMC4kGjwFJOqYVIZAEFXY0o0c7Zf9uUlzrvPOWm/53F1+EEDggwTusEEAgQ8TEIhvBwL/Q0Agvh4ICMR3AIEzAi7IGTevRggIZES0Nc8ICOSMm1cjBAQyItqaZwQEcsbNqxECAhkRbc0zAgI54+bVCAGBjIi25hkBgZxx82qEgEBGRFvzjIBAzrh5NUJAICOirXlGQCBn3LwaISCQEdHWPCMgkDNuXo0QEMiIaGueERDIGTevRggIZES0Nc8ICOSMm1cjBAQyItqaZwQEcsbNqxECAhkRbc0zAgI54+bVCAGBjIi25hkBgZxx82qEgEBGRFvzjIBAzrh5NUJAICOirXlGQCBn3LwaISCQEdHWPCMgkDNuXo0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mRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9ExBIZmRimIBAhuVbPRMQSGZkYpiAQIblWz0TEEhmZGKYgECG5Vs9E/gTndsM2MEKuPcAAAAASUVORK5CYII=", function() {
			Sk.importMainWithBody("", false, code);
			expect(cctx).toImageDiffEqual(refctx, 1);
			done();
		});
	});
	
	it("should be able to go foward 50 px", function (done) {
		var cctx = c.getContext("2d"),
			code = "import turtle\nt = turtle.Turtle()\nt.forward(50)",
			refctx = ref.getContext("2d");
		loadImage("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAFiElEQVR4Xu3V21EcUBDEUIgIyD8Im4zAAcBH8yiV5/A/u32lVfH44A8BBD4k8IgNAgh8TEAgfh0IfEJAIH4eCAjEbwCBjYD/IBs3V0cICOSIaM/cCAhk4+bqCAGBHBHtmRsBgWzcXB0hIJAjoj1zIyCQjZurIwQEckS0Z24EBLJxc3WEgECOiPbMjYBANm6ujhAQyBHRnrkREMjGzdURAgI5ItozNwIC2bi5OkJAIEdEe+ZGQCAbN1dHCAjkiGj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kKMWkDgGBdFxYEiQgkKAUkzoEBNJxYUmQgECCUkzqEBBIx4UlQQICCUoxqUNAIB0XlgQJCCQoxaQOAYF0XFgSJCCQoBSTOgQE0nFhSZCAQIJSTOoQEEjHhSVBAgIJSjGpQ0AgHReWBAkIJCjFpA4BgXRcWBIkIJCgFJM6BATScWFJkIBAglJM6hAQSMeFJUECAglKMalDQCAdF5YECQgkKMWkDgGBdFxYEiQgkKAUkzoEBNJxYUmQgECCUkzqEBBIx4UlQQICCUoxqUNAIB0XlgQJCCQoxaQOAYF0XFgSJCCQoBSTOgQE0nFhSZCAQIJSTOoQEEjHhSVBAgIJSjGpQ0AgHReWBAkIJCjFpA4BgXRcWBIkIJCgFJM6BATScWFJkIBAglJM6hAQSMeFJUECAglKMalDQCAdF5YECQgkKMWkDgGBdFxYEiQgkKAUkzoEBNJxYUmQgECCUkzqEBBIx4UlQQICCUoxqUNAIB0XlgQJCCQoxaQOAYF0XFgSJCCQoBSTOgQE0nFhSZCAQIJSTOoQEEjHhSVBAgIJSjGpQ0AgHReWBAm8AWn6BMka20FaAAAAAElFTkSuQmCC", function () {
			Sk.importMainWithBody("", false, code);
			expect(cctx).toImageDiffEqual(refctx);
			done();
		});
	});
});