MCPcopy Create free account
hub / github.com/axmolengine/axmol / initWrapOption

Method initWrapOption

tests/cpp-tests/Source/LabelTest/LabelTest.cpp:2603–2630  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2601}
2602
2603void LabelLayoutBaseTest::initWrapOption(const ax::Size& size)
2604{
2605 auto label = Label::createWithSystemFont("Enable Wrap:", "Arial", 10);
2606 label->setColor(Color3B::WHITE);
2607 label->setPosition(Vec2(size.width * 0.8f - 100, size.height * 0.8f));
2608 this->addChild(label);
2609
2610 CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png", "cocosui/check_box_normal_press.png",
2611 "cocosui/check_box_active.png", "cocosui/check_box_normal_disable.png",
2612 "cocosui/check_box_active_disable.png");
2613 checkBox->setPosition(Vec2(size.width * 0.8f - 55, size.height * 0.8f));
2614 checkBox->setScale(0.5);
2615 checkBox->setSelected(true);
2616 checkBox->setName("toggleWrap");
2617
2618 checkBox->addEventListener([this](Object* /*sender*/, CheckBox::EventType event) {
2619 if (event == CheckBox::EventType::SELECTED)
2620 {
2621 _label->enableWrap(true);
2622 }
2623 else
2624 {
2625 _label->enableWrap(false);
2626 }
2627 this->updateDrawNodeSize(_label->getContentSize());
2628 });
2629 this->addChild(checkBox);
2630}
2631
2632void LabelLayoutBaseTest::initToggleLabelTypeOption(const ax::Size& size)
2633{

Callers 1

LabelLayoutBaseTestMethod · 0.95

Calls 12

updateDrawNodeSizeMethod · 0.95
createFunction · 0.85
enableWrapMethod · 0.80
Vec2Function · 0.50
setColorMethod · 0.45
setPositionMethod · 0.45
addChildMethod · 0.45
setScaleMethod · 0.45
setSelectedMethod · 0.45
setNameMethod · 0.45
addEventListenerMethod · 0.45
getContentSizeMethod · 0.45

Tested by

no test coverage detected