Open Maybe-U opened 5 months ago
@Maybe-U You asked me to review. The code looks okay to me, but I'm really not all that familiar with TemplateProcessor, so it needs someone more knowledgeable to review. However, your test may have a problem. Does it actually attempt to read your external images? If the answer is no, there's no problem. If the answer is yes, I'll add some more comments.
@Maybe-U You asked me to review. The code looks okay to me, but I'm really not all that familiar with TemplateProcessor, so it needs someone more knowledgeable to review. However, your test may have a problem. Does it actually attempt to read your external images? If the answer is no, there's no problem. If the answer is yes, I'll add some more comments. @oleibman Thank you very much for your response. My test cases only verified the generation of the DOCX file and did not check the actual content. However, in reality, it is possible to read external or local images, so my answer is yes. this is html content
this is output docx file
@Progi1984 can you review my code thanks you
My testing indicates that your test does attempt to load image https://t7.baidu.com/it/u=4198287529,2774471735&fm=193&f=GIF and will fail if it is not available; that is probably true of your second image as well. The problem is that external files tend to move or be deleted over time, and, when (not if) that happens, the unit test suite will fail. To avoid this problem, I think you might be able to use AbstractWebServerEmbeddedTest
so that the requests are routed to localhost rather than an external site. Again, I'm not all that familiar with it, but there are a lot of tests that use it (e.g. HtmlTest
).
My testing indicates that your test does attempt to load image https://t7.baidu.com/it/u=4198287529,2774471735&fm=193&f=GIF and will fail if it is not available; that is probably true of your second image as well. The problem is that external files tend to move or be deleted over time, and, when (not if) that happens, the unit test suite will fail. To avoid this problem, I think you might be able to use
AbstractWebServerEmbeddedTest
so that the requests are routed to localhost rather than an external site. Again, I'm not all that familiar with it, but there are a lot of tests that use it (e.g.HtmlTest
). @oleibman i am Optimize test cases and handle image loading failures in setHtmlBlock function please have a review thanks!
Description
Add a method to TemplateProcessor for rendering HTML content. support image
Fixes 1