17 changed files with 748 additions and 11 deletions
			
			
		@ -0,0 +1,10 @@ | 
				
			|||||
 | 
					#ifndef PREFIX_P_H | 
				
			||||
 | 
					#define PREFIX_P_H | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					#if defined(BUILD_QSETTINGSGENERATOR) | 
				
			||||
 | 
					#define Q_MVVMCORE_EXPORT | 
				
			||||
 | 
					#else | 
				
			||||
 | 
					#include "qtmvvmcore_global.h" | 
				
			||||
 | 
					#endif | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					#endif // PREFIX_P_H
 | 
				
			||||
@ -0,0 +1,31 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
 | 
					<SettingsConfig allowSearch="false" allowRestore="false"> | 
				
			||||
 | 
						<Category/> | 
				
			||||
 | 
						<Category> | 
				
			||||
 | 
							<Entry key="direct" | 
				
			||||
 | 
								   type="double"/> | 
				
			||||
 | 
						</Category> | 
				
			||||
 | 
						<Category> | 
				
			||||
 | 
							<Group/> | 
				
			||||
 | 
							<Group> | 
				
			||||
 | 
								<Entry key="indirect" | 
				
			||||
 | 
									   type="double"/> | 
				
			||||
 | 
							</Group> | 
				
			||||
 | 
						</Category> | 
				
			||||
 | 
						<Category title="main" | 
				
			||||
 | 
								  icon="http://example.com/favicon.png" | 
				
			||||
 | 
								  tooltip="another tooltip"> | 
				
			||||
 | 
							<Section/> | 
				
			||||
 | 
							<Section> | 
				
			||||
 | 
								<Entry key="subdirect" | 
				
			||||
 | 
									   type="double"/> | 
				
			||||
 | 
							</Section> | 
				
			||||
 | 
							<Section> | 
				
			||||
 | 
								<Group/> | 
				
			||||
 | 
								<Group> | 
				
			||||
 | 
									<Entry key="fardirect" | 
				
			||||
 | 
										   type="double"/> | 
				
			||||
 | 
								</Group> | 
				
			||||
 | 
							</Section> | 
				
			||||
 | 
						</Category> | 
				
			||||
 | 
					</SettingsConfig> | 
				
			||||
@ -0,0 +1,36 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
 | 
					<SettingsConfig allowSearch="true" allowRestore="true"> | 
				
			||||
 | 
						<Entry key="minimal" | 
				
			||||
 | 
							   type="bool"/> | 
				
			||||
 | 
						<Entry key="full" | 
				
			||||
 | 
							   type="string" | 
				
			||||
 | 
							   title="FULL" | 
				
			||||
 | 
							   tooltip="full tip" | 
				
			||||
 | 
							   default="hello world" | 
				
			||||
 | 
							   trdefault="false"/> | 
				
			||||
 | 
						<Entry key="search" | 
				
			||||
 | 
							   type="int"> | 
				
			||||
 | 
							<SearchKey>hello</SearchKey> | 
				
			||||
 | 
							<SearchKey>world</SearchKey> | 
				
			||||
 | 
						</Entry> | 
				
			||||
 | 
						<Entry key="elements" | 
				
			||||
 | 
							   type="double"> | 
				
			||||
 | 
							<Property key="simple" type="int">42</Property> | 
				
			||||
 | 
							<Property key="literal" type="string">baum42</Property> | 
				
			||||
 | 
							<Property key="list" type="list"> | 
				
			||||
 | 
								<Element type="int">13</Element> | 
				
			||||
 | 
								<Element type="list"> | 
				
			||||
 | 
									<Element type="number">4.2</Element> | 
				
			||||
 | 
								</Element> | 
				
			||||
 | 
								<Element type="object"> | 
				
			||||
 | 
									<Property key="simple" type="int">42</Property> | 
				
			||||
 | 
								</Element> | 
				
			||||
 | 
							</Property> | 
				
			||||
 | 
							<Property key="map" type="object"> | 
				
			||||
 | 
								<Property key="simple" type="int">42</Property> | 
				
			||||
 | 
								<Property key="list" type="list"> | 
				
			||||
 | 
									<Element type="number">4.2</Element> | 
				
			||||
 | 
								</Property> | 
				
			||||
 | 
							</Property> | 
				
			||||
 | 
						</Entry> | 
				
			||||
 | 
					</SettingsConfig> | 
				
			||||
