# jogai - Python Game Library # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either # version 2 of the License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # Ramón Palleiro Rodríguez # Zero! Factorial Studio # info@zero.gal import os import pytest from jogai import * def test_height_is_a_non_negative_integer(prepare_videogame): assert vgscene.height > -1 def test_width_is_a_non_negative_integer(prepare_videogame): assert vgscene.width > -1 def test_x_coordinate_is_an_integer(prepare_videogame): assert isinstance(vgscene.x, int) def test_change_background_color_with_components_out_of_range(): with pytest.raises(ValueError): sc = Scene() sc.change_background((-1, -1, 300)) def test_change_background_color_with_less_components(): with pytest.raises(ValueError): sc = Scene() sc.change_background((0, 0)) def test_change_background_color_wrong_type(): with pytest.raises(ValueError): sc = Scene() sc.change_background('a') def test_create_scene_with_wrong_type(): with pytest.raises(TypeError): sc = Scene(-1) def test_set_position_with_wrong_type(prepare_videogame): with pytest.raises(TypeError): vgscene.set_position('foo')