fix: SPP1802SWPTZ presetHome uses the cgi-bin/hi3510 path refs #6769

This commit is contained in:
Jash committed 2026-11-19 09:45:25 +05:30
1 parent 84028139d7
commit cf4fd75fd5
2 files changed
+32 -1

No files matched your search

@@ -236,7 +236,7 @@ sub presetHome
{
my $self = shift;
Debug( "Home Preset" );
my $cmd = "ptzgotopoint.cgi?&-chn=0&-point=1";
my $cmd = "cgi-bin/hi3510/ptzgotopoint.cgi?&-chn=0&-point=1";
$self->sendCmd( $cmd );
}
@@ -0,0 +1,31 @@
use strict;
use warnings;
use Test::More;
# presetHome must use the same cgi-bin/hi3510/ path as presetGoto;
# without the prefix the Home button asks for a page the camera lacks.
require_ok('ZoneMinder::Control::SPP1802SWPTZ');
my $P = 'ZoneMinder::Control::SPP1802SWPTZ';
my @sent;
{
no warnings 'redefine';
*ZoneMinder::Control::SPP1802SWPTZ::sendCmd = sub { push @sent, $_[1]; return 1; };
}
my $self = bless { Monitor => { AutoStopTimeout => 0 } }, $P;
@sent = ();
$self->presetGoto({ preset => 1 });
my $goto = $sent[-1];
@sent = ();
$self->presetHome();
my $home = $sent[-1];
like($home, qr{^cgi-bin/hi3510/ptzgotopoint\.cgi\?}, 'presetHome uses the cgi-bin/hi3510 path');
like($home, qr{-point=1$}, 'presetHome goes to point 1');
is($home, $goto, 'presetHome sends the same request as presetGoto preset 1');
done_testing();