Commit b8bb47d4 authored by jan.koester's avatar jan.koester
Browse files

test

parent 387177fd
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -1007,9 +1007,14 @@ void blogi::htmlimport::htmlElementToWidgetXml(
                    w->SetAttribute("object_fit", cssProps["object-fit"].c_str());
                if (cssProps.count("border-radius"))
                    w->SetAttribute("border_radius", cssProps["border-radius"].c_str());
                if (cssProps.count("border"))
                    w->SetAttribute("border_style", cssProps["border"].c_str());
                if (cssMeansHidden(cssProps))
                    w->SetAttribute("hidden", "true");

                std::vector<std::string> knownCss = {
                    "width","height","object-fit","border-radius","display"};
                    "width","height","object-fit","border-radius","border",
                    "display","visibility"};
                std::string custom = extractCustomCss(cssProps, knownCss, mediaRules, cssClass, elemId);
                if (!custom.empty()) {
                    tinyxml2::XMLElement *ccEl = doc.NewElement("CustomCss");
+20 −0
Original line number Diff line number Diff line
@@ -370,6 +370,26 @@ int main(){
              "visibility:hidden on a Table maps to hidden=\"true\" (previously silently dropped)");
    }

    // --- Image CSS properties reach the Image widget's own attributes ---
    std::cout << "=== Image CSS properties ===" << std::endl;
    {
        std::string html =
            "<img src=\"/a.jpg\" style=\"border: 1px solid #333; "
            "visibility:hidden\">";
        std::string xml = importXml(html);
        check(xml.find("<Image") != std::string::npos,
              "an <img> still produces an Image widget");
        check(xml.find("border_style=\"1px solid #333\"") != std::string::npos,
              "border reaches the Image's border_style attribute (previously fell through to CustomCss)");
        check(xml.find("hidden=\"true\"") != std::string::npos,
              "visibility:hidden on an Image maps to hidden=\"true\" (previously silently dropped)");
    }
    {
        std::string xml = importXml("<img src=\"/a.jpg\" style=\"display:none\">");
        check(xml.find("hidden=\"true\"") != std::string::npos,
              "display:none on an Image maps to hidden=\"true\" (previously silently dropped)");
    }

    // --- Summary ---
    std::cout << "\n=== " << passCount << "/" << testCount << " tests passed ===" << std::endl;