diff --git a/tests/PhpWordTests/Shared/Html2Test.php b/tests/PhpWordTests/Shared/Html2Test.php
index 95866d4b07..64a71932dd 100644
--- a/tests/PhpWordTests/Shared/Html2Test.php
+++ b/tests/PhpWordTests/Shared/Html2Test.php
@@ -137,4 +137,68 @@ public function testListTypes(): void
$numIdPath = $path . '/w:pPr/w:numPr/w:numId';
self::assertSame($expected, $doc->getElement($numIdPath)->getAttribute('w:val'));
}
+
+ public function testPadding(): void
+ {
+ $phpWord = new PhpWord();
+ $section = $phpWord->addSection();
+ $html = '
'
+ . ''
+ . '20 | '
+ . '20 30 | '
+ . '
'
+ . '20 30 40 | '
+ . '20 30 40 50 | '
+ . '
';
+ Html::addHtml($section, $html);
+ $doc = TestHelperDOCX::getDocument($phpWord);
+
+ $item = 1;
+ $td = 1;
+ $path = "/w:document/w:body/w:tbl/w:tr[$item]/w:tc[$td]";
+ self::assertSame('20', $doc->getElement("$path/w:p/w:r")->nodeValue);
+ $tcMarPath = $path . '/w:tcPr/w:tcMar';
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:top')->getAttribute('w:w'));
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:start')->getAttribute('w:w'));
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:bottom')->getAttribute('w:w'));
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:end')->getAttribute('w:w'));
+
+ ++$td;
+ $path = "/w:document/w:body/w:tbl/w:tr[$item]/w:tc[$td]";
+ self::assertSame('20 30', $doc->getElement("$path/w:p/w:r")->nodeValue);
+ $tcMarPath = $path . '/w:tcPr/w:tcMar';
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:top')->getAttribute('w:w'));
+ self::assertSame('450', $doc->getElement($tcMarPath . '/w:start')->getAttribute('w:w'));
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:bottom')->getAttribute('w:w'));
+ self::assertSame('450', $doc->getElement($tcMarPath . '/w:end')->getAttribute('w:w'));
+
+ $item = 1;
+ $td = 1;
+ $path = "/w:document/w:body/w:tbl/w:tr[$item]/w:tc[$td]";
+ self::assertSame('20', $doc->getElement("$path/w:p/w:r")->nodeValue);
+ $tcMarPath = $path . '/w:tcPr/w:tcMar';
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:top')->getAttribute('w:w'));
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:start')->getAttribute('w:w'));
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:bottom')->getAttribute('w:w'));
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:end')->getAttribute('w:w'));
+
+ ++$item;
+ $td = 1;
+ $path = "/w:document/w:body/w:tbl/w:tr[$item]/w:tc[$td]";
+ self::assertSame('20 30 40', $doc->getElement("$path/w:p/w:r")->nodeValue);
+ $tcMarPath = $path . '/w:tcPr/w:tcMar';
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:top')->getAttribute('w:w'));
+ self::assertSame('450', $doc->getElement($tcMarPath . '/w:start')->getAttribute('w:w'));
+ self::assertSame('600', $doc->getElement($tcMarPath . '/w:bottom')->getAttribute('w:w'));
+ self::assertSame('450', $doc->getElement($tcMarPath . '/w:end')->getAttribute('w:w'));
+
+ ++$td;
+ $path = "/w:document/w:body/w:tbl/w:tr[$item]/w:tc[$td]";
+ self::assertSame('20 30 40 50', $doc->getElement("$path/w:p/w:r")->nodeValue);
+ $tcMarPath = $path . '/w:tcPr/w:tcMar';
+ self::assertSame('300', $doc->getElement($tcMarPath . '/w:top')->getAttribute('w:w'));
+ self::assertSame('750', $doc->getElement($tcMarPath . '/w:start')->getAttribute('w:w'));
+ self::assertSame('600', $doc->getElement($tcMarPath . '/w:bottom')->getAttribute('w:w'));
+ self::assertSame('450', $doc->getElement($tcMarPath . '/w:end')->getAttribute('w:w'));
+ }
}