@ -0,0 +1,14 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
 | 
					<SettingsConfig allowSearch="true" allowRestore="true"> | 
				
			||||
 | 
						<Group/> | 
				
			||||
 | 
						<Group> | 
				
			||||
 | 
							<Entry key="minimal" | 
				
			||||
 | 
								   type="bool"/> | 
				
			||||
 | 
						</Group> | 
				
			||||
 | 
						<Group title="FULL" tooltip="full"> | 
				
			||||
 | 
							<Entry key="a" | 
				
			||||
 | 
								   type="bool"/> | 
				
			||||
 | 
							<Entry key="b" | 
				
			||||
 | 
								   type="bool"/> | 
				
			||||
 | 
						</Group> | 
				
			||||
 | 
					</SettingsConfig> | 
				
			||||
@ -0,0 +1,17 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
 | 
					<SettingsConfig allowSearch="false" allowRestore="false"> | 
				
			||||
 | 
						<Section/> | 
				
			||||
 | 
						<Section> | 
				
			||||
 | 
							<Entry key="direct" | 
				
			||||
 | 
								   type="double"/> | 
				
			||||
 | 
						</Section> | 
				
			||||
 | 
						<Section title="master" | 
				
			||||
 | 
								 icon="file:///path/to/vengance.png" | 
				
			||||
 | 
								 tooltip="ruler"> | 
				
			||||
 | 
							<Group/> | 
				
			||||
 | 
							<Group> | 
				
			||||
 | 
								<Entry key="indirect" | 
				
			||||
 | 
									   type="double"/> | 
				
			||||
 | 
							</Group> | 
				
			||||
 | 
						</Section> | 
				
			||||
 | 
					</SettingsConfig> | 
				
			||||
@ -0,0 +1,30 @@ | 
				
			|||||
 | 
					<?xml version="1.0" encoding="UTF-8"?> | 
				
			||||
 | 
					<SettingsConfig allowSearch="false" allowRestore="false"> | 
				
			||||
 | 
						<Category frontends="widgets" /> | 
				
			||||
 | 
						<Category> | 
				
			||||
 | 
							<Section frontends="quick" /> | 
				
			||||
 | 
							<Section> | 
				
			||||
 | 
								<Group frontends="widgets|console"/> | 
				
			||||
 | 
								<Group> | 
				
			||||
 | 
									<Entry key="t1" | 
				
			||||
 | 
										   type="bool" | 
				
			||||
 | 
										   frontends="quick|console"/> | 
				
			||||
 | 
								</Group> | 
				
			||||
 | 
							</Section> | 
				
			||||
 | 
						</Category> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						<Category selectors="b1" /> | 
				
			||||
 | 
						<Category> | 
				
			||||
 | 
							<Section selectors="b2|a2" /> | 
				
			||||
 | 
							<Section> | 
				
			||||
 | 
								<Group selectors="a1&a2"/> | 
				
			||||
 | 
								<Group> | 
				
			||||
 | 
									<Entry key="t2" | 
				
			||||
 | 
										   type="bool" | 
				
			||||
 | 
										   selectors="a1&a2|b2&a3"/> | 
				
			||||
 | 
								</Group> | 
				
			||||
 | 
							</Section> | 
				
			||||
 | 
						</Category> | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						<Category frontends="console|widgets" selectors="a1&a2|b1"/> | 
				
			||||
 | 
					</SettingsConfig> | 
				
			||||
