Commit ffc076b85d132f73b7551175c12ed3d463f4c4af

  • Tree SHA1: 56f8db5
  • Parent SHA1: e999b63 (Now that one was interesting: make Amarok::vfatPath() pass the tests, at least on Linux. Who designed this hell of a file system and the Windows API? I also want some of those drugs...)
  • raw diff | raw patch
Tests for Amarok::escapeHTMLAttr() and Amarok::unescapeHTMLAttr().
  
219219 AMAROK_EXPORT QString decapitateString( const QString &input, const QString &ref );
220220
221221 /*
222 * Transform to be usable within HTML/HTML attributes
222 * Transform to be usable within HTML/XHTML attributes
223223 */
224224 AMAROK_EXPORT QString escapeHTMLAttr( const QString &s ); // defined in App.cpp
225225 AMAROK_EXPORT QString unescapeHTMLAttr( const QString &s ); // defined in App.cpp
  
756756
757757namespace Amarok
758758{
759 /// @see amarok.h
759 /// @see Amarok.h
760760
761761 /*
762 * Transform to be usable within HTML/HTML attributes
762 * Transform to be usable within HTML/XHTML attributes
763763 */
764764 QString escapeHTMLAttr( const QString &s )
765765 {
  
105105 /* any other good ideas what to test here? */
106106}
107107
108void TestAmarok::testEscapeHTMLAttr()
109{
110 QCOMPARE( Amarok::escapeHTMLAttr( "test\"fu=bar" ), QString( "test%22fu=bar" ) );
111 QCOMPARE( Amarok::escapeHTMLAttr( "test#fu=bar" ), QString( "test%23fu=bar" ) );
112 QCOMPARE( Amarok::escapeHTMLAttr( "test%fu=bar" ), QString( "test%25fu=bar" ) );
113 QCOMPARE( Amarok::escapeHTMLAttr( "test\'fu=bar" ), QString( "test%27fu=bar" ) );
114 QCOMPARE( Amarok::escapeHTMLAttr( "test?fu=bar" ), QString( "test%3Ffu=bar" ) );
115}
116
108117void TestAmarok::testExtension()
109118{
110119 QCOMPARE( Amarok::extension( "" ), QString( "" ) );
185185 QCOMPARE( QDir::isAbsolutePath( saveLocation ), true );
186186 QCOMPARE( saveLocationDir.isReadable(), true );
187187 /* any other good ideas what to test here? */
188}
189
190void TestAmarok::testUnescapeHTMLAttr()
191{
192 QCOMPARE( Amarok::unescapeHTMLAttr( "test%22fu=bar" ), QString( "test\"fu=bar" ) );
193 QCOMPARE( Amarok::unescapeHTMLAttr( "test%23fu=bar" ), QString( "test#fu=bar" ) );
194 QCOMPARE( Amarok::unescapeHTMLAttr( "test%25fu=bar" ), QString( "test%fu=bar" ) );
195 QCOMPARE( Amarok::unescapeHTMLAttr( "test%27fu=bar" ), QString( "test\'fu=bar" ) );
196 QCOMPARE( Amarok::unescapeHTMLAttr( "test%3Ffu=bar" ), QString( "test?fu=bar" ) );
188197}
189198
190199void TestAmarok::testVerboseTimeSince()
  
3434 void testCleanPath();
3535 void testComputeScore();
3636 void testConciseTimeSince();
37 void testEscapeHTMLAttr();
3738 void testExtension();
3839 void testManipulateThe();
3940 void testSaveLocation();
41 void testUnescapeHTMLAttr();
4042 void testVerboseTimeSince();
4143 void testVfatPath();
4244 /*KUrl::List testRecursiveUrlExpand( const KUrl &url ); //defined in PlaylistHandler.cpp
4949
5050 /*
5151 QString decapitateString( const QString &input, const QString &ref );
52 QString escapeHTMLAttr( const QString &s );
53 QString unescapeHTMLAttr( const QString &s );
5452 QString proxyForUrl( const QString& url ); // how to test?
5553 QString proxyForProtocol( const QString& protocol ); // how to test? */
5654};