std::string GetErrorMessage(){ const char* error = enchant_broker_get_error(_broker); if(error == NULL){ return std::string(); } return std::string(error); }
static void broker_init_failed(void) { const gchar *err = enchant_broker_get_error(sc_speller_broker); dialogs_show_msgbox(GTK_MESSAGE_ERROR, _("The Enchant library couldn't be initialized (%s)."), (err != NULL) ? err : _("unknown error (maybe the chosen language is not available)")); }
TEST_FIXTURE(EnchantBrokerRequestDictionary_TestFixture, EnchantBrokerRequestDictionary_InvalidTag_NULL_ErrorSet) { _dict = enchant_broker_request_dict(_broker, "en~US"); CHECK_EQUAL((void*)NULL, _dict); CHECK(NULL != enchant_broker_get_error(_broker)); }
TEST_FIXTURE(EnchantBrokerRequestDictionary_TestFixture, EnchantBrokerRequestDictionary_HasPreviousError_ErrorCleared) { SetErrorOnMockProvider("something bad happened"); _dict = enchant_broker_request_dict(_broker, "en-GB"); CHECK_EQUAL((void*)NULL, (void*)enchant_broker_get_error(_broker)); }
TEST_FIXTURE(EnchantBrokerFreeDictTestFixture, EnchantBrokerFreeDict_HasPreviousError_ErrorCleared) { SetErrorOnMockProvider("something bad happened"); enchant_broker_free_dict(_broker, _dictionary); _dictionary = NULL; CHECK_EQUAL((void*)NULL, (void*)enchant_broker_get_error(_broker)); }
TEST_FIXTURE(EnchantBrokerTestFixture, EnchantBrokerGetError_HasPreviousError_Error) { std::string errorMessage("something bad happened"); SetErrorOnMockProvider(errorMessage); char * result = enchant_broker_get_error(_broker); CHECK(result); if(result) { CHECK_EQUAL(errorMessage.c_str(), result); } }
static void spellchecker_reload_dicts() { while (!g_pEnchantDicts->isEmpty()) enchant_broker_free_dict(g_pEnchantBroker, g_pEnchantDicts->takeFirst()); const QStringList& wantedDictionaries = KVI_OPTION_STRINGLIST(KviOption_stringlistSpellCheckerDictionaries); foreach(QString szLang, wantedDictionaries) { EnchantDict* pDict = enchant_broker_request_dict(g_pEnchantBroker, szLang.toUtf8().data()); if (pDict) { g_pEnchantDicts->append(pDict); } else { qDebug("Can't load spellchecker dictionary %s: %s", szLang.toUtf8().data(), enchant_broker_get_error(g_pEnchantBroker)); } }
static void broker_init_failed(void) { const gchar *err = enchant_broker_get_error(sc_speller_broker); gchar *msg = g_strdup_printf( _("The Enchant library couldn't be initialized (%s)."), (err != NULL) ? err : _("unknown error (maybe the chosen language is not available)")); msgwin_status_add("%s", msg); if (main_is_realized()) /* show dialog only after Geany has been loaded already, i.e. not while starting up */ dialogs_show_msgbox(GTK_MESSAGE_ERROR, "%s", msg); g_free(msg); }
TEST_FIXTURE(EnchantBrokerTestFixture, EnchantBrokerGetError_NoPreviousError_Null) { CHECK_EQUAL((void*)NULL, (void*)enchant_broker_get_error(_broker)); }