[DEV] generate array and object in one line when they are simple
This commit is contained in:
parent
dfe3beecd6
commit
17ca49b86f
@ -135,18 +135,58 @@ bool ejson::Array::IParse(const etk::UString& _data, int32_t& _pos, ejson::fileP
|
||||
|
||||
bool ejson::Array::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
{
|
||||
_data += "[\n";
|
||||
bool oneLine=true;
|
||||
if (m_value.Size()>3) {
|
||||
oneLine=false;
|
||||
} else {
|
||||
for (esize_t iii=0; iii<m_value.Size() ; iii++) {
|
||||
ejson::Value* tmp = m_value[iii];
|
||||
if (tmp == NULL) {
|
||||
continue;
|
||||
}
|
||||
if (true==tmp->IsObject()) {
|
||||
oneLine=false;
|
||||
break;
|
||||
}
|
||||
if (true==tmp->IsArray()) {
|
||||
oneLine=false;
|
||||
break;
|
||||
}
|
||||
if (true==tmp->IsString()) {
|
||||
ejson::String* tmp2 = tmp->ToString();
|
||||
if (NULL!=tmp2) {
|
||||
if(tmp2->GetValue().Size()>40) {
|
||||
oneLine=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (true==oneLine) {
|
||||
_data += "[ ";
|
||||
} else {
|
||||
_data += "[\n";
|
||||
}
|
||||
for (esize_t iii=0; iii<m_value.Size() ; iii++) {
|
||||
AddIndent(_data, _indent);
|
||||
if (false==oneLine) {
|
||||
AddIndent(_data, _indent);
|
||||
}
|
||||
if (NULL != m_value[iii]) {
|
||||
m_value[iii]->IGenerate(_data, _indent+1);
|
||||
if (iii<m_value.Size()-1) {
|
||||
_data += ",";
|
||||
}
|
||||
}
|
||||
_data += "\n";
|
||||
if (true==oneLine) {
|
||||
_data += " ";
|
||||
} else {
|
||||
_data += "\n";
|
||||
}
|
||||
}
|
||||
if (false==oneLine) {
|
||||
AddIndent(_data, _indent-1);
|
||||
}
|
||||
AddIndent(_data, _indent-1);
|
||||
_data += "]";
|
||||
return true;
|
||||
}
|
||||
|
@ -209,6 +209,8 @@ bool ejson::Object::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
bool oneLine=true;
|
||||
if (m_value.Size()>3) {
|
||||
oneLine=false;
|
||||
} else if (_indent<=1) {
|
||||
oneLine=false;
|
||||
} else {
|
||||
for (esize_t iii=0; iii<m_value.Size() ; iii++) {
|
||||
ejson::Value* tmp = m_value[iii];
|
||||
@ -226,7 +228,8 @@ bool ejson::Object::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
if (true==tmp->IsString()) {
|
||||
ejson::String* tmp2 = tmp->ToString();
|
||||
if (NULL!=tmp2) {
|
||||
if (tmp2->GetValue().Size()>50) {
|
||||
if( tmp2->GetValue().Size()>25
|
||||
|| m_value.GetKey(iii).Size()>25) {
|
||||
oneLine=false;
|
||||
break;
|
||||
}
|
||||
@ -234,11 +237,10 @@ bool ejson::Object::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (false==oneLine) {
|
||||
_data += "{\n";
|
||||
} else {
|
||||
if (true==oneLine) {
|
||||
_data += "{ ";
|
||||
} else {
|
||||
_data += "{\n";
|
||||
}
|
||||
for (esize_t iii=0; iii<m_value.Size() ; iii++) {
|
||||
if (false==oneLine) {
|
||||
@ -251,10 +253,10 @@ bool ejson::Object::IGenerate(etk::UString& _data, int32_t _indent) const
|
||||
if (iii<m_value.Size()-1) {
|
||||
_data += ",";
|
||||
}
|
||||
if (false==oneLine) {
|
||||
_data += "\n";
|
||||
} else {
|
||||
if (true==oneLine) {
|
||||
_data += " ";
|
||||
} else {
|
||||
_data += "\n";
|
||||
}
|
||||
}
|
||||
if (false==oneLine) {
|
||||
|
324
ejson/test.cpp
324
ejson/test.cpp
@ -157,10 +157,7 @@ void Init(void)
|
||||
" \"id\": \"file\",\n"
|
||||
" \"value\": \"File\",\n"
|
||||
" \"popup\": {\n"
|
||||
" \"menuitem\": {\n"
|
||||
" \"value\": \"Close\",\n"
|
||||
" \"onclick\": \"CloseDoc()\"\n"
|
||||
" }\n"
|
||||
" \"menuitem\": { \"value\": \"Close\", \"onclick\": \"CloseDoc()\" }\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
@ -175,22 +172,10 @@ void Init(void)
|
||||
" \"value\": \"File\",\n"
|
||||
" \"popup\": {\n"
|
||||
" \"menuitem\": [\n"
|
||||
" {\n"
|
||||
" \"value\": \"Close\",\n"
|
||||
" \"onclick\": \"CloseDoc()\"\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"value\": \"New\",\n"
|
||||
" \"onclick\": \"CreateNewDoc()\"\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"value\": \"Open\",\n"
|
||||
" \"onclick\": \"OpenDoc()\"\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"value\": \"Close\",\n"
|
||||
" \"onclick\": \"CloseDoc()\"\n"
|
||||
" }\n"
|
||||
" { \"value\": \"Close\", \"onclick\": \"CloseDoc()\" },\n"
|
||||
" { \"value\": \"New\", \"onclick\": \"CreateNewDoc()\" },\n"
|
||||
" { \"value\": \"Open\", \"onclick\": \"OpenDoc()\" },\n"
|
||||
" { \"value\": \"Close\", \"onclick\": \"CloseDoc()\" }\n"
|
||||
" ]\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
@ -273,10 +258,7 @@ void Init(void)
|
||||
" \"Abbrev\": \"ISO 8879:1986\",\n"
|
||||
" \"GlossDef\": {\n"
|
||||
" \"para\": \"A meta-markup language, used to create markup languages such as DocBook.\",\n"
|
||||
" \"GlossSeeAlso\": [\n"
|
||||
" \"GML\",\n"
|
||||
" \"XML\"\n"
|
||||
" ]\n"
|
||||
" \"GlossSeeAlso\": [ \"GML\", \"XML\" ]\n"
|
||||
" },\n"
|
||||
" \"GlossSee\": \"markup\"\n"
|
||||
" }\n"
|
||||
@ -295,18 +277,9 @@ void Init(void)
|
||||
" \"value\": \"File\",\n"
|
||||
" \"popup\": {\n"
|
||||
" \"menuitem\": [\n"
|
||||
" {\n"
|
||||
" \"value\": \"New\",\n"
|
||||
" \"onclick\": \"CreateNewDoc()\"\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"value\": \"Open\",\n"
|
||||
" \"onclick\": \"OpenDoc()\"\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"value\": \"Close\",\n"
|
||||
" \"onclick\": \"CloseDoc()\"\n"
|
||||
" }\n"
|
||||
" { \"value\": \"New\", \"onclick\": \"CreateNewDoc()\" },\n"
|
||||
" { \"value\": \"Open\", \"onclick\": \"OpenDoc()\" },\n"
|
||||
" { \"value\": \"Close\", \"onclick\": \"CloseDoc()\" }\n"
|
||||
" ]\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
@ -316,10 +289,6 @@ void Init(void)
|
||||
reference);
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
reference = "{\n"
|
||||
" \"widget\": {\n"
|
||||
" \"debug\": \"on\",\n"
|
||||
@ -353,147 +322,136 @@ void Init(void)
|
||||
reference);
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
reference = "{\n"
|
||||
"\"web-app\": {\n"
|
||||
" \"servlet\": [\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxCDS\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cds.CDSServlet\",\n"
|
||||
" \"init-param\": {\n"
|
||||
" \"configGlossary:installationAt\": \"Philadelphia, PA\",\n"
|
||||
" \"configGlossary:adminEmail\": \"ksm@pobox.com\",\n"
|
||||
" \"configGlossary:poweredBy\": \"Cofax\",\n"
|
||||
" \"configGlossary:poweredByIcon\": \"/images/cofax.gif\",\n"
|
||||
" \"configGlossary:staticPath\": \"/content/static\",\n"
|
||||
" \"templateProcessorClass\": \"org.cofax.WysiwygTemplate\",\n"
|
||||
" \"templateLoaderClass\": \"org.cofax.FilesTemplateLoader\",\n"
|
||||
" \"templatePath\": \"templates\",\n"
|
||||
" \"templateOverridePath\": \"\",\n"
|
||||
" \"defaultListTemplate\": \"listTemplate.htm\",\n"
|
||||
" \"defaultFileTemplate\": \"articleTemplate.htm\",\n"
|
||||
" \"useJSP\": false,\n"
|
||||
" \"jspListTemplate\": \"listTemplate.jsp\",\n"
|
||||
" \"jspFileTemplate\": \"articleTemplate.jsp\",\n"
|
||||
" \"cachePackageTagsTrack\": 200,\n"
|
||||
" \"cachePackageTagsStore\": 200,\n"
|
||||
" \"cachePackageTagsRefresh\": 60,\n"
|
||||
" \"cacheTemplatesTrack\": 100,\n"
|
||||
" \"cacheTemplatesStore\": 50,\n"
|
||||
" \"cacheTemplatesRefresh\": 15,\n"
|
||||
" \"cachePagesTrack\": 200,\n"
|
||||
" \"cachePagesStore\": 100,\n"
|
||||
" \"cachePagesRefresh\": 10,\n"
|
||||
" \"cachePagesDirtyRead\": 10,\n"
|
||||
" \"searchEngineListTemplate\": \"forSearchEnginesList.htm\",\n"
|
||||
" \"searchEngineFileTemplate\": \"forSearchEngines.htm\",\n"
|
||||
" \"searchEngineRobotsDb\": \"WEB-INF/robots.db\",\n"
|
||||
" \"useDataStore\": true,\n"
|
||||
" \"dataStoreClass\": \"org.cofax.SqlDataStore\",\n"
|
||||
" \"redirectionClass\": \"org.cofax.SqlRedirection\",\n"
|
||||
" \"dataStoreName\": \"cofax\",\n"
|
||||
" \"dataStoreDriver\": \"com.microsoft.jdbc.sqlserver.SQLServerDriver\",\n"
|
||||
" \"dataStoreUrl\": \"jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon\",\n"
|
||||
" \"dataStoreUser\": \"sa\",\n"
|
||||
" \"dataStorePassword\": \"dataStoreTestQuery\",\n"
|
||||
" \"dataStoreTestQuery\": \"SET NOCOUNT ON;select test='test';\",\n"
|
||||
" \"dataStoreLogFile\": \"/usr/local/tomcat/logs/datastore.log\",\n"
|
||||
" \"dataStoreInitConns\": 10,\n"
|
||||
" \"dataStoreMaxConns\": 100,\n"
|
||||
" \"dataStoreConnUsageLimit\": 100,\n"
|
||||
" \"dataStoreLogLevel\": \"debug\",\n"
|
||||
" \"maxUrlLength\": 500\n"
|
||||
" \"web-app\": {\n"
|
||||
" \"servlet\": [\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxCDS\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cds.CDSServlet\",\n"
|
||||
" \"init-param\": {\n"
|
||||
" \"configGlossary:installationAt\": \"Philadelphia, PA\",\n"
|
||||
" \"configGlossary:adminEmail\": \"ksm@pobox.com\",\n"
|
||||
" \"configGlossary:poweredBy\": \"Cofax\",\n"
|
||||
" \"configGlossary:poweredByIcon\": \"/images/cofax.gif\",\n"
|
||||
" \"configGlossary:staticPath\": \"/content/static\",\n"
|
||||
" \"templateProcessorClass\": \"org.cofax.WysiwygTemplate\",\n"
|
||||
" \"templateLoaderClass\": \"org.cofax.FilesTemplateLoader\",\n"
|
||||
" \"templatePath\": \"templates\",\n"
|
||||
" \"templateOverridePath\": \"\",\n"
|
||||
" \"defaultListTemplate\": \"listTemplate.htm\",\n"
|
||||
" \"defaultFileTemplate\": \"articleTemplate.htm\",\n"
|
||||
" \"useJSP\": false,\n"
|
||||
" \"jspListTemplate\": \"listTemplate.jsp\",\n"
|
||||
" \"jspFileTemplate\": \"articleTemplate.jsp\",\n"
|
||||
" \"cachePackageTagsTrack\": 200.000000,\n"
|
||||
" \"cachePackageTagsStore\": 200.000000,\n"
|
||||
" \"cachePackageTagsRefresh\": 60.000000,\n"
|
||||
" \"cacheTemplatesTrack\": 100.000000,\n"
|
||||
" \"cacheTemplatesStore\": 50.000000,\n"
|
||||
" \"cacheTemplatesRefresh\": 15.000000,\n"
|
||||
" \"cachePagesTrack\": 200.000000,\n"
|
||||
" \"cachePagesStore\": 100.000000,\n"
|
||||
" \"cachePagesRefresh\": 10.000000,\n"
|
||||
" \"cachePagesDirtyRead\": 10.000000,\n"
|
||||
" \"searchEngineListTemplate\": \"forSearchEnginesList.htm\",\n"
|
||||
" \"searchEngineFileTemplate\": \"forSearchEngines.htm\",\n"
|
||||
" \"searchEngineRobotsDb\": \"WEB-INF/robots.db\",\n"
|
||||
" \"useDataStore\": true,\n"
|
||||
" \"dataStoreClass\": \"org.cofax.SqlDataStore\",\n"
|
||||
" \"redirectionClass\": \"org.cofax.SqlRedirection\",\n"
|
||||
" \"dataStoreName\": \"cofax\",\n"
|
||||
" \"dataStoreDriver\": \"com.microsoft.jdbc.sqlserver.SQLServerDriver\",\n"
|
||||
" \"dataStoreUrl\": \"jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon\",\n"
|
||||
" \"dataStoreUser\": \"sa\",\n"
|
||||
" \"dataStorePassword\": \"dataStoreTestQuery\",\n"
|
||||
" \"dataStoreTestQuery\": \"SET NOCOUNT ON;select test='test';\",\n"
|
||||
" \"dataStoreLogFile\": \"/usr/local/tomcat/logs/datastore.log\",\n"
|
||||
" \"dataStoreInitConns\": 10.000000,\n"
|
||||
" \"dataStoreMaxConns\": 100.000000,\n"
|
||||
" \"dataStoreConnUsageLimit\": 100.000000,\n"
|
||||
" \"dataStoreLogLevel\": \"debug\",\n"
|
||||
" \"maxUrlLength\": 500.000000\n"
|
||||
" }\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxEmail\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cds.EmailServlet\",\n"
|
||||
" \"init-param\": { \"mailHost\": \"mail1\", \"mailHostOverride\": \"mail2\" }\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxAdmin\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cds.AdminServlet\"\n"
|
||||
" },\n"
|
||||
" { \"servlet-name\": \"fileServlet\", \"servlet-class\": \"org.cofax.cds.FileServlet\" },\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxTools\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cms.CofaxToolsServlet\",\n"
|
||||
" \"init-param\": {\n"
|
||||
" \"templatePath\": \"toolstemplates/\",\n"
|
||||
" \"log\": 1.000000,\n"
|
||||
" \"logLocation\": \"/usr/local/tomcat/logs/CofaxTools.log\",\n"
|
||||
" \"logMaxSize\": \"\",\n"
|
||||
" \"dataLog\": 1.000000,\n"
|
||||
" \"dataLogLocation\": \"/usr/local/tomcat/logs/dataLog.log\",\n"
|
||||
" \"dataLogMaxSize\": \"\",\n"
|
||||
" \"removePageCache\": \"/content/admin/remove?cache=pages&id=\",\n"
|
||||
" \"removeTemplateCache\": \"/content/admin/remove?cache=templates&id=\",\n"
|
||||
" \"fileTransferFolder\": \"/usr/local/tomcat/webapps/content/fileTransferFolder\",\n"
|
||||
" \"lookInContext\": 1.000000,\n"
|
||||
" \"adminGroupID\": 4.000000,\n"
|
||||
" \"betaServer\": true\n"
|
||||
" }\n"
|
||||
" }\n"
|
||||
" ],\n"
|
||||
" \"servlet-mapping\": {\n"
|
||||
" \"cofaxCDS\": \"/\",\n"
|
||||
" \"cofaxEmail\": \"/cofaxutil/aemail/*\",\n"
|
||||
" \"cofaxAdmin\": \"/admin/*\",\n"
|
||||
" \"fileServlet\": \"/static/*\",\n"
|
||||
" \"cofaxTools\": \"/tools/*\"\n"
|
||||
" },\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxEmail\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cds.EmailServlet\",\n"
|
||||
" \"init-param\": {\n"
|
||||
" \"mailHost\": \"mail1\",\n"
|
||||
" \"mailHostOverride\": \"mail2\"}},\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxAdmin\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cds.AdminServlet\"},\n"
|
||||
" \n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"fileServlet\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cds.FileServlet\"},\n"
|
||||
" {\n"
|
||||
" \"servlet-name\": \"cofaxTools\",\n"
|
||||
" \"servlet-class\": \"org.cofax.cms.CofaxToolsServlet\",\n"
|
||||
" \"init-param\": {\n"
|
||||
" \"templatePath\": \"toolstemplates/\",\n"
|
||||
" \"log\": 1,\n"
|
||||
" \"logLocation\": \"/usr/local/tomcat/logs/CofaxTools.log\",\n"
|
||||
" \"logMaxSize\": \"\",\n"
|
||||
" \"dataLog\": 1,\n"
|
||||
" \"dataLogLocation\": \"/usr/local/tomcat/logs/dataLog.log\",\n"
|
||||
" \"dataLogMaxSize\": \"\",\n"
|
||||
" \"removePageCache\": \"/content/admin/remove?cache=pages&id=\",\n"
|
||||
" \"removeTemplateCache\": \"/content/admin/remove?cache=templates&id=\",\n"
|
||||
" \"fileTransferFolder\": \"/usr/local/tomcat/webapps/content/fileTransferFolder\",\n"
|
||||
" \"lookInContext\": 1,\n"
|
||||
" \"adminGroupID\": 4,\n"
|
||||
" \"betaServer\": true}}],\n"
|
||||
" \"servlet-mapping\": {\n"
|
||||
" \"cofaxCDS\": \"/\",\n"
|
||||
" \"cofaxEmail\": \"/cofaxutil/aemail/*\",\n"
|
||||
" \"cofaxAdmin\": \"/admin/*\",\n"
|
||||
" \"fileServlet\": \"/static/*\",\n"
|
||||
" \"cofaxTools\": \"/tools/*\"},\n"
|
||||
" \n"
|
||||
" \"taglib\": {\n"
|
||||
" \"taglib-uri\": \"cofax.tld\",\n"
|
||||
" \"taglib-location\": \"/WEB-INF/tlds/cofax.tld\"}}}\n"
|
||||
" \n"
|
||||
"";
|
||||
" \"taglib\": { \"taglib-uri\": \"cofax.tld\", \"taglib-location\": \"/WEB-INF/tlds/cofax.tld\" }\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
check.Set(reference,
|
||||
-1,
|
||||
reference);
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
*/
|
||||
|
||||
reference = "{\n"
|
||||
"\"menu\": {\n"
|
||||
" \"header\": \"SVG Viewer\",\n"
|
||||
" \"items\": [\n"
|
||||
" {\"id\": \"Open\"},\n"
|
||||
" {\"id\": \"OpenNew\", \"label\": \"Open New\"},\n"
|
||||
" null,\n"
|
||||
" {\"id\": \"ZoomIn\", \"label\": \"Zoom In\"},\n"
|
||||
" {\"id\": \"ZoomOut\", \"label\": \"Zoom Out\"},\n"
|
||||
" {\"id\": \"OriginalView\", \"label\": \"Original View\"},\n"
|
||||
" null,\n"
|
||||
" {\"id\": \"Quality\"},\n"
|
||||
" {\"id\": \"Pause\"},\n"
|
||||
" {\"id\": \"Mute\"},\n"
|
||||
" null,\n"
|
||||
" {\"id\": \"Find\", \"label\": \"Find...\"},\n"
|
||||
" {\"id\": \"FindAgain\", \"label\": \"Find Again\"},\n"
|
||||
" {\"id\": \"Copy\"},\n"
|
||||
" {\"id\": \"CopyAgain\", \"label\": \"Copy Again\"},\n"
|
||||
" {\"id\": \"CopySVG\", \"label\": \"Copy SVG\"},\n"
|
||||
" {\"id\": \"ViewSVG\", \"label\": \"View SVG\"},\n"
|
||||
" {\"id\": \"ViewSource\", \"label\": \"View Source\"},\n"
|
||||
" {\"id\": \"SaveAs\", \"label\": \"Save As\"},\n"
|
||||
" null,\n"
|
||||
" {\"id\": \"Help\"},\n"
|
||||
" {\"id\": \"About\", \"label\": \"About Adobe CVG Viewer...\"}\n"
|
||||
" ]\n"
|
||||
"}}\n";
|
||||
" \"menu\": {\n"
|
||||
" \"header\": \"SVG Viewer\",\n"
|
||||
" \"items\": [\n"
|
||||
" { \"id\": \"Open\" },\n"
|
||||
" { \"id\": \"OpenNew\", \"label\": \"Open New\" },\n"
|
||||
" null,\n"
|
||||
" { \"id\": \"ZoomIn\", \"label\": \"Zoom In\" },\n"
|
||||
" { \"id\": \"ZoomOut\", \"label\": \"Zoom Out\" },\n"
|
||||
" { \"id\": \"OriginalView\", \"label\": \"Original View\" },\n"
|
||||
" null,\n"
|
||||
" { \"id\": \"Quality\" },\n"
|
||||
" { \"id\": \"Pause\" },\n"
|
||||
" { \"id\": \"Mute\" },\n"
|
||||
" null,\n"
|
||||
" { \"id\": \"Find\", \"label\": \"Find...\" },\n"
|
||||
" { \"id\": \"FindAgain\", \"label\": \"Find Again\" },\n"
|
||||
" { \"id\": \"Copy\" },\n"
|
||||
" { \"id\": \"CopyAgain\", \"label\": \"Copy Again\" },\n"
|
||||
" { \"id\": \"CopySVG\", \"label\": \"Copy SVG\" },\n"
|
||||
" { \"id\": \"ViewSVG\", \"label\": \"View SVG\" },\n"
|
||||
" { \"id\": \"ViewSource\", \"label\": \"View Source\" },\n"
|
||||
" { \"id\": \"SaveAs\", \"label\": \"Save As\" },\n"
|
||||
" null,\n"
|
||||
" { \"id\": \"Help\" },\n"
|
||||
" { \"id\": \"About\", \"label\": \"About Adobe CVG Viewer...\" }\n"
|
||||
" ]\n"
|
||||
" }\n"
|
||||
"}\n";
|
||||
check.Set(reference,
|
||||
-1,
|
||||
reference);
|
||||
l_list.PushBack(check);
|
||||
// ------------------------------------------------------
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
@ -554,16 +512,40 @@ int main(int argc, const char *argv[])
|
||||
JSON_INFO("[TEST] " << sectionID << ":" << jjj << " { OK } Result in error (normal case)");
|
||||
} else {
|
||||
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR } different output");
|
||||
JSON_ERROR("generate : \n" << out);
|
||||
JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
etk::Vector<etk::UString> tmpout = out.Split('\n');
|
||||
etk::Vector<etk::UString> tmpref = l_list[iii].m_ref.Split('\n');
|
||||
//JSON_ERROR("generate : \n" << out);
|
||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
for (int32_t jjj=0; jjj<tmpout.Size() || jjj<tmpref.Size(); ++jjj) {
|
||||
if (jjj<tmpref.Size()) {
|
||||
JSON_INFO("[" << jjj << "] " << tmpref[jjj] );
|
||||
}
|
||||
if (jjj<tmpout.Size()) {
|
||||
if (jjj>=tmpref.Size() || tmpref[jjj] != tmpout[jjj]) {
|
||||
JSON_ERROR("[" << jjj << "] " << tmpout[jjj] );
|
||||
}
|
||||
}
|
||||
}
|
||||
countError++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (l_list[iii].m_errorPos==3) {
|
||||
JSON_ERROR("[TEST] " << sectionID << ":" << jjj << " {ERROR} checking result might be in error...");
|
||||
JSON_ERROR("generate : \n" << out);
|
||||
JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
etk::Vector<etk::UString> tmpout = out.Split('\n');
|
||||
etk::Vector<etk::UString> tmpref = l_list[iii].m_ref.Split('\n');
|
||||
//JSON_ERROR("generate : \n" << out);
|
||||
//JSON_ERROR("reference : \n" << l_list[iii].m_ref);
|
||||
for (int32_t jjj=0; jjj<tmpout.Size() || jjj<tmpref.Size(); ++jjj) {
|
||||
if (jjj<tmpref.Size()) {
|
||||
JSON_INFO("[" << jjj << "] " << tmpref[jjj] );
|
||||
}
|
||||
if (jjj<tmpout.Size()) {
|
||||
if (jjj>=tmpref.Size() || tmpref[jjj] != tmpout[jjj]) {
|
||||
JSON_ERROR("[" << jjj << "] " << tmpout[jjj] );
|
||||
}
|
||||
}
|
||||
}
|
||||
countError++;
|
||||
continue;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user