#include <dali-toolkit-test-suite-utils.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <toolkit-text-model.h>
+#include <toolkit-text-utils.h>
#include <dali-toolkit/internal/text/markup-processor.h>
#include <dali-toolkit/internal/text/markup-processor-helper-functions.h>
#include <dali-toolkit/internal/text/color-run.h>
namespace
{
+
///////////////////////////////////////////////////////////
struct TokenComparisonData
return true;
}
+ ///////////////////////////////////////////////////////////
+
+
+ struct XHTMLEntityToUTF8Data
+ {
+ std::string description;
+ std::string xHTMLEntityString;
+ std::string expectedString;
+ };
+
+ bool XHTMLEntityToUTF8Test( const XHTMLEntityToUTF8Data& data )
+ {
+ std::cout << " testing " << data.description << std::endl;
+
+ Vector<ColorRun> colorRuns;
+ Vector<FontDescriptionRun> fontRuns;
+ Vector<EmbeddedItem> items;
+ Vector<Anchor> anchors;
+ Vector<UnderlinedCharacterRun> underlinedCharacterRuns;
+ MarkupProcessData markupProcessData( colorRuns, fontRuns, items, anchors, underlinedCharacterRuns );
+ ProcessMarkupString( data.xHTMLEntityString, markupProcessData );
+
+ for( Vector<EmbeddedItem>::Iterator it = items.Begin(),
+ endIt = items.End();
+ it != endIt;
+ ++it )
+ {
+ EmbeddedItem& item = *it;
+ delete[] item.url;
+ }
+ items.Clear();
+
+ if( markupProcessData.markupProcessedText != data.expectedString )
+ {
+ std::cout << " different output string : " << markupProcessData.markupProcessedText << ", expected : " << data.expectedString << " " << std::endl;
+ return false;
+ }
+
+ return true;
+ }
+
} // namespace
int UtcDaliTextTokenComparison(void)
tet_result(TET_PASS);
END_TEST;
}
+
+int UtcDaliTextXHTMLEntityToUTF8(void)
+{
+ tet_infoline(" UtcDaliTextXHTMLEntityToUTF8");
+ const XHTMLEntityToUTF8Data data[] =
+ {
+ {
+ "Text Without XHTML Entity",
+ "Checking XHTML Entitities",
+ "Checking XHTML Entitities"
+ },
+ {
+ "Text With XHTML Entity in Numeric form",
+ "Checking Numeric Entitities & ' < > ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å æ Ç È É Ê Ë Ì Í Î Ï ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ý þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω … € ← ↑ → ↓ ↔ ← → ∀ ∃ ∇ ∏ ∑ ∧ ∨ ∫ ≠ ≡ ⊕ ⊥ † ‡ • ",
+ "Checking Numeric Entitities & ' < > ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å æ Ç È É Ê Ë Ì Í Î Ï ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ý þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω … € ← ↑ → ↓ ↔ ← → ∀ ∃ ∇ ∏ ∑ ∧ ∨ ∫ ≠ ≡ ⊕ ⊥ † ‡ • "
+ },
+ {
+ "Text With XHTML Named Entities",
+ "Checking Named Entitities & ' < > ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ­ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å æ Ç È É Ê Ë Ì Í Î Ï ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ý þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω … € ← ↑ → ↓ ↔ ← → ∀ ∃ ∇ ∏ ∑ ∧ ∨ ∫ ≠ ≡ ⊕ ⊥ † ‡ • ",
+ "Checking Named Entitities & ' < > ¡ ¢ £ ¤ ¥ ¦ § ¨ © ª « ¬ ® ¯ ° ± ² ³ ´ µ ¶ · ¸ ¹ º » ¼ ½ ¾ ¿ À Á Â Ã Ä Å æ Ç È É Ê Ë Ì Í Î Ï ð Ñ Ò Ó Ô Õ Ö × Ø Ù Ú Û Ý þ ß à á â ã ä å æ ç è é ê ë ì í î ï ð ñ ò ó ô õ ö ÷ ø ù ú û ü ý þ ÿ α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω … € ← ↑ → ↓ ↔ ← → ∀ ∃ ∇ ∏ ∑ ∧ ∨ ∫ ≠ ≡ ⊕ ⊥ † ‡ • "
+ },
+ {
+ "Testing of < special character",
+ "Testing of < special character",
+ "Testing of "
+ },
+ {
+ "Testing of & special character",
+ "Testing of & special character",
+ "Testing of "
+ },
+ {
+ "Testing of & < > special character",
+ "Testing of \\& \\< \\> special character",
+ "Testing of & < > special character"
+ }
+ };
+ const unsigned int numberOfTests = 6u;
+
+ for( unsigned int index = 0u; index < numberOfTests; ++index )
+ {
+ ToolkitTestApplication application;
+ if( !XHTMLEntityToUTF8Test( data[index] ) )
+ {
+ tet_result(TET_FAIL);
+ }
+ }
+
+ tet_result(TET_PASS);
+ END_TEST;
+}