( child )->setInheritedStyle( mRichText.getFontStyleConfig() );
}
child = child->getNextNode();
}
diff --git a/src/tests/unit_tests/uihtml_tests.cpp b/src/tests/unit_tests/uihtml_tests.cpp
index fe69939bb..53b3752e6 100644
--- a/src/tests/unit_tests/uihtml_tests.cpp
+++ b/src/tests/unit_tests/uihtml_tests.cpp
@@ -1063,7 +1063,7 @@ UTEST( UIHTML, InlineBlockExplicitWidth ) {
}
UTEST( UIHTML, InlineBlockMixedContent ) {
- Engine::instance()->createWindow( WindowSettings( 1024, 768, "Inline Block Mixed Content Test",
+ Engine::instance()->createWindow( WindowSettings( 1024, 653, "Inline Block Mixed Content Test",
WindowStyle::Default, WindowBackend::Default,
32, {}, 1, false, true ),
ContextSettings( false, 0, 0, GLv_default, true, false ) );
@@ -1093,7 +1093,7 @@ UTEST( UIHTML, InlineBlockMixedContent ) {
}
UTEST( UIHTML, InlineBlockWrapIssue ) {
- Engine::instance()->createWindow( WindowSettings( 1024, 768, "Inline Block Wrap Issue Test",
+ Engine::instance()->createWindow( WindowSettings( 1024, 653, "Inline Block Wrap Issue Test",
WindowStyle::Default, WindowBackend::Default,
32, {}, 1, false, true ),
ContextSettings( false, 0, 0, GLv_default, true, false ) );
@@ -1115,3 +1115,61 @@ UTEST( UIHTML, InlineBlockWrapIssue ) {
Engine::destroySingleton();
}
+
+UTEST( UIHTML, InlineBlockBrowserTest ) {
+ Engine::instance()->createWindow( WindowSettings( 1024, 653, "Inline Block Browser Test",
+ WindowStyle::Default, WindowBackend::Default,
+ 32, {}, 1, false, true ),
+ ContextSettings( false, 0, 0, GLv_default, true, false ) );
+
+ UI::UISceneNode* sceneNode = init_test_inline_block();
+
+ const std::string html = R"HTML(
+
+
+
+
+
+
+
+ Here is some normal starting text.
+ This is the target inline-block element. If the container gets too narrow, this solid block drops to the next line, and its internal text will wrap, making the block taller without breaking.
+ And here is the text that comes immediately after. It gets pushed down correctly.
+
+
+
+)HTML";
+
+ sceneNode->loadLayoutFromString( HTMLFormatter::HTMLtoXML( html ) );
+ sceneNode->update( Seconds( 1 ) );
+
+ auto ib = sceneNode->getRoot()->find( "ib" )->asType();
+ auto t1 = sceneNode->getRoot()->find( "t1" )->asType();
+ auto t2 = sceneNode->getRoot()->find( "t2" )->asType();
+
+ ASSERT_TRUE( ib != nullptr && t1 != nullptr && t2 != nullptr );
+
+ // If it drops to the next line:
+ EXPECT_GT( ib->getPixelsPosition().y, t1->getPixelsPosition().y );
+ // And t2 should be AFTER ib (either horizontally or vertically)
+ EXPECT_GE( t2->getPixelsPosition().y, ib->getPixelsPosition().y );
+ if ( t2->getPixelsPosition().y == ib->getPixelsPosition().y ) {
+ EXPECT_GE( t2->getPixelsPosition().x,
+ ib->getPixelsPosition().x + ib->getPixelsSize().getWidth() );
+ }
+
+ Engine::destroySingleton();
+}