From: Emmanuel Rodriguez Date: Sat, 28 Mar 2009 09:39:57 +0000 (+0100) Subject: Testing set_zoom_level and set('zoom-level') X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf7b3b0fd5678be55ed23de4728bd70591f560d3;p=libchamplain Testing set_zoom_level and set('zoom-level') --- diff --git a/bindings/perl/Champlain/t/ChamplainView.t b/bindings/perl/Champlain/t/ChamplainView.t index e04d44b..1eec8df 100644 --- a/bindings/perl/Champlain/t/ChamplainView.t +++ b/bindings/perl/Champlain/t/ChamplainView.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Clutter::TestHelper tests => 37; +use Clutter::TestHelper tests => 46; use Champlain ':coords'; @@ -85,6 +85,10 @@ sub test_zoom_in_stage { my $min = $map_source->get_min_zoom_level; $view->set_zoom_level($min); is($view->get('zoom-level'), $min, "zoom-out to the minimal level"); + + $view->set("zoom-level", $min); + is($view->get('zoom-level'), $min, "set('zoom-level') to the minimal level"); + $view->zoom_out(); is($view->get('zoom-level'), $min, "zoom-out past minimal level has no effect"); @@ -93,6 +97,10 @@ sub test_zoom_in_stage { my $max = $map_source->get_max_zoom_level; $view->set_zoom_level($max); is($view->get('zoom-level'), $max, "zoom-in to the maximal level"); + + $view->set("zoom-level", $max); + is($view->get('zoom-level'), $max, "set('zoom-level') to the maximal level"); + $view->zoom_in(); is($view->get('zoom-level'), $max, "zoom-in past maximal level has no effect"); @@ -100,15 +108,24 @@ sub test_zoom_in_stage { my $middle = int( ($max - $min) / 2 ); $view->set_zoom_level($middle); is($view->get('zoom-level'), $middle, "set zoom to the middle level"); + + $view->set("zoom-level", $middle); + is($view->get('zoom-level'), $middle, "set('zoom-level', (max-min)/2) to the middle level"); # Try to set directly the zoom level to a value inferior to min level $view->set_zoom_level($min - 1); is($view->get('zoom-level'), $middle, "set zoom (min - 1) has no effect"); + + $view->set("zoom-level", $min - 1); + is($view->get('zoom-level'), $middle, "set('zoom-level', min - 1) has no effect"); # Try to set directly the zoom level to a valu superior to max level $view->set_zoom_level($max + 1); is($view->get('zoom-level'), $middle, "set zoom (max + 1) has no effect"); + + $view->set("zoom-level", $max + 1); + is($view->get('zoom-level'), $middle, "set('zoom-level', max + 1) has no effect"); } @@ -133,6 +150,8 @@ sub test_zoom { # Zoom to a random place $view->set_zoom_level(1); is($view->get('zoom-level'), 0, "set_zoom_level has no effect"); + $view->set("zoom-level", 1); + is($view->get('zoom-level'), 0, "set('zoom-level') has no effect"); my $map_source = $view->get('map-source'); @@ -141,6 +160,10 @@ sub test_zoom { my $min = $map_source->get_min_zoom_level; $view->set_zoom_level($min); is($view->get('zoom-level'), 0, "zoom-out to the minimal level has no effect"); + + $view->set("zoom-level", $min); + is($view->get('zoom-level'), 0, "set('zoom-level') to the minimal level has no effect"); + $view->zoom_out(); is($view->get('zoom-level'), 0, "zoom-out past minimal level has no effect"); @@ -149,6 +172,10 @@ sub test_zoom { my $max = $map_source->get_max_zoom_level; $view->set_zoom_level($max); is($view->get('zoom-level'), 0, "zoom-in to the maximal level has no effect"); + + $view->set("zoom-level", $max); + is($view->get('zoom-level'), 0, "set('zoom-level') to the maximal level has no effect"); + $view->zoom_in(); is($view->get('zoom-level'), 0, "zoom-in past maximal level has no effect"); @@ -157,6 +184,9 @@ sub test_zoom { $view->set_zoom_level($min - 1); is($view->get('zoom-level'), 0, "set zoom (min - 1) has no effect"); + $view->set("zoom-level", $min - 1); + is($view->get('zoom-level'), 0, "set('zoom-level', min -1) has no effect"); + # Try to set directly the zoom level to a valu superior to max level $view->set_zoom_level($max + 1); is($view->get('zoom-level'), 0, "set zoom (max + 1) has no effect");