+ wxPrintf(_T("ERROR: Touch() failed.\n"));
+ }
+}
+#endif
+
+#endif // TEST_FILETIME
+
+// ----------------------------------------------------------------------------
+// wxLocale
+// ----------------------------------------------------------------------------
+
+#ifdef TEST_LOCALE
+
+#include "wx/intl.h"
+#include "wx/utils.h" // for wxSetEnv
+
+static wxLocale gs_localeDefault(wxLANGUAGE_ENGLISH);
+
+// find the name of the language from its value
+static const wxChar *GetLangName(int lang)
+{
+ static const wxChar *languageNames[] =
+ {
+ _T("DEFAULT"),
+ _T("UNKNOWN"),
+ _T("ABKHAZIAN"),
+ _T("AFAR"),
+ _T("AFRIKAANS"),
+ _T("ALBANIAN"),
+ _T("AMHARIC"),
+ _T("ARABIC"),
+ _T("ARABIC_ALGERIA"),
+ _T("ARABIC_BAHRAIN"),
+ _T("ARABIC_EGYPT"),
+ _T("ARABIC_IRAQ"),
+ _T("ARABIC_JORDAN"),
+ _T("ARABIC_KUWAIT"),
+ _T("ARABIC_LEBANON"),
+ _T("ARABIC_LIBYA"),
+ _T("ARABIC_MOROCCO"),
+ _T("ARABIC_OMAN"),
+ _T("ARABIC_QATAR"),
+ _T("ARABIC_SAUDI_ARABIA"),
+ _T("ARABIC_SUDAN"),
+ _T("ARABIC_SYRIA"),
+ _T("ARABIC_TUNISIA"),
+ _T("ARABIC_UAE"),
+ _T("ARABIC_YEMEN"),
+ _T("ARMENIAN"),
+ _T("ASSAMESE"),
+ _T("AYMARA"),
+ _T("AZERI"),
+ _T("AZERI_CYRILLIC"),
+ _T("AZERI_LATIN"),
+ _T("BASHKIR"),
+ _T("BASQUE"),
+ _T("BELARUSIAN"),
+ _T("BENGALI"),
+ _T("BHUTANI"),
+ _T("BIHARI"),
+ _T("BISLAMA"),
+ _T("BRETON"),
+ _T("BULGARIAN"),
+ _T("BURMESE"),
+ _T("CAMBODIAN"),
+ _T("CATALAN"),
+ _T("CHINESE"),
+ _T("CHINESE_SIMPLIFIED"),
+ _T("CHINESE_TRADITIONAL"),
+ _T("CHINESE_HONGKONG"),
+ _T("CHINESE_MACAU"),
+ _T("CHINESE_SINGAPORE"),
+ _T("CHINESE_TAIWAN"),
+ _T("CORSICAN"),
+ _T("CROATIAN"),
+ _T("CZECH"),
+ _T("DANISH"),
+ _T("DUTCH"),
+ _T("DUTCH_BELGIAN"),
+ _T("ENGLISH"),
+ _T("ENGLISH_UK"),
+ _T("ENGLISH_US"),
+ _T("ENGLISH_AUSTRALIA"),
+ _T("ENGLISH_BELIZE"),
+ _T("ENGLISH_BOTSWANA"),
+ _T("ENGLISH_CANADA"),
+ _T("ENGLISH_CARIBBEAN"),
+ _T("ENGLISH_DENMARK"),
+ _T("ENGLISH_EIRE"),
+ _T("ENGLISH_JAMAICA"),
+ _T("ENGLISH_NEW_ZEALAND"),
+ _T("ENGLISH_PHILIPPINES"),
+ _T("ENGLISH_SOUTH_AFRICA"),
+ _T("ENGLISH_TRINIDAD"),
+ _T("ENGLISH_ZIMBABWE"),
+ _T("ESPERANTO"),
+ _T("ESTONIAN"),
+ _T("FAEROESE"),
+ _T("FARSI"),
+ _T("FIJI"),
+ _T("FINNISH"),
+ _T("FRENCH"),
+ _T("FRENCH_BELGIAN"),
+ _T("FRENCH_CANADIAN"),
+ _T("FRENCH_LUXEMBOURG"),
+ _T("FRENCH_MONACO"),
+ _T("FRENCH_SWISS"),
+ _T("FRISIAN"),
+ _T("GALICIAN"),
+ _T("GEORGIAN"),
+ _T("GERMAN"),
+ _T("GERMAN_AUSTRIAN"),
+ _T("GERMAN_BELGIUM"),
+ _T("GERMAN_LIECHTENSTEIN"),
+ _T("GERMAN_LUXEMBOURG"),
+ _T("GERMAN_SWISS"),
+ _T("GREEK"),
+ _T("GREENLANDIC"),
+ _T("GUARANI"),
+ _T("GUJARATI"),
+ _T("HAUSA"),
+ _T("HEBREW"),
+ _T("HINDI"),
+ _T("HUNGARIAN"),
+ _T("ICELANDIC"),
+ _T("INDONESIAN"),
+ _T("INTERLINGUA"),
+ _T("INTERLINGUE"),
+ _T("INUKTITUT"),
+ _T("INUPIAK"),
+ _T("IRISH"),
+ _T("ITALIAN"),
+ _T("ITALIAN_SWISS"),
+ _T("JAPANESE"),
+ _T("JAVANESE"),
+ _T("KANNADA"),
+ _T("KASHMIRI"),
+ _T("KASHMIRI_INDIA"),
+ _T("KAZAKH"),
+ _T("KERNEWEK"),
+ _T("KINYARWANDA"),
+ _T("KIRGHIZ"),
+ _T("KIRUNDI"),
+ _T("KONKANI"),
+ _T("KOREAN"),
+ _T("KURDISH"),
+ _T("LAOTHIAN"),
+ _T("LATIN"),
+ _T("LATVIAN"),
+ _T("LINGALA"),
+ _T("LITHUANIAN"),
+ _T("MACEDONIAN"),
+ _T("MALAGASY"),
+ _T("MALAY"),
+ _T("MALAYALAM"),
+ _T("MALAY_BRUNEI_DARUSSALAM"),
+ _T("MALAY_MALAYSIA"),
+ _T("MALTESE"),
+ _T("MANIPURI"),
+ _T("MAORI"),
+ _T("MARATHI"),
+ _T("MOLDAVIAN"),
+ _T("MONGOLIAN"),
+ _T("NAURU"),
+ _T("NEPALI"),
+ _T("NEPALI_INDIA"),
+ _T("NORWEGIAN_BOKMAL"),
+ _T("NORWEGIAN_NYNORSK"),
+ _T("OCCITAN"),
+ _T("ORIYA"),
+ _T("OROMO"),
+ _T("PASHTO"),
+ _T("POLISH"),
+ _T("PORTUGUESE"),
+ _T("PORTUGUESE_BRAZILIAN"),
+ _T("PUNJABI"),
+ _T("QUECHUA"),
+ _T("RHAETO_ROMANCE"),
+ _T("ROMANIAN"),
+ _T("RUSSIAN"),
+ _T("RUSSIAN_UKRAINE"),
+ _T("SAMOAN"),
+ _T("SANGHO"),
+ _T("SANSKRIT"),
+ _T("SCOTS_GAELIC"),
+ _T("SERBIAN"),
+ _T("SERBIAN_CYRILLIC"),
+ _T("SERBIAN_LATIN"),
+ _T("SERBO_CROATIAN"),
+ _T("SESOTHO"),
+ _T("SETSWANA"),
+ _T("SHONA"),
+ _T("SINDHI"),
+ _T("SINHALESE"),
+ _T("SISWATI"),
+ _T("SLOVAK"),
+ _T("SLOVENIAN"),
+ _T("SOMALI"),
+ _T("SPANISH"),
+ _T("SPANISH_ARGENTINA"),
+ _T("SPANISH_BOLIVIA"),
+ _T("SPANISH_CHILE"),
+ _T("SPANISH_COLOMBIA"),
+ _T("SPANISH_COSTA_RICA"),
+ _T("SPANISH_DOMINICAN_REPUBLIC"),
+ _T("SPANISH_ECUADOR"),
+ _T("SPANISH_EL_SALVADOR"),
+ _T("SPANISH_GUATEMALA"),
+ _T("SPANISH_HONDURAS"),
+ _T("SPANISH_MEXICAN"),
+ _T("SPANISH_MODERN"),
+ _T("SPANISH_NICARAGUA"),
+ _T("SPANISH_PANAMA"),
+ _T("SPANISH_PARAGUAY"),
+ _T("SPANISH_PERU"),
+ _T("SPANISH_PUERTO_RICO"),
+ _T("SPANISH_URUGUAY"),
+ _T("SPANISH_US"),
+ _T("SPANISH_VENEZUELA"),
+ _T("SUNDANESE"),
+ _T("SWAHILI"),
+ _T("SWEDISH"),
+ _T("SWEDISH_FINLAND"),
+ _T("TAGALOG"),
+ _T("TAJIK"),
+ _T("TAMIL"),
+ _T("TATAR"),
+ _T("TELUGU"),
+ _T("THAI"),
+ _T("TIBETAN"),
+ _T("TIGRINYA"),
+ _T("TONGA"),
+ _T("TSONGA"),
+ _T("TURKISH"),
+ _T("TURKMEN"),
+ _T("TWI"),
+ _T("UIGHUR"),
+ _T("UKRAINIAN"),
+ _T("URDU"),
+ _T("URDU_INDIA"),
+ _T("URDU_PAKISTAN"),
+ _T("UZBEK"),
+ _T("UZBEK_CYRILLIC"),
+ _T("UZBEK_LATIN"),
+ _T("VIETNAMESE"),
+ _T("VOLAPUK"),
+ _T("WELSH"),
+ _T("WOLOF"),
+ _T("XHOSA"),
+ _T("YIDDISH"),
+ _T("YORUBA"),
+ _T("ZHUANG"),
+ _T("ZULU"),
+ };
+
+ if ( (size_t)lang < WXSIZEOF(languageNames) )
+ return languageNames[lang];
+ else
+ return _T("INVALID");
+}
+
+static void TestDefaultLang()
+{
+ wxPuts(_T("*** Testing wxLocale::GetSystemLanguage ***"));
+
+ static const wxChar *langStrings[] =
+ {
+ NULL, // system default
+ _T("C"),
+ _T("fr"),
+ _T("fr_FR"),
+ _T("en"),
+ _T("en_GB"),
+ _T("en_US"),
+ _T("de_DE.iso88591"),
+ _T("german"),
+ _T("?"), // invalid lang spec
+ _T("klingonese"), // I bet on some systems it does exist...
+ };
+
+ wxPrintf(_T("The default system encoding is %s (%d)\n"),
+ wxLocale::GetSystemEncodingName().c_str(),
+ wxLocale::GetSystemEncoding());
+
+ for ( size_t n = 0; n < WXSIZEOF(langStrings); n++ )
+ {
+ const wxChar *langStr = langStrings[n];
+ if ( langStr )
+ {
+ // FIXME: this doesn't do anything at all under Windows, we need
+ // to create a new wxLocale!
+ wxSetEnv(_T("LC_ALL"), langStr);
+ }
+
+ int lang = gs_localeDefault.GetSystemLanguage();
+ wxPrintf(_T("Locale for '%s' is %s.\n"),
+ langStr ? langStr : _T("system default"), GetLangName(lang));
+ }
+}
+
+#endif // TEST_LOCALE
+
+// ----------------------------------------------------------------------------
+// MIME types
+// ----------------------------------------------------------------------------
+
+#ifdef TEST_MIME
+
+#include "wx/mimetype.h"
+
+static void TestMimeEnum()
+{
+ wxPuts(_T("*** Testing wxMimeTypesManager::EnumAllFileTypes() ***\n"));
+
+ wxArrayString mimetypes;
+
+ size_t count = wxTheMimeTypesManager->EnumAllFileTypes(mimetypes);
+
+ wxPrintf(_T("*** All %u known filetypes: ***\n"), count);
+
+ wxArrayString exts;
+ wxString desc;
+
+ for ( size_t n = 0; n < count; n++ )
+ {
+ wxFileType *filetype =
+ wxTheMimeTypesManager->GetFileTypeFromMimeType(mimetypes[n]);
+ if ( !filetype )