:修复无边距问题; Signed-off-by:liuhaosu@huawei.com

Signed-off-by: 刘昊苏 <liuhaosu@huawei.com>
This commit is contained in:
刘昊苏 2024-11-19 11:49:31 +08:00
parent a657fb9842
commit 73ca8cc292
3 changed files with 6 additions and 9 deletions

View File

@ -1542,13 +1542,9 @@ void PrintCupsClient::UpdateBorderlessJobParameter(json& optionJson, JobParamete
if (params == nullptr) {
return;
}
if (optionJson.contains("borderless") && optionJson["borderless"].is_string()) {
std::string isBorderless = optionJson["borderless"].get<std::string>();
if (isBorderless == "true") {
params->borderless = TRUE;
} else {
params->borderless = FALSE;
}
if (optionJson.contains("isBorderless") && optionJson["isBorderless"].is_boolean()) {
bool isBorderless = optionJson["isBorderless"].get<bool>();
params->borderless = isBorderless ? TRUE : FALSE;
} else {
params->borderless = TRUE;
}

View File

@ -186,6 +186,7 @@ ScanServiceAbility::~ScanServiceAbility()
FREE_AND_NULLPTR(saneReadBuf);
FREE_AND_NULLPTR(jpegbuf)
DELETE_AND_NULLIFY(cinfoPtr);
DELETE_AND_NULLIFY(ofp);
SCAN_HILOGD("~ScanServiceAbility state_ is %{public}d.", static_cast<int>(state_));
}

View File

@ -514,11 +514,11 @@ HWTEST_F(PrintCupsWrapperTest, PrintCupsWrapperTest_0086, TestSize.Level1)
printCupsClient.UpdateBorderlessJobParameter(optionJson, jobParams);
jobParams = new JobParameters();
printCupsClient.UpdateBorderlessJobParameter(optionJson, jobParams);
optionJson["borderless"] = "false";
optionJson["isBorderless"] = false;
printCupsClient.UpdateBorderlessJobParameter(optionJson, jobParams);
EXPECT_EQ(jobParams->borderless, 0);
optionJson["borderless"] = "true";
optionJson["isBorderless"] = true;
printCupsClient.UpdateBorderlessJobParameter(optionJson, jobParams);
EXPECT_EQ(jobParams->borderless, 1);