Unverified Commit 65f205ba authored by boklm's avatar boklm
Browse files

Create thumbnails of screenshots

parent d7477f7d
...@@ -14,6 +14,7 @@ use IO::CaptureOutput qw(capture_exec); ...@@ -14,6 +14,7 @@ use IO::CaptureOutput qw(capture_exec);
use IO::Socket::INET; use IO::Socket::INET;
use JSON; use JSON;
use File::Copy; use File::Copy;
use Image::Resize;
my %default_options = ( my %default_options = (
os => 'Linux', os => 'Linux',
...@@ -168,6 +169,12 @@ sub stop_tor { ...@@ -168,6 +169,12 @@ sub stop_tor {
kill 9, $options->{tbbinfos}{torpid}; kill 9, $options->{tbbinfos}{torpid};
} }
sub screenshot_thumbnail {
my ($dir, $name) = @_;
my $image = Image::Resize->new("$dir/$name");
write_file("$dir/t-$name", $image->resize(600, 600)->png);
}
sub mozmill_run { sub mozmill_run {
my ($test) = @_; my ($test) = @_;
$test->{screenshots} = []; $test->{screenshots} = [];
...@@ -182,6 +189,7 @@ sub mozmill_run { ...@@ -182,6 +189,7 @@ sub mozmill_run {
my $i = 0; my $i = 0;
for my $screenshot_file (glob "$screenshots_tmp/*.png") { for my $screenshot_file (glob "$screenshots_tmp/*.png") {
move($screenshot_file, "$options->{tbbinfos}{'results-dir'}/$test->{name}-$i.png"); move($screenshot_file, "$options->{tbbinfos}{'results-dir'}/$test->{name}-$i.png");
screenshot_thumbnail($options->{tbbinfos}{'results-dir'}, "$test->{name}-$i.png");
push @{$test->{screenshots}}, "$test-$i.png"; push @{$test->{screenshots}}, "$test-$i.png";
$i++; $i++;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment