Skip to content

Commit

Permalink
[fix]UT
Browse files Browse the repository at this point in the history
  • Loading branch information
luoxiao-supermap committed Oct 27, 2023
1 parent b482379 commit dc2d68c
Showing 1 changed file with 23 additions and 24 deletions.
47 changes: 23 additions & 24 deletions test/openlayers/core/StyleUtilsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,29 @@ describe('openlayers_StyleUtils', () => {
expect(textStyle.getFill().getColor()).toBe("rgba(0,0,0,1)");
expect(textStyle.getTextAlign()).toBe("middle");
expect(textStyle.getTextBaseline()).toBe("center");

const textStyleMock = {
italic: true,
bold: true,
rotation: true,
outline: 1,
outlineWidth: 1,
backColor: {red:1, green:1, blue:1},
fontWeight: 500,
fontHeight: 1,
fontName: '微软雅黑',
align: 'TOPBASELINE'
};
feature.getProperties = function () {
return {
textStyle: textStyleMock,
TEXT_STYLE_INFO: JSON.stringify({ textStyle: textStyleMock }),
TEXT_FEATURE_CONTENT: 'test',
attributes: {'test': 1},
texts: ['test']
}
}
var style1 = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, mapUrl);
expect(style1.getTextBaseline()).toBe("alphabetic");
// const textStyleMock = {
// italic: true,
// bold: true,
// rotation: true,
// outline: 1,
// outlineWidth: 1,
// backColor: {red:1, green:1, blue:1},
// fontWeight: 500,
// fontHeight: 1,
// fontName: '微软雅黑',
// align: 'TOPBASELINE'
// };
// feature.getProperties = function () {
// return {
// textStyle: textStyleMock,
// TEXT_STYLE_INFO: JSON.stringify({ textStyle: textStyleMock }),
// TEXT_FEATURE_CONTENT: 'test',
// attributes: {'test': 1},
// texts: ['test']
// }
// }
// var style1 = StyleUtils.getValidStyleFromLayerInfo(layerInfo, feature, mapUrl);
// expect(style1.getTextBaseline()).toBe("alphabetic");
done();
} catch (exception) {
console.error("openlayers_StyleUtils': getValidStyleFromLayerInfo_text1'案例失败:" + exception.name + ":" + exception.message);
Expand Down

0 comments on commit dc2d68c

Please sign in to comment.