@ -0,0 +1,26 @@ | 
				
			|||||
 | 
					TEMPLATE = app | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					QT += testlib mvvmcore mvvmcore-private | 
				
			||||
 | 
					QT -= gui | 
				
			||||
 | 
					CONFIG += console | 
				
			||||
 | 
					CONFIG -= app_bundle | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					TARGET = tst_settingsconfigloader | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DEFINES += SRCDIR=\\\"$$_PRO_FILE_PWD_\\\" | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					INCLUDEPATH += \ | 
				
			||||
 | 
						../../../../src/settingsconfig \ | 
				
			||||
 | 
						$$shadowed(../../../../src/mvvmcore) \ | 
				
			||||
 | 
						../../../../src/3rdparty/optional-lite \ | 
				
			||||
 | 
						../../../../src/3rdparty/variant-lite | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					SOURCES += \ | 
				
			||||
 | 
						tst_settingsconfigloader.cpp | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					DISTFILES += \ | 
				
			||||
 | 
					    entryDocument.xml \ | 
				
			||||
 | 
					    groupDocument.xml \ | 
				
			||||
 | 
					    sectionDocument.xml \ | 
				
			||||
 | 
					    categoryDocument.xml \ | 
				
			||||
 | 
					    selectorDocument.xml | 
				
			||||
