@@ -268,96 +268,20 @@ public class HwTests
268268 [ InlineData ( "T1850.html" ) ]
269269 public void HW001 ( string name )
270270 {
271- #if false
272- string [ ] cssFilter = new [ ] {
273- "text-indent" ,
274- "margin-left" ,
275- "margin-right" ,
276- "padding-left" ,
277- "padding-right" ,
278- } ;
279- #else
280- string [ ] cssFilter = null ;
281- #endif
282-
283- #if false
284- string [ ] htmlFilter = new [ ] {
285- "img" ,
286- } ;
287- #else
288- string [ ] htmlFilter = null ;
289- #endif
290-
291271 var sourceDir = new DirectoryInfo ( "../../../../TestFiles/" ) ;
292272 var sourceHtmlFi = new FileInfo ( Path . Combine ( sourceDir . FullName , name ) ) ;
293273 var sourceImageDi = new DirectoryInfo ( Path . Combine ( sourceDir . FullName , sourceHtmlFi . Name . Replace ( ".html" , "_files" ) ) ) ;
294-
295- var destImageDi = new DirectoryInfo ( Path . Combine ( TestUtil . TempDir . FullName , sourceImageDi . Name ) ) ;
296- var sourceCopiedToDestHtmlFi = new FileInfo ( Path . Combine ( TestUtil . TempDir . FullName , sourceHtmlFi . Name . Replace ( ".html" , "-1-Source.html" ) ) ) ;
297274 var destCssFi = new FileInfo ( Path . Combine ( TestUtil . TempDir . FullName , sourceHtmlFi . Name . Replace ( ".html" , "-2.css" ) ) ) ;
298275 var destDocxFi = new FileInfo ( Path . Combine ( TestUtil . TempDir . FullName , sourceHtmlFi . Name . Replace ( ".html" , "-3-ConvertedByHtmlToWml.docx" ) ) ) ;
299276 var annotatedHtmlFi = new FileInfo ( Path . Combine ( TestUtil . TempDir . FullName , sourceHtmlFi . Name . Replace ( ".html" , "-4-Annotated.txt" ) ) ) ;
300277
301- if ( ! sourceCopiedToDestHtmlFi . Exists )
302- {
303- File . Copy ( sourceHtmlFi . FullName , sourceCopiedToDestHtmlFi . FullName ) ;
304- }
305-
306- var html = HtmlToWmlReadAsXElement . ReadAsXElement ( sourceCopiedToDestHtmlFi ) ;
307-
308- var htmlString = html . ToString ( ) ;
309- if ( htmlFilter != null && htmlFilter . Any ( ) )
310- {
311- var found = false ;
312- foreach ( var item in htmlFilter )
313- {
314- if ( htmlString . Contains ( item ) )
315- {
316- found = true ;
317- break ;
318- }
319- }
320- if ( ! found )
321- {
322- sourceCopiedToDestHtmlFi . Delete ( ) ;
323- return ;
324- }
325- }
326-
278+ var html = HtmlToWmlReadAsXElement . ReadAsXElement ( sourceHtmlFi ) ;
327279 var usedAuthorCss = HtmlToWmlConverter . CleanUpCss ( ( string ) html . Descendants ( ) . FirstOrDefault ( d => d . Name . LocalName . ToLower ( ) == "style" ) ) ;
328280 File . WriteAllText ( destCssFi . FullName , usedAuthorCss ) ;
329281
330- if ( cssFilter != null && cssFilter . Any ( ) )
331- {
332- var found = false ;
333- foreach ( var item in cssFilter )
334- {
335- if ( usedAuthorCss . Contains ( item ) )
336- {
337- found = true ;
338- break ;
339- }
340- }
341- if ( ! found )
342- {
343- sourceCopiedToDestHtmlFi . Delete ( ) ;
344- destCssFi . Delete ( ) ;
345- return ;
346- }
347- }
348-
349- if ( sourceImageDi . Exists )
350- {
351- destImageDi . Create ( ) ;
352- foreach ( var file in sourceImageDi . GetFiles ( ) )
353- {
354- File . Copy ( file . FullName , destImageDi . FullName + "/" + file . Name ) ;
355- }
356- }
357-
358282 var settings = HtmlToWmlConverter . GetDefaultSettings ( ) ;
359283 // image references in HTML files contain the path to the subdir that contains the images, so base URI is the name of the directory that contains the HTML files
360- settings . BaseUriForImages = Path . Combine ( TestUtil . TempDir . FullName ) ;
284+ settings . BaseUriForImages = sourceDir . FullName ;
361285
362286 var doc = HtmlToWmlConverter . ConvertHtmlToWml ( defaultCss , usedAuthorCss , userCss , html , settings , null , s_ProduceAnnotatedHtml ? annotatedHtmlFi . FullName : null ) ;
363287 Assert . NotNull ( doc ) ;
0 commit comments