|
| 1 | +package com.itextpdf.html2pdf.css.resolve; |
| 2 | + |
| 3 | +import com.itextpdf.html2pdf.ExtendedHtmlConversionITextTest; |
| 4 | +import com.itextpdf.styledxmlparser.logs.StyledXmlParserLogMessageConstant; |
| 5 | +import com.itextpdf.test.annotations.LogMessage; |
| 6 | +import com.itextpdf.test.annotations.LogMessages; |
| 7 | +import org.junit.jupiter.api.BeforeAll; |
| 8 | +import org.junit.jupiter.api.Tag; |
| 9 | +import org.junit.jupiter.api.Test; |
| 10 | + |
| 11 | +import java.io.IOException; |
| 12 | + |
| 13 | +@Tag("IntegrationTest") |
| 14 | +public class CssVariableResolverTest extends ExtendedHtmlConversionITextTest { |
| 15 | + private static final String SOURCE_FOLDER = "./src/test/resources/com/itextpdf/html2pdf/css" |
| 16 | + + "/CssVariableResolverTest/"; |
| 17 | + private static final String DESTINATION_FOLDER = "./target/test/com/itextpdf/html2pdf/css" |
| 18 | + + "/CssVariableResolverTest/"; |
| 19 | + |
| 20 | + @BeforeAll |
| 21 | + public static void beforeClass() { |
| 22 | + createOrClearDestinationFolder(DESTINATION_FOLDER); |
| 23 | + } |
| 24 | + |
| 25 | + @Test |
| 26 | + public void variableScopeTest() throws IOException, InterruptedException { |
| 27 | + convertToPdfAndCompare("variableScope", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 28 | + } |
| 29 | + |
| 30 | + @Test |
| 31 | + public void reversedDeclarationVariableScopeTest() throws IOException, InterruptedException { |
| 32 | + convertToPdfAndCompare("reversedDeclarationVariableScope", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 33 | + } |
| 34 | + |
| 35 | + @Test |
| 36 | + public void defaultValueTest() throws IOException, InterruptedException { |
| 37 | + convertToPdfAndCompare("defaultValue", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 38 | + } |
| 39 | + |
| 40 | + @Test |
| 41 | + public void incorrectDefaultValueTest() throws IOException, InterruptedException { |
| 42 | + convertToPdfAndCompare("incorrectDefaultValue", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 43 | + } |
| 44 | + |
| 45 | + @Test |
| 46 | + public void simpleRootSelectorTest() throws IOException, InterruptedException { |
| 47 | + convertToPdfAndCompare("simpleRootSelector", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 48 | + } |
| 49 | + |
| 50 | + @Test |
| 51 | + public void varInSameContextTest() throws IOException, InterruptedException { |
| 52 | + convertToPdfAndCompare("varInSameContext", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 53 | + } |
| 54 | + |
| 55 | + @LogMessages(messages = @LogMessage(messageTemplate = StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)) |
| 56 | + @Test |
| 57 | + public void varOverridingTest() throws IOException, InterruptedException { |
| 58 | + convertToPdfAndCompare("varOverriding", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 59 | + } |
| 60 | + |
| 61 | + @LogMessages(messages = @LogMessage(messageTemplate = StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)) |
| 62 | + @Test |
| 63 | + public void varInheritanceTest() throws IOException, InterruptedException { |
| 64 | + convertToPdfAndCompare("varInheritance", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 65 | + } |
| 66 | + |
| 67 | + @LogMessages(messages = @LogMessage(messageTemplate = StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)) |
| 68 | + @Test |
| 69 | + public void rootSelectorTest() throws IOException, InterruptedException { |
| 70 | + convertToPdfAndCompare("rootSelector", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 71 | + } |
| 72 | + |
| 73 | + @Test |
| 74 | + public void backgroundTest() throws IOException, InterruptedException { |
| 75 | + convertToPdfAndCompare("background", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 76 | + } |
| 77 | + |
| 78 | + @Test |
| 79 | + public void varAsShorthandTest() throws IOException, InterruptedException { |
| 80 | + convertToPdfAndCompare("varAsShorthand", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 81 | + } |
| 82 | + |
| 83 | + @Test |
| 84 | + public void varInShorthandTest() throws IOException, InterruptedException { |
| 85 | + convertToPdfAndCompare("varInShorthand", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 86 | + } |
| 87 | + |
| 88 | + @Test |
| 89 | + public void varsInShorthandTest() throws IOException, InterruptedException { |
| 90 | + convertToPdfAndCompare("varsInShorthand", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 91 | + } |
| 92 | + |
| 93 | + @LogMessages(messages = @LogMessage(messageTemplate = StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)) |
| 94 | + @Test |
| 95 | + public void defaultValuesWithValidationTest() throws IOException, InterruptedException { |
| 96 | + convertToPdfAndCompare("defaultValuesWithValidation", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 97 | + } |
| 98 | + |
| 99 | + @LogMessages(messages = @LogMessage(messageTemplate = StyledXmlParserLogMessageConstant.INVALID_CSS_PROPERTY_DECLARATION)) |
| 100 | + @Test |
| 101 | + public void extraSpacesInVarTest() throws IOException, InterruptedException { |
| 102 | + convertToPdfAndCompare("extraSpacesInVar", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 103 | + } |
| 104 | + |
| 105 | + @Test |
| 106 | + public void varInStyleAttributeTest() throws IOException, InterruptedException { |
| 107 | + convertToPdfAndCompare("varInStyleAttribute", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 108 | + } |
| 109 | + |
| 110 | + @Test |
| 111 | + public void complexTest() throws IOException, InterruptedException { |
| 112 | + convertToPdfAndCompare("complex", SOURCE_FOLDER, DESTINATION_FOLDER); |
| 113 | + } |
| 114 | +} |
0 commit comments