Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dk981234 committed Jan 10, 2025
1 parent 31c2334 commit b209ef0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/flat_layout/flat_survey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export class FlatSurvey {
private static async generateFlatLogoImage(survey: SurveyPDF, controller: DocController,
point: IPoint): Promise<IPdfBrick> {
const logoUrl = SurveyHelper.getLocString(survey.locLogo);
const logoSize = await SurveyHelper.getCorrectedImageSize(controller, { imageLink: logoUrl, imageHeight: survey.logoHeight, imageWidth: survey.logoWidth });
const logoSize = await SurveyHelper.getCorrectedImageSize(controller, { imageLink: logoUrl, imageHeight: survey.logoHeight, imageWidth: survey.logoWidth, defaultImageWidth: '300px', defaultImageHeight: '200px' });
const logoFlat: IPdfBrick = await SurveyHelper.createImageFlat(
point, null, controller, { link: logoUrl,
width: logoSize.width, height: logoSize.height });
Expand Down
14 changes: 14 additions & 0 deletions tests/flat_survey.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ test('Survey with logo', async () => {
SurveyHelper.shouldConvertImageToPng = false;
const json: any = {
logo: TestHelper.BASE64_IMAGE_16PX,
logoWidth: '300px',
logoHeight: '200px',
pages: []
};
const survey: SurveyPDF = new SurveyPDF(json, TestHelper.defaultOptions);
Expand All @@ -134,6 +136,8 @@ test('Survey with left logo and title', async () => {
title: 'TitleLogoLeft',
logo: TestHelper.BASE64_IMAGE_16PX,
logoPosition: 'left',
logoWidth: '300px',
logoHeight: '200px',
questions: [
{
type: 'text',
Expand Down Expand Up @@ -176,6 +180,8 @@ test('Survey with left logo and big title', async () => {
title: 'TitleLogoLeftBiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiig',
logo: TestHelper.BASE64_IMAGE_16PX,
logoPosition: 'left',
logoWidth: '300px',
logoHeight: '200px',
questions: [
{
type: 'text',
Expand Down Expand Up @@ -218,6 +224,8 @@ test('Survey with right logo and title', async () => {
title: 'TitleRight',
logo: TestHelper.BASE64_IMAGE_16PX,
logoPosition: 'right',
logoWidth: '300px',
logoHeight: '200px',
questions: [
{
type: 'text',
Expand Down Expand Up @@ -258,6 +266,8 @@ test('Survey with bottom logo and title', async () => {
const json: any = {
title: 'TitleLogoBottom',
logo: TestHelper.BASE64_IMAGE_16PX,
logoWidth: '300px',
logoHeight: '200px',
logoPosition: 'bottom',
pages: []
};
Expand Down Expand Up @@ -291,6 +301,8 @@ test('Survey with botton logo without title', async () => {
const json: any = {
logo: TestHelper.BASE64_IMAGE_16PX,
logoPosition: 'bottom',
logoWidth: '300px',
logoHeight: '200px',
pages: []
};
const survey: SurveyPDF = new SurveyPDF(json, TestHelper.defaultOptions);
Expand Down Expand Up @@ -343,6 +355,8 @@ test('Survey with logo server-side', async () => {
test('Survey with logo and pages', async () => {
const json: any = {
logo: TestHelper.BASE64_IMAGE_16PX,
logoWidth: '300px',
logoHeight: '200px',
pages: [
{
name: 'page1',
Expand Down

0 comments on commit b209ef0

Please sign in to comment.