forked from enlightenment/edi
Merging in refactoring of elm_code file lookups and edi mime lookups.
Elm_Code file no longer required for elm_code to function (in memory is created automatically).
This commit is contained in:
commit
896452e559
|
@ -38,7 +38,6 @@ _elm_code_test_welcome_setup(Evas_Object *parent)
|
||||||
Evas_Object *widget;
|
Evas_Object *widget;
|
||||||
|
|
||||||
code = elm_code_create();
|
code = elm_code_create();
|
||||||
elm_code_file_new(code);
|
|
||||||
widget = elm_code_widget_add(parent, code);
|
widget = elm_code_widget_add(parent, code);
|
||||||
elm_code_widget_font_size_set(widget, 14);
|
elm_code_widget_font_size_set(widget, 14);
|
||||||
_append_line(code->file, "Hello World, Elm Code!");
|
_append_line(code->file, "Hello World, Elm Code!");
|
||||||
|
|
|
@ -86,7 +86,7 @@ EAPI int elm_code_init(void);
|
||||||
*
|
*
|
||||||
* @return Elm Code's init counter value.
|
* @return Elm Code's init counter value.
|
||||||
*
|
*
|
||||||
* @see elm_code_init().
|
* @see elm_code_init()
|
||||||
*
|
*
|
||||||
* @ingroup Init
|
* @ingroup Init
|
||||||
*/
|
*/
|
||||||
|
@ -95,11 +95,12 @@ EAPI int elm_code_shutdown(void);
|
||||||
/**
|
/**
|
||||||
* Create a new Elm Code instance
|
* Create a new Elm Code instance
|
||||||
*
|
*
|
||||||
* This method creates a new Elm Code instance which will need a
|
* This method creates a new Elm Code instance using an in-memory file for backing changes.
|
||||||
* backing file set for storage.
|
* A regular file can be set after creation if required.
|
||||||
* Once an Elm Code has been created you can create widgets that render the content.
|
* Once an Elm Code has been created you can create widgets that render the content.
|
||||||
*
|
*
|
||||||
* "return an allocated Elm_Code that references the given file
|
* @return an allocated Elm_Code that references the given file
|
||||||
|
* @see elm_code_file_open()
|
||||||
*/
|
*/
|
||||||
EAPI Elm_Code *elm_code_create();
|
EAPI Elm_Code *elm_code_create();
|
||||||
|
|
||||||
|
|
|
@ -72,6 +72,8 @@ elm_code_create()
|
||||||
|
|
||||||
ret = calloc(1, sizeof(Elm_Code));
|
ret = calloc(1, sizeof(Elm_Code));
|
||||||
|
|
||||||
|
// create an in-memory backing for this elm_code by default
|
||||||
|
elm_code_file_new(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,6 @@ EAPI Evas_Object *elm_code_diff_widget_add(Evas_Object *parent, Elm_Code *code)
|
||||||
|
|
||||||
// left side of diff
|
// left side of diff
|
||||||
wcode1 = elm_code_create();
|
wcode1 = elm_code_create();
|
||||||
elm_code_file_new(wcode1);
|
|
||||||
widget_left = elm_code_widget_add(parent, wcode1);
|
widget_left = elm_code_widget_add(parent, wcode1);
|
||||||
|
|
||||||
evas_object_size_hint_weight_set(widget_left, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(widget_left, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
@ -105,7 +104,6 @@ EAPI Evas_Object *elm_code_diff_widget_add(Evas_Object *parent, Elm_Code *code)
|
||||||
|
|
||||||
// right side of diff
|
// right side of diff
|
||||||
wcode2 = elm_code_create();
|
wcode2 = elm_code_create();
|
||||||
elm_code_file_new(wcode2);
|
|
||||||
widget_right = elm_code_widget_add(parent, wcode2);
|
widget_right = elm_code_widget_add(parent, wcode2);
|
||||||
|
|
||||||
evas_object_size_hint_weight_set(widget_right, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(widget_right, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
|
|
@ -53,6 +53,9 @@ EAPI Elm_Code_File *elm_code_file_new(Elm_Code *code)
|
||||||
{
|
{
|
||||||
Elm_Code_File *ret;
|
Elm_Code_File *ret;
|
||||||
|
|
||||||
|
if (code->file)
|
||||||
|
elm_code_file_free(code->file);
|
||||||
|
|
||||||
ret = calloc(1, sizeof(Elm_Code_File));
|
ret = calloc(1, sizeof(Elm_Code_File));
|
||||||
code->file = ret;
|
code->file = ret;
|
||||||
ret->parent = code;
|
ret->parent = code;
|
||||||
|
|
|
@ -6,16 +6,14 @@
|
||||||
|
|
||||||
START_TEST (elm_code_file_memory_lines)
|
START_TEST (elm_code_file_memory_lines)
|
||||||
{
|
{
|
||||||
Elm_Code_File *file;
|
|
||||||
Elm_Code *code;
|
Elm_Code *code;
|
||||||
|
|
||||||
code = elm_code_create();
|
code = elm_code_create();
|
||||||
file = elm_code_file_new(code);
|
ck_assert_uint_eq(0, elm_code_file_lines_get(code->file));
|
||||||
ck_assert_uint_eq(0, elm_code_file_lines_get(file));
|
|
||||||
|
|
||||||
elm_code_file_line_append(file, "a line", 6);
|
elm_code_file_line_append(code->file, "a line", 6);
|
||||||
|
|
||||||
ck_assert_uint_eq(1, elm_code_file_lines_get(file));
|
ck_assert_uint_eq(1, elm_code_file_lines_get(code->file));
|
||||||
elm_code_free(code);
|
elm_code_free(code);
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
@ -27,8 +25,7 @@ START_TEST (elm_code_file_memory_tokens)
|
||||||
Elm_Code *code;
|
Elm_Code *code;
|
||||||
|
|
||||||
code = elm_code_create();
|
code = elm_code_create();
|
||||||
file = elm_code_file_new(code);
|
file = code->file;
|
||||||
|
|
||||||
elm_code_file_line_append(file, "a line", 6);
|
elm_code_file_line_append(file, "a line", 6);
|
||||||
elm_code_file_line_token_add(file, 1, 2, 5, ELM_CODE_TOKEN_TYPE_COMMENT);
|
elm_code_file_line_token_add(file, 1, 2, 5, ELM_CODE_TOKEN_TYPE_COMMENT);
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ START_TEST (elm_code_widget_token_render_simple_test)
|
||||||
Evas_Textgrid_Cell cells[25];
|
Evas_Textgrid_Cell cells[25];
|
||||||
|
|
||||||
code = elm_code_create();
|
code = elm_code_create();
|
||||||
file = elm_code_file_new(code);
|
file = code->file;
|
||||||
elm_code_file_line_append(file, "some \"test content\", 45", 23);
|
elm_code_file_line_append(file, "some \"test content\", 45", 23);
|
||||||
line = elm_code_file_line_get(file, 1);
|
line = elm_code_file_line_get(file, 1);
|
||||||
length = line->length;
|
length = line->length;
|
||||||
|
|
|
@ -14,6 +14,7 @@ AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \
|
||||||
edi_SOURCES = \
|
edi_SOURCES = \
|
||||||
editor/edi_editor_search.c \
|
editor/edi_editor_search.c \
|
||||||
editor/edi_editor.c \
|
editor/edi_editor.c \
|
||||||
|
edi_content_provider.c \
|
||||||
welcome/edi_welcome.c \
|
welcome/edi_welcome.c \
|
||||||
edi_filepanel.c \
|
edi_filepanel.c \
|
||||||
edi_logpanel.c \
|
edi_logpanel.c \
|
||||||
|
|
|
@ -337,7 +337,6 @@ void edi_testpanel_add(Evas_Object *parent)
|
||||||
|
|
||||||
code = elm_code_create();
|
code = elm_code_create();
|
||||||
_edi_test_code = code;
|
_edi_test_code = code;
|
||||||
elm_code_file_new(code);
|
|
||||||
|
|
||||||
widget = elm_code_widget_add(parent, code);
|
widget = elm_code_widget_add(parent, code);
|
||||||
elm_code_widget_font_size_set(widget, 12);
|
elm_code_widget_font_size_set(widget, 12);
|
||||||
|
|
|
@ -0,0 +1,89 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <Evas.h>
|
||||||
|
#include <Elm_Code.h>
|
||||||
|
|
||||||
|
#include "edi_content_provider.h"
|
||||||
|
#include "editor/edi_editor.h"
|
||||||
|
|
||||||
|
#include "edi_private.h"
|
||||||
|
|
||||||
|
// TODO move out to edi_content.c ot similar just like the editor type
|
||||||
|
// (and the Evas include)
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_edi_content_provider_image_add(Evas_Object *parent, Edi_Mainview_Item *item)
|
||||||
|
{
|
||||||
|
Evas_Object *img, *scroll;
|
||||||
|
|
||||||
|
scroll = elm_scroller_add(parent);
|
||||||
|
evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
evas_object_size_hint_align_set(scroll, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
||||||
|
evas_object_show(scroll);
|
||||||
|
img = elm_image_add(scroll);
|
||||||
|
elm_image_file_set(img, item->path, NULL);
|
||||||
|
elm_image_no_scale_set(img, EINA_TRUE);
|
||||||
|
elm_object_content_set(scroll, img);
|
||||||
|
evas_object_show(img);
|
||||||
|
|
||||||
|
return scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Evas_Object *
|
||||||
|
_edi_content_provider_diff_add(Evas_Object *parent, Edi_Mainview_Item *item)
|
||||||
|
{
|
||||||
|
Elm_Code *code;
|
||||||
|
Evas_Object *diff;
|
||||||
|
|
||||||
|
code = elm_code_create();
|
||||||
|
elm_code_file_open(code, item->path);
|
||||||
|
diff = elm_code_diff_widget_add(parent, code);
|
||||||
|
elm_code_diff_widget_font_size_set(diff, 12);
|
||||||
|
|
||||||
|
return diff;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Edi_Content_Provider _edi_content_provider_registry[] =
|
||||||
|
{
|
||||||
|
{"text", EINA_TRUE, EINA_TRUE, edi_editor_add},
|
||||||
|
{"image", EINA_FALSE, EINA_FALSE, _edi_content_provider_image_add},
|
||||||
|
{"diff", EINA_TRUE, EINA_FALSE, _edi_content_provider_diff_add},
|
||||||
|
|
||||||
|
{NULL, EINA_FALSE, EINA_FALSE, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
EAPI Edi_Content_Provider *edi_content_provider_for_mime_get(const char *mime)
|
||||||
|
{
|
||||||
|
char *id;
|
||||||
|
|
||||||
|
if (!strcasecmp(mime, "text/plain") || !strcasecmp(mime, "application/x-shellscript"))
|
||||||
|
id = "text";
|
||||||
|
else if (!strcasecmp(mime, "text/x-chdr") || !strcasecmp(mime, "text/x-csrc"))
|
||||||
|
id = "text"; // TODO make a code view
|
||||||
|
else if (!strncasecmp(mime, "image/", 6))
|
||||||
|
id = "image";
|
||||||
|
else if (!strcasecmp(mime, "text/x-diff") || !strcasecmp(mime, "text/x-patch"))
|
||||||
|
id = "diff";
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return edi_content_provider_for_id_get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Edi_Content_Provider *edi_content_provider_for_id_get(const char *id)
|
||||||
|
{
|
||||||
|
Edi_Content_Provider *provider;
|
||||||
|
|
||||||
|
provider = _edi_content_provider_registry;
|
||||||
|
while (provider != NULL && provider->id != NULL)
|
||||||
|
{
|
||||||
|
if (!strncmp(id, provider->id, strlen(provider->id)))
|
||||||
|
return provider;
|
||||||
|
|
||||||
|
provider++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
#ifndef EDI_CONTENT_PROVIDER_H_
|
||||||
|
# define EDI_CONTENT_PROVIDER_H_
|
||||||
|
|
||||||
|
#include <Evas.h>
|
||||||
|
|
||||||
|
#include "mainview/edi_mainview_item.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief These routines are used for managing information about supported content.
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef struct _Edi_Content_Provider
|
||||||
|
{
|
||||||
|
const char *id;
|
||||||
|
|
||||||
|
Eina_Bool is_text;
|
||||||
|
Eina_Bool is_editable;
|
||||||
|
|
||||||
|
Evas_Object *(*content_ui_add)(Evas_Object *parent, Edi_Mainview_Item *item);
|
||||||
|
} Edi_Content_Provider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Lookup information in content provider registry.
|
||||||
|
* @defgroup Lookup
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*
|
||||||
|
* Looking up content providers based on mime or id etc.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look up a content provider based on a mime type.
|
||||||
|
*
|
||||||
|
* @param mime the mime type of a file you wish to get a content provider for
|
||||||
|
*
|
||||||
|
* @return an Edi_Content_Provider if one is registered or NULL otherwise
|
||||||
|
*
|
||||||
|
* @ingroup Lookup
|
||||||
|
*/
|
||||||
|
EAPI Edi_Content_Provider *edi_content_provider_for_mime_get(const char *mime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look up a content provider based on a provider id.
|
||||||
|
* This is useful for overriding mime-type based lookup.
|
||||||
|
*
|
||||||
|
* @param mime the id of a provider you wish to get a handle for.
|
||||||
|
*
|
||||||
|
* @return an Edi_Content_Provider if one is registered or NULL otherwise
|
||||||
|
*
|
||||||
|
* @ingroup Lookup
|
||||||
|
*/
|
||||||
|
EAPI Edi_Content_Provider *edi_content_provider_for_id_get(const char *id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* EDI_CONTENT_PROVIDER_H_ */
|
|
@ -43,7 +43,6 @@ void edi_logpanel_add(Evas_Object *parent)
|
||||||
Elm_Code *code;
|
Elm_Code *code;
|
||||||
|
|
||||||
code = elm_code_create();
|
code = elm_code_create();
|
||||||
elm_code_file_new(code);
|
|
||||||
widget = elm_code_widget_add(parent, code);
|
widget = elm_code_widget_add(parent, code);
|
||||||
elm_code_widget_font_size_set(widget, 12);
|
elm_code_widget_font_size_set(widget, 12);
|
||||||
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
evas_object_size_hint_weight_set(widget, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "mainview/edi_mainview.h"
|
#include "mainview/edi_mainview.h"
|
||||||
|
|
||||||
#include "editor/edi_editor.h"
|
#include "editor/edi_editor.h"
|
||||||
|
#include "edi_content_provider.h"
|
||||||
|
|
||||||
#include "edi_private.h"
|
#include "edi_private.h"
|
||||||
|
|
||||||
|
@ -142,55 +143,16 @@ _edi_mainview_item_add(Edi_Path_Options *path, const char *mime, Elm_Object_Item
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_edi_mainview_content_image_create(Edi_Mainview_Item *item, Evas_Object *parent)
|
|
||||||
{
|
|
||||||
Evas_Object *img, *scroll;
|
|
||||||
|
|
||||||
scroll = elm_scroller_add(parent);
|
|
||||||
evas_object_size_hint_weight_set(scroll, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
|
|
||||||
evas_object_size_hint_align_set(scroll, EVAS_HINT_FILL, EVAS_HINT_FILL);
|
|
||||||
evas_object_show(scroll);
|
|
||||||
img = elm_image_add(scroll);
|
|
||||||
elm_image_file_set(img, item->path, NULL);
|
|
||||||
elm_image_no_scale_set(img, EINA_TRUE);
|
|
||||||
elm_object_content_set(scroll, img);
|
|
||||||
evas_object_show(img);
|
|
||||||
|
|
||||||
return scroll;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
|
||||||
_edi_mainview_content_diff_create(Edi_Mainview_Item *item, Evas_Object *parent)
|
|
||||||
{
|
|
||||||
Elm_Code *code;
|
|
||||||
Evas_Object *diff;
|
|
||||||
|
|
||||||
code = elm_code_create();
|
|
||||||
elm_code_file_open(code, item->path);
|
|
||||||
diff = elm_code_diff_widget_add(parent, code);
|
|
||||||
elm_code_diff_widget_font_size_set(diff, 12);
|
|
||||||
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Evas_Object *
|
static Evas_Object *
|
||||||
_edi_mainview_content_create(Edi_Mainview_Item *item, Evas_Object *parent)
|
_edi_mainview_content_create(Edi_Mainview_Item *item, Evas_Object *parent)
|
||||||
{
|
{
|
||||||
if (!strcmp(item->editortype, "text"))
|
Edi_Content_Provider *provider;
|
||||||
{
|
|
||||||
return edi_editor_add(parent, item);
|
|
||||||
}
|
|
||||||
else if (!strcmp(item->editortype, "image"))
|
|
||||||
{
|
|
||||||
return _edi_mainview_content_image_create(item, parent);
|
|
||||||
}
|
|
||||||
else if (!strcmp(item->editortype, "diff"))
|
|
||||||
{
|
|
||||||
return _edi_mainview_content_diff_create(item, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
provider = edi_content_provider_for_id_get(item->editortype);
|
||||||
|
if (!provider)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return provider->content_ui_add(parent, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -326,6 +288,7 @@ static void
|
||||||
_edi_mainview_tab_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat)
|
_edi_mainview_tab_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat)
|
||||||
{
|
{
|
||||||
Edi_Path_Options *options;
|
Edi_Path_Options *options;
|
||||||
|
Edi_Content_Provider *provider;
|
||||||
const char *mime;
|
const char *mime;
|
||||||
|
|
||||||
options = data;
|
options = data;
|
||||||
|
@ -333,20 +296,14 @@ _edi_mainview_tab_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Ein
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mime = efreet_mime_type_get(options->path);
|
mime = efreet_mime_type_get(options->path);
|
||||||
if (!strcasecmp(mime, "text/plain") || !strcasecmp(mime, "application/x-shellscript"))
|
provider = edi_content_provider_for_mime_get(mime);
|
||||||
options->type = "text";
|
if (!provider)
|
||||||
else if (!strcasecmp(mime, "text/x-chdr") || !strcasecmp(mime, "text/x-csrc"))
|
|
||||||
options->type = "text"; // TODO make a code view
|
|
||||||
else if (!strncasecmp(mime, "image/", 6))
|
|
||||||
options->type = "image";
|
|
||||||
else if (!strcasecmp(mime, "text/x-diff") || !strcasecmp(mime, "text/x-patch"))
|
|
||||||
options->type = "diff";
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
_edi_mainview_choose_type(nf, options, _edi_mainview_choose_type_tab_cb);
|
_edi_mainview_choose_type(nf, options, _edi_mainview_choose_type_tab_cb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options->type = provider->id;
|
||||||
_edi_mainview_item_tab_add(options, mime);
|
_edi_mainview_item_tab_add(options, mime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -354,6 +311,7 @@ static void
|
||||||
_edi_mainview_win_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat)
|
_edi_mainview_win_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Eina_Stat *stat)
|
||||||
{
|
{
|
||||||
Edi_Path_Options *options;
|
Edi_Path_Options *options;
|
||||||
|
Edi_Content_Provider *provider;
|
||||||
const char *mime;
|
const char *mime;
|
||||||
|
|
||||||
options = data;
|
options = data;
|
||||||
|
@ -361,20 +319,14 @@ _edi_mainview_win_stat_done(void *data, Eio_File *handler EINA_UNUSED, const Ein
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mime = efreet_mime_type_get(options->path);
|
mime = efreet_mime_type_get(options->path);
|
||||||
if (!strcasecmp(mime, "text/plain") || !strcasecmp(mime, "application/x-shellscript"))
|
provider = edi_content_provider_for_mime_get(mime);
|
||||||
options->type = "text";
|
if (!provider)
|
||||||
else if (!strcasecmp(mime, "text/x-chdr") || !strcasecmp(mime, "text/x-csrc"))
|
|
||||||
options->type = "text"; // TODO make a code view
|
|
||||||
else if (!strncasecmp(mime, "image/", 6))
|
|
||||||
options->type = "image";
|
|
||||||
else if (!strcasecmp(mime, "text/x-diff") || !strcasecmp(mime, "text/x-patch"))
|
|
||||||
options->type = "diff";
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
_edi_mainview_choose_type(nf, options, _edi_mainview_choose_type_win_cb);
|
_edi_mainview_choose_type(nf, options, _edi_mainview_choose_type_win_cb);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options->type = provider->id;
|
||||||
_edi_mainview_item_win_add(options, mime);
|
_edi_mainview_item_win_add(options, mime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,16 +5,19 @@ check_PROGRAMS = edi_suite
|
||||||
|
|
||||||
edi_suite_SOURCES = \
|
edi_suite_SOURCES = \
|
||||||
edi_test_path.c \
|
edi_test_path.c \
|
||||||
|
edi_test_content_provider.c \
|
||||||
edi_suite.c
|
edi_suite.c
|
||||||
|
|
||||||
edi_suite_CPPFLAGS = -I$(top_builddir)/src/lib/ -I$(top_builddir)/src/bin/ \
|
edi_suite_CPPFLAGS = -I$(top_builddir)/src/lib/ -I$(top_builddir)/src/bin/ \
|
||||||
|
-I$(top_srcdir)/elm_code/lib \
|
||||||
-DPACKAGE_TESTS_DIR=\"$(top_srcdir)/src/tests/\" \
|
-DPACKAGE_TESTS_DIR=\"$(top_srcdir)/src/tests/\" \
|
||||||
-DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)/src/tests/\" \
|
-DPACKAGE_BUILD_DIR=\"`pwd`/$(top_builddir)/src/tests/\" \
|
||||||
|
-DEFL_BETA_API_SUPPORT \
|
||||||
@EFL_CFLAGS@ \
|
@EFL_CFLAGS@ \
|
||||||
@CHECK_CFLAGS@
|
@CHECK_CFLAGS@
|
||||||
|
|
||||||
edi_suite_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libedi.la
|
edi_suite_LDADD = @CHECK_LIBS@ $(top_builddir)/src/lib/libedi.la $(top_builddir)/elm_code/lib/libelm_code.la
|
||||||
edi_suite_DEPENDENCIES = $(top_builddir)/src/lib/libedi.la
|
edi_suite_DEPENDENCIES = $(top_builddir)/src/lib/libedi.la $(top_builddir)/elm_code/lib/libelm_code.la
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,8 @@ static const struct {
|
||||||
void (*build)(TCase *tc);
|
void (*build)(TCase *tc);
|
||||||
} tests[] = {
|
} tests[] = {
|
||||||
{ "basic", edi_test_basic },
|
{ "basic", edi_test_basic },
|
||||||
{ "path", edi_test_path }
|
{ "path", edi_test_path },
|
||||||
|
{ "content_provider", edi_test_content_provider }
|
||||||
};
|
};
|
||||||
|
|
||||||
START_TEST(edi_initialization)
|
START_TEST(edi_initialization)
|
||||||
|
|
|
@ -8,5 +8,6 @@
|
||||||
void edi_test_basic(TCase *tc);
|
void edi_test_basic(TCase *tc);
|
||||||
void edi_test_console(TCase *tc);
|
void edi_test_console(TCase *tc);
|
||||||
void edi_test_path(TCase *tc);
|
void edi_test_path(TCase *tc);
|
||||||
|
void edi_test_content_provider(TCase *tc);
|
||||||
|
|
||||||
#endif /* _EDI_SUITE_H */
|
#endif /* _EDI_SUITE_H */
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "edi_content_provider.c"
|
||||||
|
|
||||||
|
#include "edi_suite.h"
|
||||||
|
|
||||||
|
START_TEST (edi_test_content_provider_id_lookup)
|
||||||
|
{
|
||||||
|
Edi_Content_Provider *provider;
|
||||||
|
|
||||||
|
provider = edi_content_provider_for_id_get("text");
|
||||||
|
|
||||||
|
ck_assert(provider);
|
||||||
|
ck_assert_str_eq(provider->id, "text");
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
START_TEST (edi_test_content_provider_mime_lookup)
|
||||||
|
{
|
||||||
|
Edi_Content_Provider *provider;
|
||||||
|
|
||||||
|
provider = edi_content_provider_for_mime_get("text/plain");
|
||||||
|
|
||||||
|
ck_assert(provider);
|
||||||
|
ck_assert_str_eq(provider->id, "text");
|
||||||
|
}
|
||||||
|
END_TEST
|
||||||
|
|
||||||
|
void edi_test_content_provider(TCase *tc)
|
||||||
|
{
|
||||||
|
tcase_add_test(tc, edi_test_content_provider_id_lookup);
|
||||||
|
tcase_add_test(tc, edi_test_content_provider_mime_lookup);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue