Skip to content

Commit

Permalink
[Sutton] Add garden waste sack image
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismytton authored and dracos committed Dec 23, 2024
1 parent 2b08f91 commit a55577d
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions perllib/FixMyStreet/Cobrand/Sutton.pm
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ sub image_for_unit {
my $base = '/i/waste-containers';
if (my $container = $unit->{garden_container}) {
return svg_container_bin("wheelie", '#41B28A', '#8B5E3D') if $container == 26 || $container == 27;
return svg_container_sack('normal', '#F5F5DC') if $container == 28; # Garden waste sack
return "";
}
if (my $container = $unit->{request_containers}[0]) {
Expand Down
28 changes: 28 additions & 0 deletions t/app/controller/waste_sutton_garden.t
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,34 @@ subtest "check signature generation" => sub {
is $sha, "06BB8BCD34670AE7BDBC054D23B84B30DFDEBABA", "correct signature generated";
};

subtest "check garden waste container images" => sub {
my $cobrand = FixMyStreet::Cobrand::Sutton->new;

# Test garden waste bin image
my $bin_unit = {
garden_container => 26, # Garden waste bin
};
my $bin_image = $cobrand->image_for_unit($bin_unit);
is_deeply $bin_image, {
type => 'svg',
data => $bin_image->{data}, # SVG data will vary
colour => '#41B28A',
lid_colour => '#8B5E3D',
recycling_logo => undef,
}, "garden waste bin shows as green bin with brown lid";

# Test garden waste sack image
my $sack_unit = {
garden_container => 28, # Garden waste sack
};
my $sack_image = $cobrand->image_for_unit($sack_unit);
is_deeply $sack_image, {
type => 'svg',
data => $sack_image->{data}, # SVG data will vary
colour => '#F5F5DC',
}, "garden waste sack shows as cream colored sack";
};

FixMyStreet::override_config {
ALLOWED_COBRANDS => 'sutton',
MAPIT_URL => 'http://mapit.uk/',
Expand Down

0 comments on commit a55577d

Please sign in to comment.