Re: ctest layout test failing for latexcolors.module

"Jürgen Spitzmüller" <[email protected]>
Newsgroups gmane.editors.lyx.devel
Message-ID <[email protected]>
Scott Kostyshak schrieb am 09.03.2026 22:10 (GMT +01:00):
> I'm not sure what else to look at. If no one else has an idea, we may
> just consider ignoring this test.

Can you try if the attached patch helps?

Jürgen

-- 
lyx-devel mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-devel
69afe66e2fe8c (text/x-diff, 2.4 KB)
diff --git a/src/tests/dummy4checklayout.cpp b/src/tests/dummy4checklayout.cpp
index 77335b1e91..1d96887fd2 100644
--- a/src/tests/dummy4checklayout.cpp
+++ b/src/tests/dummy4checklayout.cpp
@@ -25,6 +25,7 @@
 #include "output_xhtml.h"
 #include "xml.h"
 
+#include "support/Lexer.h"
 #include "support/Messages.h"
 
 #include <iostream>
@@ -64,9 +65,90 @@ LaTeXColor LaTeXColors::getLaTeXColor(string const & /* name */)
 	return LaTeXColor();
 }
 
-bool LaTeXColor::read(lyx::support::Lexer&)
+bool LaTeXColor::read(lyx::support::Lexer & lex)
 {
+	if (!lex.next()) {
+		lex.printError("No name given for LaTeX color: `$$Token'.");
+		return false;
+	}
+
+	string const name = lex.getString();
+	if (!readColor(lex)) {
+		LYXERR0("Error parsing Color `" << name << '\'');
+		return false;
+	}
+
 	return true;
 }
 
+
+bool LaTeXColor::readColor(lyx::support::Lexer & lex)
+{
+	enum LaTeXColorTags {
+		LC_CATEGORY = 1,
+		LC_CMYK,
+		LC_COLOR_MODEL,
+		LC_END,
+		LC_GUINAME,
+		LC_HEXNAME,
+		LC_LATEXNAME,
+		LC_REQUIRES,
+		LC_SVG_CLASH
+	};
+
+	// Keep these sorted alphabetically!
+	lyx::support::LexerKeyword latexColorTags[] = {
+		{ "category",             LC_CATEGORY },
+		{ "cmyk",                 LC_CMYK },
+		{ "colormodel",           LC_COLOR_MODEL },
+		{ "endcolor",             LC_END },
+		{ "guiname",              LC_GUINAME },
+		{ "hexname",              LC_HEXNAME },
+		{ "latexname",            LC_LATEXNAME },
+		{ "requires",             LC_REQUIRES },
+		{ "svgclash",             LC_SVG_CLASH },
+	};
+
+	bool error = false;
+	bool finished = false;
+	lex.pushTable(latexColorTags);
+	// parse style section
+	while (!finished && lex.isOK() && !error) {
+		int le = lex.lex();
+		// See comment in LyXRC.cpp.
+		switch (le) {
+		case lyx::support::Lexer::LEX_FEOF:
+			continue;
+
+		case lyx::support::Lexer::LEX_UNDEF: // parse error
+			lex.printError("Unknown LaTeXColor tag `$$Token'");
+			error = true;
+			continue;
+
+		default:
+			break;
+		}
+		switch (static_cast<LaTeXColorTags>(le)) {
+		case LC_END: // end of structure
+			finished = true;
+			break;
+		case LC_GUINAME:
+		case LC_HEXNAME:
+		case LC_CATEGORY:
+		case LC_CMYK:
+		case LC_COLOR_MODEL:
+		case LC_LATEXNAME: 
+		case LC_SVG_CLASH:
+		case LC_REQUIRES:
+			break;
+		}
+	}
+	if (!finished) {
+		lex.printError("No EndColor tag found for LaTeXColor tag `$$Token'");
+		return false;
+	}
+	lex.popTable();
+	return finished && !error;
+}
+
 } // namespace lyx
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.