@ -0,0 +1,570 @@ | 
				
			|||||
 | 
					#include <QtTest> | 
				
			||||
 | 
					#include <QtMvvmCore/private/settingsconfigloader_p.h> | 
				
			||||
 | 
					using namespace QtMvvm; | 
				
			||||
 | 
					using namespace QtMvvm::SettingsElements; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					class SettingsConfigLoaderTest : public QObject | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						Q_OBJECT | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					private Q_SLOTS: | 
				
			||||
 | 
						void testConfigLoader_data(); | 
				
			||||
 | 
						void testConfigLoader(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					private: | 
				
			||||
 | 
						Setup createEntryDocumentSetup(); | 
				
			||||
 | 
						Setup createGroupDocumentSetup(); | 
				
			||||
 | 
						Setup createSectionDocumentSetup(); | 
				
			||||
 | 
						Setup createCategoryDocumentSetup(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						Setup createSelectorsSetup0(); | 
				
			||||
 | 
						Setup createSelectorsSetup1(); | 
				
			||||
 | 
						Setup createSelectorsSetup2(); | 
				
			||||
 | 
						Setup createSelectorsSetup3(); | 
				
			||||
 | 
						Setup createSelectorsSetup4(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						Setup createIncludesSetup(); | 
				
			||||
 | 
						Setup createCustomTypesSetup(); | 
				
			||||
 | 
						Setup createIconChangeSetup(); | 
				
			||||
 | 
						Setup createTranslationsSetup(); | 
				
			||||
 | 
					}; | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					void SettingsConfigLoaderTest::testConfigLoader_data() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						QTest::addColumn<QString>("path"); | 
				
			||||
 | 
						QTest::addColumn<QString>("frontend"); | 
				
			||||
 | 
						QTest::addColumn<QStringList>("selectors"); | 
				
			||||
 | 
						QTest::addColumn<bool>("success"); | 
				
			||||
 | 
						QTest::addColumn<Setup>("setup"); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("entryDocument") << QStringLiteral(SRCDIR "/entryDocument.xml") | 
				
			||||
 | 
													   << QStringLiteral("dummy") | 
				
			||||
 | 
													   << QStringList{} | 
				
			||||
 | 
													   << true | 
				
			||||
 | 
													   << createEntryDocumentSetup(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("groupDocument") << QStringLiteral(SRCDIR "/groupDocument.xml") | 
				
			||||
 | 
													   << QStringLiteral("dummy") | 
				
			||||
 | 
													   << QStringList{} | 
				
			||||
 | 
													   << true | 
				
			||||
 | 
													   << createGroupDocumentSetup(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("sectionDocument") << QStringLiteral(SRCDIR "/sectionDocument.xml") | 
				
			||||
 | 
														 << QStringLiteral("dummy") | 
				
			||||
 | 
														 << QStringList{} | 
				
			||||
 | 
														 << true | 
				
			||||
 | 
														 << createSectionDocumentSetup(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("categoryDocument") << QStringLiteral(SRCDIR "/categoryDocument.xml") | 
				
			||||
 | 
														  << QStringLiteral("dummy") | 
				
			||||
 | 
														  << QStringList{} | 
				
			||||
 | 
														  << true | 
				
			||||
 | 
														  << createCategoryDocumentSetup(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("selectorDocument.frontend.widgets") << QStringLiteral(SRCDIR "/selectorDocument.xml") | 
				
			||||
 | 
																		   << QStringLiteral("widgets") | 
				
			||||
 | 
																		   << QStringList{} | 
				
			||||
 | 
																		   << true | 
				
			||||
 | 
																		   << createSelectorsSetup0(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("selectorDocument.frontend.quick") << QStringLiteral(SRCDIR "/selectorDocument.xml") | 
				
			||||
 | 
																		 << QStringLiteral("quick") | 
				
			||||
 | 
																		 << QStringList{} | 
				
			||||
 | 
																		 << true | 
				
			||||
 | 
																		 << createSelectorsSetup1(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("selectorDocument.selector.typeA") << QStringLiteral(SRCDIR "/selectorDocument.xml") | 
				
			||||
 | 
																		 << QStringLiteral("dummy") | 
				
			||||
 | 
																		 << QStringList{ | 
				
			||||
 | 
																				QStringLiteral("a1"), | 
				
			||||
 | 
																				QStringLiteral("b2"), | 
				
			||||
 | 
																				QStringLiteral("a3") | 
				
			||||
 | 
																			} | 
				
			||||
 | 
																		 << true | 
				
			||||
 | 
																		 << createSelectorsSetup2(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("selectorDocument.selector.typeB") << QStringLiteral(SRCDIR "/selectorDocument.xml") | 
				
			||||
 | 
																		 << QStringLiteral("dummy") | 
				
			||||
 | 
																		 << QStringList{ | 
				
			||||
 | 
																				QStringLiteral("b1"), | 
				
			||||
 | 
																				QStringLiteral("a2"), | 
				
			||||
 | 
																				QStringLiteral("b3") | 
				
			||||
 | 
																			} | 
				
			||||
 | 
																		 << true | 
				
			||||
 | 
																		 << createSelectorsSetup3(); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						QTest::newRow("selectorDocument.combined") << QStringLiteral(SRCDIR "/selectorDocument.xml") | 
				
			||||
 | 
																   << QStringLiteral("console") | 
				
			||||
 | 
																   << QStringList{ | 
				
			||||
 | 
																		  QStringLiteral("a1"), | 
				
			||||
 | 
																		  QStringLiteral("a2"), | 
				
			||||
 | 
																		  QStringLiteral("a3") | 
				
			||||
 | 
																	  } | 
				
			||||
 | 
																   << true | 
				
			||||
 | 
																   << createSelectorsSetup4(); | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					void SettingsConfigLoaderTest::testConfigLoader() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						QFETCH(QString, path); | 
				
			||||
 | 
						QFETCH(QString, frontend); | 
				
			||||
 | 
						QFETCH(QStringList, selectors); | 
				
			||||
 | 
						QFETCH(bool, success); | 
				
			||||
 | 
						QFETCH(Setup, setup); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
						try { | 
				
			||||
 | 
							QFileSelector selector; | 
				
			||||
 | 
							selector.setExtraSelectors(selectors); | 
				
			||||
 | 
							SettingsConfigLoader loader; | 
				
			||||
 | 
							loader.changeDefaultIcon(QStringLiteral("qrc:/baum")); | 
				
			||||
 | 
							if(success) { | 
				
			||||
 | 
								auto res = loader.loadSetup(path, frontend, &selector); | 
				
			||||
 | 
					
 | 
				
			||||
 | 
								// compare low-level to be able to catch where errors happend easier
 | 
				
			||||
 | 
								QCOMPARE(res.allowRestore, setup.allowRestore); | 
				
			||||
 | 
								QCOMPARE(res.allowSearch, setup.allowSearch); | 
				
			||||
 | 
								QCOMPARE(res.categories.size(), setup.categories.size()); | 
				
			||||
 | 
								for(auto i = 0; i < setup.categories.size(); i++) { | 
				
			||||
 | 
									const auto &resCat = res.categories[i]; | 
				
			||||
 | 
									const auto &category = setup.categories[i]; | 
				
			||||
 | 
									QCOMPARE(resCat.title, category.title); | 
				
			||||
 | 
									QCOMPARE(resCat.icon, category.icon); | 
				
			||||
 | 
									QCOMPARE(resCat.tooltip, category.tooltip); | 
				
			||||
 | 
									QCOMPARE(resCat.sections.size(), category.sections.size()); | 
				
			||||
 | 
									for(auto j = 0; j < category.sections.size(); j++) { | 
				
			||||
 | 
										const auto &resSec = resCat.sections[j]; | 
				
			||||
 | 
										const auto §ion = category.sections[j]; | 
				
			||||
 | 
										QCOMPARE(resSec.title, section.title); | 
				
			||||
 | 
										QCOMPARE(resSec.icon, section.icon); | 
				
			||||
 | 
										QCOMPARE(resSec.tooltip, section.tooltip); | 
				
			||||
 | 
										QCOMPARE(resSec.groups.size(), section.groups.size()); | 
				
			||||
 | 
										for(auto k = 0; k < section.groups.size(); k++) { | 
				
			||||
 | 
											const auto &resGrp = resSec.groups[k]; | 
				
			||||
 | 
											const auto &group = section.groups[k]; | 
				
			||||
 | 
											QCOMPARE(resGrp.title, group.title); | 
				
			||||
 | 
											QCOMPARE(resGrp.tooltip, group.tooltip); | 
				
			||||
 | 
											QCOMPARE(resGrp.entries.size(), group.entries.size()); | 
				
			||||
 | 
											for(auto l = 0; l < group.entries.size(); l++) { | 
				
			||||
 | 
												const auto &resEnt = resGrp.entries[l]; | 
				
			||||
 | 
												const auto &entry = group.entries[l]; | 
				
			||||
 | 
												QCOMPARE(resEnt.key, entry.key); | 
				
			||||
 | 
												QCOMPARE(resEnt.type, entry.type); | 
				
			||||
 | 
												QCOMPARE(resEnt.title, entry.title); | 
				
			||||
 | 
												QCOMPARE(resEnt.tooltip, entry.tooltip); | 
				
			||||
 | 
												QCOMPARE(resEnt.defaultValue, entry.defaultValue); | 
				
			||||
 | 
												QCOMPARE(resEnt.searchKeys, entry.searchKeys); | 
				
			||||
 | 
												QCOMPARE(resEnt.properties, entry.properties); | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} else | 
				
			||||
 | 
								QVERIFY_EXCEPTION_THROWN(loader.loadSetup(path, frontend, &selector), SettingsConfigException); | 
				
			||||
 | 
						} catch(std::exception &e) { | 
				
			||||
 | 
							if(success) | 
				
			||||
 | 
								QFAIL(e.what()); | 
				
			||||
 | 
						} | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createEntryDocumentSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							true, true, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("minimal"), "bool" | 
				
			||||
 | 
														}, | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("full"), "string", | 
				
			||||
 | 
															QStringLiteral("FULL"), QStringLiteral("full tip"), | 
				
			||||
 | 
															QStringLiteral("hello world") | 
				
			||||
 | 
														}, | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("search"), "int", | 
				
			||||
 | 
															{}, {}, {}, | 
				
			||||
 | 
															{QStringLiteral("hello"), QStringLiteral("world")} | 
				
			||||
 | 
														}, Entry { | 
				
			||||
 | 
															QStringLiteral("elements"), "double", | 
				
			||||
 | 
															{}, {}, {}, {}, | 
				
			||||
 | 
															{ | 
				
			||||
 | 
																{QStringLiteral("simple"), 42}, | 
				
			||||
 | 
																{QStringLiteral("literal"), QStringLiteral("baum42")}, | 
				
			||||
 | 
																{QStringLiteral("list"), QVariantList { | 
				
			||||
 | 
																	13, | 
				
			||||
 | 
																	QVariantList{4.2}, | 
				
			||||
 | 
																	QVariantMap{{QStringLiteral("simple"), 42}} | 
				
			||||
 | 
																}}, | 
				
			||||
 | 
																{QStringLiteral("map"), QVariantMap{ | 
				
			||||
 | 
																	{QStringLiteral("simple"), 42}, | 
				
			||||
 | 
																	{QStringLiteral("list"), QVariantList{4.2}} | 
				
			||||
 | 
																}} | 
				
			||||
 | 
															} | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createGroupDocumentSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							true, true, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {}, | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("minimal"), "bool" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												}, | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													QStringLiteral("FULL"), QStringLiteral("full"), { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("a"), "bool" | 
				
			||||
 | 
														}, | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("b"), "bool" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createSectionDocumentSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							false, false, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General") | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("direct"), "double" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("master"), QStringLiteral("file:///path/to/vengance.png"), | 
				
			||||
 | 
											QStringLiteral("ruler"), { | 
				
			||||
 | 
												Group {}, | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("indirect"), "double" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createCategoryDocumentSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							false, false, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum") | 
				
			||||
 | 
								}, | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("direct"), "double" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {}, | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("indirect"), "double" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("main"), QStringLiteral("http://example.com/favicon.png"), | 
				
			||||
 | 
									QStringLiteral("another tooltip"), { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General") | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("subdirect"), "double" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {}, | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("fardirect"), "double" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createSelectorsSetup0() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							false, false, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum") | 
				
			||||
 | 
								}, | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {}, | 
				
			||||
 | 
												Group {} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createSelectorsSetup1() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							false, false, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General") | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("t1"), "bool" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createSelectorsSetup2() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							false, false, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General") | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("t2"), "bool" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createSelectorsSetup3() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							false, false, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum") | 
				
			||||
 | 
								}, | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General") | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createSelectorsSetup4() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup { | 
				
			||||
 | 
							false, false, { | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {}, | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("t1"), "bool" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum"), {}, { | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General") | 
				
			||||
 | 
										}, | 
				
			||||
 | 
										Section { | 
				
			||||
 | 
											QStringLiteral("General"), {}, {}, { | 
				
			||||
 | 
												Group {}, | 
				
			||||
 | 
												Group { | 
				
			||||
 | 
													{}, {}, { | 
				
			||||
 | 
														Entry { | 
				
			||||
 | 
															QStringLiteral("t2"), "bool" | 
				
			||||
 | 
														} | 
				
			||||
 | 
													} | 
				
			||||
 | 
												} | 
				
			||||
 | 
											} | 
				
			||||
 | 
										} | 
				
			||||
 | 
									} | 
				
			||||
 | 
								}, | 
				
			||||
 | 
					
 | 
				
			||||
 | 
								Category { | 
				
			||||
 | 
									QStringLiteral("General Settings"), QStringLiteral("qrc:/baum") | 
				
			||||
 | 
								} | 
				
			||||
 | 
							} | 
				
			||||
 | 
						}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createIncludesSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup{}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createCustomTypesSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup{}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createIconChangeSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup{}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					Setup SettingsConfigLoaderTest::createTranslationsSetup() | 
				
			||||
 | 
					{ | 
				
			||||
 | 
						return Setup{}; | 
				
			||||
 | 
					} | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					QTEST_MAIN(SettingsConfigLoaderTest) | 
				
			||||
 | 
					
 | 
				
			||||
 | 
					#include "tst_settingsconfigloader.moc" | 
				
			||||
					Loading…
					
					
				
		Reference in new issue