[xiph-commits] r8317 - in trunk/oggdsf/src: lib/codecs/cmml/libWinCMMLParse tests/testCMMLParser

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Tue Nov 30 08:16:31 PST 2004


Author: illiminable
Date: 2004-11-30 08:16:31 -0800 (Tue, 30 Nov 2004)
New Revision: 8317

Modified:
   trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp
   trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
Log:
* Improved clip validation.

Modified: trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp	2004-11-30 16:05:09 UTC (rev 8316)
+++ trunk/oggdsf/src/lib/codecs/cmml/libWinCMMLParse/CMMLParser.cpp	2004-11-30 16:16:31 UTC (rev 8317)
@@ -205,7 +205,7 @@
 
 	bool retVal	=		(locNum_a <= 1)
 					&&	(locNum_img <= 1)
-					&&	(locNum_desc <=1);
+					&&	(locNum_desc <= 1);
 
 	SysFreeString(locBStr);
 	if (locAttribMap != NULL)					locAttribMap->Release();

Modified: trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp
===================================================================
--- trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp	2004-11-30 16:05:09 UTC (rev 8316)
+++ trunk/oggdsf/src/tests/testCMMLParser/testCMMLParser.cpp	2004-11-30 16:16:31 UTC (rev 8317)
@@ -72,21 +72,30 @@
 	testHeadParse(head_6);
 
 
-
+	//Valid minimal
 	wstring clip_1 = L"<clip id=\"dolphin\" start=\"npt:3.5\" end=\"npt:5:5.9\"><img src=\"dolphin.jpg\"/><desc>Here, Joe caught sight of a dolphin in the ocean.</desc><meta name=\"Subject\" content=\"dolphin\"/></clip>";
 	testClipParse(clip_1);
 
+	//INVALID: Random data
 	wstring clip_2 = L"asdjhaskdljfhksladf";
 	testClipParse(clip_2);
 
+	//INVALID: valid xml but invalid cmml
 	wstring clip_3 = L"<blue><red>random stuff</red><green>But still valid XML</green></blue>";
 	testClipParse(clip_3);
 
+	//Valid
 	wstring clip_4 = L"<clip id=\"dolphin\" lang=\"en\" start=\"npt:3.5\" end=\"npt:5:5.9\"><img alt=\"Picture of dolphin\" src=\"dolphin.jpg\"/><desc id=\"descID\" lang=\"fr\">Here, Joe caught sight of a dolphin in the ocean.</desc><meta name=\"Subject\" content=\"dolphin\"/></clip>";
 	testClipParse(clip_4);
 
+	//INVALID: Missing equals on href=
 	wstring clip_5 = L"<clip id=\"dolphin\" start=\"npt:3.5\" end=\"npt:5:5.9\"><a href\"http:\\linktome.com\" class=\"someClass\">Random anchor text</a><img src=\"dolphin.jpg\"/><desc>Here, Joe caught sight of a dolphin in the ocean.</desc><meta name=\"Subject\" content=\"dolphin\"/></clip>";
 	testClipParse(clip_5);
+
+	//VALID
+	wstring clip_6 = L"<clip id=\"dolphin\" start=\"npt:3.5\" end=\"npt:5:5.9\"><a href=\"http:\\linktome.com\" class=\"someClass\">Random anchor text</a><img src=\"dolphin.jpg\"/><desc>Here, Joe caught sight of a dolphin in the ocean.</desc><meta name=\"Subject\" content=\"dolphin\"/></clip>";
+	testClipParse(clip_6);
+
 	return 0;
 }
 



More information about the commits mailing list