def test_can_this_work(self, base_url, selenium): selenium.get(base_url) selenium.execute_script(open("./src/aria-highlighter.js").read()) selenium.save_screenshot('screenshot.png') # add a sleep so the test run is visible for presentation purposes time.sleep(10) assert pytest.idiff('baseline.png', 'screenshot.png', tolerance=0.2)
def test_extend_for_texture(name, test_ctx, version): filename = '%s_%s_%d.%d.png' % ( sys._getframe().f_code.co_name, name, version[0], version[1]) actual_results = '/tmp/%s' % (filename) expected_results = '%s/%s' % ( fixture_root, 'textured_triangle.png') class custom_context(test_ctx): vertex_list = np.array([ 0.6, 0.6, 0.0, 0.0, 1.0, -0.6, 0.6, 0.0, 1.0, 0.0, 0.0, -0.6, 0.0, 0.0, 0.0], dtype=np.float32) vertex_size = 5 vertex_stride = 4 * vertex_size default_vertex_shader = simple_texture_vs default_fragment_shader = simple_texture_fs def update(self): self.texture_id = load_texture(filename=os.path.abspath('./tests/textures/testing.png')) super(custom_context, self).update() my_ctx = custom_context(version=version) my_ctx.save(filename=actual_results) my_ctx.quit() #Seems there are very slight difference when rendering the texture assert pytest.idiff(actual_results, expected_results, tolerance=0.01) is True
def test_change_vertex_array(name, test_ctx, version): filename = '%s_%s_%d.%d.png' % ( sys._getframe().f_code.co_name, name, version[0], version[1]) actual_results = '/tmp/%s' % (filename) expected_results = '%s/%s' % ( fixture_root, 'red_square.png') class custom_context(test_ctx): vertex_list = np.array([ -0.5, 0.5, 0.0, -0.5, -0.5, 0.0, 0.5, 0.5, 0.0, 0.5, -0.5, 0.0 ], dtype=np.float32) def draw_data(self): GL.glBindVertexArray(self.vertex_array_object) GL.glDrawArrays(GL.GL_TRIANGLE_STRIP, 0, 4) GL.glBindVertexArray(0) new_ctx = custom_context() new_ctx.save(filename=actual_results) new_ctx.quit() assert pytest.idiff(actual_results, expected_results) is True
def test_context_renders(name, test_ctx, version): filename = '%s_%s_%d.%d.png' % (sys._getframe().f_code.co_name, name, version[0], version[1]) actual_results = '/tmp/%s' % (filename) expected_results = '%s/%s' % (fixture_root, 'red_triangle.png') ctx = test_ctx(version=version) ctx.save(filename=actual_results) ctx.quit() ctx = None assert pytest.idiff(actual_results, expected_results) is True
def test_glut_45_context_renders(): actual_results = '/tmp/%s.png' % sys._getframe().f_code.co_name expected_results = '%s/red_triangle.png' % fixture_root context(version=(4, 5)).save(filename=actual_results) assert pytest.idiff(actual_results, expected_results) is True
def test_gtkgl_45_context_renders(): actual_results = '/tmp/test_gtkgl_45_context_renders.png' expected_results = '%s/red_triangle.png' % fixture_root context(version=(4, 5)).save(filename=actual_results) assert pytest.idiff(actual_results, expected_results) is True