Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 960cc29

Browse files
committed
[[ Bug 20814 ]] Add release note and tests
1 parent 5147988 commit 960cc29

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

docs/notes/bugfix-20814.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Fix printing to pdf

engine/src/printer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ class MCCustomPrinter: public MCPrinter
613613
MCArrayRef m_device_options;
614614
};
615615

616-
Exec_stat MCCustomPrinterCreate(MCStringRef p_destination, MCStringRef p_filename, MCArrayRef p_options, MCCustomPrinter*& r_printer);
616+
bool MCCustomPrinterCreate(MCStringRef p_destination, MCStringRef p_filename, MCArrayRef p_options, MCCustomPrinter*& r_printer);
617617

618618
////////////////////////////////////////////////////////////////////////////////
619619

tests/_testlib.livecodescript

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ on TestLoadAuxiliaryExtension pName, pResourceFolder
487487
end if
488488
end TestLoadAuxiliaryExtension
489489

490-
constant kBytecodePathPrefix = "_tests/_build/"
490+
constant kTestsBuildPath = "_tests/_build/"
491491
function TestGetBuiltBytecodeFile pName
492492
local tBasePath, tExtraPath
493493
set the itemDelimiter to slash
@@ -501,11 +501,15 @@ function TestGetBuiltBytecodeFile pName
501501
put item 1 to tTestsOffset - 1 of tBasePath into tBasePath
502502

503503
local tModuleFile
504-
put tBasePath & "/" & kBytecodePathPrefix & tExtraPath & slash & \
504+
put tBasePath & "/" & kTestsBuildPath & tExtraPath & slash & \
505505
pName & ".lcm" into tModuleFile
506506
return tModuleFile
507507
end TestGetBuiltBytecodeFile
508508

509+
function TestGetTestBuildFolder
510+
return TestGetEngineRepositoryPath() & slash & kTestsBuildPath
511+
end TestGetTestBuildFolder
512+
509513
on TestLoadAllExtensions
510514
local tExtFolder
511515
put _TestGetBuiltExtensionsFolder() into tExtFolder
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
script "CorePrinting"
2+
/*
3+
Copyright (C) 2018 LiveCode Ltd.
4+
5+
This file is part of LiveCode.
6+
7+
LiveCode is free software; you can redistribute it and/or modify it under
8+
the terms of the GNU General Public License v3 as published by the Free
9+
Software Foundation.
10+
11+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
12+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
18+
19+
on TestPDFPrinter
20+
TestSkipIfNot "external", "revpdfprinter"
21+
22+
local tFile, tStack
23+
put TestGetTestBuildFolder() & slash & "test.pdf" into tFile
24+
create stack
25+
put it into tStack
26+
open printing to pdf tFile
27+
print card 1 of tStack
28+
close printing
29+
TestAssert "print stack to pdf", there is a file tFile
30+
end TestPDFPrinter
31+
32+
command _TestOpenPrintingBadDest
33+
local tFile
34+
put TestGetTestBuildFolder() & slash & "test" into tFile
35+
open printing to baddest tFile
36+
end _TestOpenPrintingBadDest
37+
38+
on TestOpenPrintingBadDest
39+
TestAssertThrow "open printing to bad dest throws", \
40+
_TestOpenPrintingBadDest, the long id of me, \
41+
EE_PRINT_UNKNOWNDST
42+
end TestOpenPrintingBadDest

0 commit comments

Comments
 (0)