mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 01:16:44 +02:00
MDL-45301 assign: Add font options for EditPDF
This commit is contained in:
parent
8503f2cfd8
commit
9e725bc168
19 changed files with 160 additions and 9 deletions
|
@ -66,4 +66,35 @@ class pdflib_test extends \advanced_testcase {
|
|||
$this->assertGreaterThan(100000, strlen($res));
|
||||
$this->assertLessThan(120000, strlen($res));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get_export_fontlist function.
|
||||
*
|
||||
* @covers ::get_export_fontlist
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function test_get_export_fontlist(): void {
|
||||
global $CFG;
|
||||
require_once($CFG->libdir.'/pdflib.php');
|
||||
|
||||
$this->resetAfterTest();
|
||||
|
||||
$pdf = new \pdf();
|
||||
$fontlist = $pdf->get_export_fontlist();
|
||||
$this->assertCount(1, $fontlist);
|
||||
$this->assertArrayHasKey('freesans', $fontlist);
|
||||
|
||||
$CFG->pdfexportfont = [
|
||||
'kozminproregular' => 'Kozmin Pro Regular',
|
||||
'stsongstdlight' => 'STSong stdlight',
|
||||
'invalidfont' => 'Invalid'
|
||||
];
|
||||
$fontlist = $pdf->get_export_fontlist();
|
||||
$this->assertCount(2, $fontlist);
|
||||
$this->assertArrayNotHasKey('freesans', $fontlist);
|
||||
$this->assertArrayHasKey('kozminproregular', $fontlist);
|
||||
$this->assertArrayHasKey('stsongstdlight', $fontlist);
|
||||
$this->assertArrayNotHasKey('invalidfont', $fontlist);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue