Project

General

Profile

Bug #7669 » 0003-Extra-tests-for-WContainerWidget-addwidget-family.patch

Bruce Toll, 10/23/2020 03:03 PM

View differences:

test/widgets/WContainerWidgetTest.C
auto messageBox = testApp.root()->addNew<WMessageBox>();
BOOST_CHECK_NE(messageBox->parent(), testApp.root());
}
BOOST_AUTO_TEST_CASE( containerwidget_addwidget )
{
Wt::Test::WTestEnvironment environment;
Wt::WApplication testApp(environment);
auto container = testApp.root()->addWidget(std::make_unique<WContainerWidget>());
BOOST_CHECK_EQUAL(container->parent(), testApp.root());
auto popupMenu = testApp.root()->addWidget(std::make_unique<WPopupMenu>());
BOOST_CHECK_NE(popupMenu->parent(), testApp.root());
auto popupWidget = testApp.root()->addWidget(std::make_unique<WPopupWidget>(std::make_unique<WContainerWidget>()));
BOOST_CHECK_NE(popupWidget->parent(), testApp.root());
auto dialog = testApp.root()->addWidget(std::make_unique<WDialog>());
BOOST_CHECK_NE(dialog->parent(), testApp.root());
auto messageBox = testApp.root()->addWidget(std::make_unique<WMessageBox>());
BOOST_CHECK_NE(messageBox->parent(), testApp.root());
}
BOOST_AUTO_TEST_CASE( containerwidget_insertwidget )
{
Wt::Test::WTestEnvironment environment;
Wt::WApplication testApp(environment);
auto containerZero = testApp.root()->addWidget(std::make_unique<WContainerWidget>());
auto container = testApp.root()->insertWidget(0, std::make_unique<WContainerWidget>());
BOOST_CHECK_EQUAL(container->parent(), testApp.root());
auto popupMenu = testApp.root()->insertWidget(0, std::make_unique<WPopupMenu>());
BOOST_CHECK_NE(popupMenu->parent(), testApp.root());
auto popupWidget = testApp.root()->insertWidget(0, std::make_unique<WPopupWidget>(std::make_unique<WContainerWidget>()));
BOOST_CHECK_NE(popupWidget->parent(), testApp.root());
auto dialog = testApp.root()->insertWidget(0, std::make_unique<WDialog>());
BOOST_CHECK_NE(dialog->parent(), testApp.root());
auto messageBox = testApp.root()->insertWidget(0, std::make_unique<WMessageBox>());
BOOST_CHECK_NE(messageBox->parent(), testApp.root());
}
BOOST_AUTO_TEST_CASE( containerwidget_insertbefore )
{
Wt::Test::WTestEnvironment environment;
Wt::WApplication testApp(environment);
auto containerZero = testApp.root()->addWidget(std::make_unique<WContainerWidget>());
auto container = testApp.root()->insertBefore(std::make_unique<WContainerWidget>(), containerZero);
BOOST_CHECK_EQUAL(container->parent(), testApp.root());
auto popupMenu = testApp.root()->insertBefore(std::make_unique<WPopupMenu>(), containerZero);
BOOST_CHECK_NE(popupMenu->parent(), testApp.root());
auto popupWidget = testApp.root()->insertBefore(std::make_unique<WPopupWidget>(std::make_unique<WContainerWidget>()), containerZero);
BOOST_CHECK_NE(popupWidget->parent(), testApp.root());
auto dialog = testApp.root()->insertBefore(std::make_unique<WDialog>(), containerZero);
BOOST_CHECK_NE(dialog->parent(), testApp.root());
auto messageBox = testApp.root()->insertBefore(std::make_unique<WMessageBox>(), containerZero);
BOOST_CHECK_NE(messageBox->parent(), testApp.root());
}
(3-3/3)