renaming from gedit to pluma
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
INCLUDES = -g -I$(top_srcdir) -I$(top_srcdir)/gedit $(GEDIT_DEBUG_FLAGS) $(GEDIT_CFLAGS)
|
||||
INCLUDES = -g -I$(top_srcdir) -I$(top_srcdir)/pluma $(PLUMA_DEBUG_FLAGS) $(PLUMA_CFLAGS)
|
||||
|
||||
noinst_PROGRAMS = $(TEST_PROGS)
|
||||
progs_ldadd = $(top_builddir)/gedit/libgedit.la
|
||||
progs_ldadd = $(top_builddir)/pluma/libpluma.la
|
||||
|
||||
TEST_PROGS = smart-converter
|
||||
smart_converter_SOURCES = smart-converter.c
|
||||
|
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
* document-input-stream.c
|
||||
* This file is part of gedit
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2010 - Ignacio Casal Quinteiro
|
||||
*
|
||||
* gedit is free software; you can redistribute it and/or modify
|
||||
* pluma is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gedit is distributed in the hope that it will be useful,
|
||||
* pluma is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gedit; if not, write to the Free Software
|
||||
* along with pluma; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "gedit-document-input-stream.h"
|
||||
#include "pluma-document-input-stream.h"
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
@@ -30,7 +30,7 @@
|
||||
static void
|
||||
test_consecutive_read (const gchar *inbuf,
|
||||
const gchar *outbuf,
|
||||
GeditDocumentNewlineType type,
|
||||
PlumaDocumentNewlineType type,
|
||||
gsize read_chunk_len)
|
||||
{
|
||||
GtkTextBuffer *buf;
|
||||
@@ -45,7 +45,7 @@ test_consecutive_read (const gchar *inbuf,
|
||||
gtk_text_buffer_set_text (buf, inbuf, -1);
|
||||
|
||||
b = g_malloc (200);
|
||||
in = gedit_document_input_stream_new (buf, type);
|
||||
in = pluma_document_input_stream_new (buf, type);
|
||||
|
||||
outlen = strlen (outbuf);
|
||||
n = 0;
|
||||
@@ -78,63 +78,63 @@ static void
|
||||
test_empty ()
|
||||
{
|
||||
/* empty file should not have a trailing newline */
|
||||
test_consecutive_read ("", "", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 10);
|
||||
test_consecutive_read ("", "", PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, 10);
|
||||
}
|
||||
|
||||
static void
|
||||
test_consecutive_cut_char ()
|
||||
{
|
||||
/* first \n is read then fo and then is added \r but not \n */
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\r\nfo\r\nbar\r\n\r\nblah\r\n\r\n", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 8);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\r\nfo\r\nbar\r\n\r\nblah\r\n", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 8);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\r\nfo\r\nbar\r\n\r\nblah\r\n\r\n", PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, 8);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\r\nfo\r\nbar\r\n\r\nblah\r\n", PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, 8);
|
||||
}
|
||||
|
||||
static void
|
||||
test_consecutive_big_read ()
|
||||
{
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\rfo\rbar\r\rblah\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\rfo\rbar\r\rblah\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\rfo\rbar\r\rblah\r\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\rfo\rbar\r\rblah\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah\r", "\nfo\nbar\n\nblah\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah", "\nfo\nbar\n\nblah\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah\r", "\nfo\nbar\n\nblah\n\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah", "\nfo\nbar\n\nblah\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah\r\n", "\nfo\nbar\n\nblah\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah", "\nfo\nbar\n\nblah\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah\r\n", "\nfo\nbar\n\nblah\n\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah", "\nfo\nbar\n\nblah\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\r\nfo\r\nbar\r\n\r\nblah\r\n\r\n", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 200);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\r\nfo\r\nbar\r\n\r\nblah\r\n", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 200);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\r\nfo\r\nbar\r\n\r\nblah\r\n\r\n", PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, 200);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\r\nfo\r\nbar\r\n\r\nblah\r\n", PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, 200);
|
||||
}
|
||||
|
||||
static void
|
||||
test_consecutive_middle_read ()
|
||||
{
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\rfo\rbar\r\rblah\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\rfo\rbar\r\rblah\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\rfo\rbar\r\rblah\r\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\rfo\rbar\r\rblah\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah\r", "\nfo\nbar\n\nblah\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah", "\nfo\nbar\n\nblah\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah\r", "\nfo\nbar\n\nblah\n\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
test_consecutive_read ("\rfo\rbar\r\rblah", "\nfo\nbar\n\nblah\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah\r\n", "\nfo\nbar\n\nblah\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah", "\nfo\nbar\n\nblah\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah\r\n", "\nfo\nbar\n\nblah\n\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
test_consecutive_read ("\r\nfo\r\nbar\r\n\r\nblah", "\nfo\nbar\n\nblah\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\r\nfo\r\nbar\r\n\r\nblah\r\n\r\n", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 6);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\r\nfo\r\nbar\r\n\r\nblah\r\n", GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, 6);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah\n", "\r\nfo\r\nbar\r\n\r\nblah\r\n\r\n", PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, 6);
|
||||
test_consecutive_read ("\nfo\nbar\n\nblah", "\r\nfo\r\nbar\r\n\r\nblah\r\n", PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, 6);
|
||||
}
|
||||
|
||||
static void
|
||||
test_consecutive_multibyte_cut ()
|
||||
{
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
test_consecutive_read ("hello\rhello\xe6\x96\x87\rworld\r", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\nhello\xe6\x96\x87\nworld\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\rhello\xe6\x96\x87\rworld\r\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
test_consecutive_read ("hello\rhello\xe6\x96\x87\rworld\r", "hello\rhello\xe6\x96\x87\rworld\r\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 6);
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\nhello\xe6\x96\x87\nworld\n\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 6);
|
||||
}
|
||||
|
||||
static void
|
||||
test_consecutive_multibyte_big_read ()
|
||||
{
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
test_consecutive_read ("hello\rhello\xe6\x96\x87\rworld\r", "hello\rhello\xe6\x96\x87\rworld\r\r", GEDIT_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\nhello\xe6\x96\x87\nworld\n\n", GEDIT_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\rhello\xe6\x96\x87\rworld\r\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
test_consecutive_read ("hello\rhello\xe6\x96\x87\rworld\r", "hello\rhello\xe6\x96\x87\rworld\r\r", PLUMA_DOCUMENT_NEWLINE_TYPE_CR, 200);
|
||||
test_consecutive_read ("hello\nhello\xe6\x96\x87\nworld\n", "hello\nhello\xe6\x96\x87\nworld\n\n", PLUMA_DOCUMENT_NEWLINE_TYPE_LF, 200);
|
||||
}
|
||||
|
||||
int main (int argc,
|
||||
|
@@ -1,26 +1,26 @@
|
||||
/*
|
||||
* document-loader.c
|
||||
* This file is part of gedit
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2010 - Jesse van den Kieboom
|
||||
*
|
||||
* gedit is free software; you can redistribute it and/or modify
|
||||
* pluma is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gedit is distributed in the hope that it will be useful,
|
||||
* pluma is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gedit; if not, write to the Free Software
|
||||
* along with pluma; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "gedit-gio-document-loader.h"
|
||||
#include "pluma-gio-document-loader.h"
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
@@ -40,7 +40,7 @@ create_document (const gchar *filename,
|
||||
const gchar *contents)
|
||||
{
|
||||
GError *error = NULL;
|
||||
GeditDocument *document;
|
||||
PlumaDocument *document;
|
||||
gchar *uri;
|
||||
|
||||
if (!g_file_set_contents (filename, contents, -1, &error))
|
||||
@@ -66,7 +66,7 @@ delete_document (GFile *location)
|
||||
}
|
||||
|
||||
static void
|
||||
on_document_loaded (GeditDocument *document,
|
||||
on_document_loaded (PlumaDocument *document,
|
||||
GError *error,
|
||||
LoaderTestData *data)
|
||||
{
|
||||
@@ -88,7 +88,7 @@ on_document_loaded (GeditDocument *document,
|
||||
|
||||
if (data->newline_type != -1)
|
||||
{
|
||||
g_assert_cmpint (gedit_document_get_newline_type (document),
|
||||
g_assert_cmpint (pluma_document_get_newline_type (document),
|
||||
==,
|
||||
data->newline_type);
|
||||
}
|
||||
@@ -104,11 +104,11 @@ test_loader (const gchar *filename,
|
||||
{
|
||||
GFile *file;
|
||||
gchar *uri;
|
||||
GeditDocument *document;
|
||||
PlumaDocument *document;
|
||||
|
||||
file = create_document (filename, contents);
|
||||
|
||||
document = gedit_document_new ();
|
||||
document = pluma_document_new ();
|
||||
|
||||
LoaderTestData *data = g_slice_new (LoaderTestData);
|
||||
data->in_buffer = in_buffer;
|
||||
@@ -124,7 +124,7 @@ test_loader (const gchar *filename,
|
||||
|
||||
uri = g_file_get_uri (file);
|
||||
|
||||
gedit_document_load (document, uri, gedit_encoding_get_utf8 (), 0, FALSE);
|
||||
pluma_document_load (document, uri, pluma_encoding_get_utf8 (), 0, FALSE);
|
||||
|
||||
g_free (uri);
|
||||
|
||||
@@ -203,17 +203,17 @@ test_end_new_line_detection ()
|
||||
test_loader ("document-loader.txt",
|
||||
"hello world\n",
|
||||
NULL,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
|
||||
test_loader ("document-loader.txt",
|
||||
"hello world\r\n",
|
||||
NULL,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
|
||||
test_loader ("document-loader.txt",
|
||||
"hello world\r",
|
||||
NULL,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -222,17 +222,17 @@ test_begin_new_line_detection ()
|
||||
test_loader ("document-loader.txt",
|
||||
"\nhello world",
|
||||
NULL,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
|
||||
test_loader ("document-loader.txt",
|
||||
"\r\nhello world",
|
||||
NULL,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
|
||||
test_loader ("document-loader.txt",
|
||||
"\rhello world",
|
||||
NULL,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
}
|
||||
|
||||
int main (int argc,
|
||||
@@ -241,7 +241,7 @@ int main (int argc,
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
gedit_prefs_manager_app_init ();
|
||||
pluma_prefs_manager_app_init ();
|
||||
|
||||
g_test_add_func ("/document-loader/end-line-stripping", test_end_line_stripping);
|
||||
g_test_add_func ("/document-loader/end-new-line-detection", test_end_new_line_detection);
|
||||
|
@@ -1,27 +1,27 @@
|
||||
/*
|
||||
* document-output-stream.c
|
||||
* This file is part of gedit
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2010 - Ignacio Casal Quinteiro
|
||||
*
|
||||
* gedit is free software; you can redistribute it and/or modify
|
||||
* pluma is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gedit is distributed in the hope that it will be useful,
|
||||
* pluma is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gedit; if not, write to the Free Software
|
||||
* along with pluma; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "gedit-document-output-stream.h"
|
||||
#include "pluma-document-output-stream.h"
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
@@ -31,18 +31,18 @@ static void
|
||||
test_consecutive_write (const gchar *inbuf,
|
||||
const gchar *outbuf,
|
||||
gsize write_chunk_len,
|
||||
GeditDocumentNewlineType newline_type)
|
||||
PlumaDocumentNewlineType newline_type)
|
||||
{
|
||||
GeditDocument *doc;
|
||||
PlumaDocument *doc;
|
||||
GOutputStream *out;
|
||||
gsize len;
|
||||
gssize n, w;
|
||||
GError *err = NULL;
|
||||
gchar *b;
|
||||
GeditDocumentNewlineType type;
|
||||
PlumaDocumentNewlineType type;
|
||||
|
||||
doc = gedit_document_new ();
|
||||
out = gedit_document_output_stream_new (doc);
|
||||
doc = pluma_document_new ();
|
||||
out = pluma_document_output_stream_new (doc);
|
||||
|
||||
n = 0;
|
||||
|
||||
@@ -61,7 +61,7 @@ test_consecutive_write (const gchar *inbuf,
|
||||
g_assert_cmpstr (inbuf, ==, b);
|
||||
g_free (b);
|
||||
|
||||
type = gedit_document_output_stream_detect_newline_type (GEDIT_DOCUMENT_OUTPUT_STREAM (out));
|
||||
type = pluma_document_output_stream_detect_newline_type (PLUMA_DOCUMENT_OUTPUT_STREAM (out));
|
||||
g_assert (type == newline_type);
|
||||
|
||||
g_output_stream_close (out, NULL, &err);
|
||||
@@ -81,39 +81,39 @@ test_consecutive_write (const gchar *inbuf,
|
||||
static void
|
||||
test_empty ()
|
||||
{
|
||||
test_consecutive_write ("", "", 10, GEDIT_DOCUMENT_NEWLINE_TYPE_DEFAULT);
|
||||
test_consecutive_write ("\r\n", "", 10, GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
test_consecutive_write ("\r", "", 10, GEDIT_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
test_consecutive_write ("\n", "", 10, GEDIT_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
test_consecutive_write ("", "", 10, PLUMA_DOCUMENT_NEWLINE_TYPE_DEFAULT);
|
||||
test_consecutive_write ("\r\n", "", 10, PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
test_consecutive_write ("\r", "", 10, PLUMA_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
test_consecutive_write ("\n", "", 10, PLUMA_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
}
|
||||
|
||||
static void
|
||||
test_consecutive ()
|
||||
{
|
||||
test_consecutive_write ("hello\nhow\nare\nyou", "hello\nhow\nare\nyou", 2,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
test_consecutive_write ("hello\rhow\rare\ryou", "hello\rhow\rare\ryou", 2,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
test_consecutive_write ("hello\r\nhow\r\nare\r\nyou", "hello\r\nhow\r\nare\r\nyou", 2,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
}
|
||||
|
||||
static void
|
||||
test_consecutive_tnewline ()
|
||||
{
|
||||
test_consecutive_write ("hello\nhow\nare\nyou\n", "hello\nhow\nare\nyou", 2,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
test_consecutive_write ("hello\rhow\rare\ryou\r", "hello\rhow\rare\ryou", 2,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR);
|
||||
test_consecutive_write ("hello\r\nhow\r\nare\r\nyou\r\n", "hello\r\nhow\r\nare\r\nyou", 2,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF);
|
||||
}
|
||||
|
||||
static void
|
||||
test_big_char ()
|
||||
{
|
||||
test_consecutive_write ("\343\203\200\343\203\200", "\343\203\200\343\203\200", 2,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF);
|
||||
}
|
||||
|
||||
int main (int argc,
|
||||
@@ -122,7 +122,7 @@ int main (int argc,
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
gedit_prefs_manager_app_init ();
|
||||
pluma_prefs_manager_app_init ();
|
||||
|
||||
g_test_add_func ("/document-output-stream/empty", test_empty);
|
||||
|
||||
|
@@ -1,45 +1,45 @@
|
||||
/*
|
||||
* document-saver.c
|
||||
* This file is part of gedit
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2010 - Jesse van den Kieboom
|
||||
*
|
||||
* gedit is free software; you can redistribute it and/or modify
|
||||
* pluma is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gedit is distributed in the hope that it will be useful,
|
||||
* pluma is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gedit; if not, write to the Free Software
|
||||
* along with pluma; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "gedit-gio-document-loader.h"
|
||||
#include "pluma-gio-document-loader.h"
|
||||
#include <gio/gio.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define DEFAULT_LOCAL_URI "/tmp/gedit-document-saver-test.txt"
|
||||
#define DEFAULT_REMOTE_URI "sftp://localhost/tmp/gedit-document-saver-test.txt"
|
||||
#define DEFAULT_LOCAL_URI "/tmp/pluma-document-saver-test.txt"
|
||||
#define DEFAULT_REMOTE_URI "sftp://localhost/tmp/pluma-document-saver-test.txt"
|
||||
#define DEFAULT_CONTENT "hello world!"
|
||||
#define DEFAULT_CONTENT_RESULT "hello world!\n"
|
||||
|
||||
#define UNOWNED_LOCAL_DIRECTORY "/tmp/gedit-document-saver-unowned"
|
||||
#define UNOWNED_LOCAL_URI "/tmp/gedit-document-saver-unowned/gedit-document-saver-test.txt"
|
||||
#define UNOWNED_LOCAL_DIRECTORY "/tmp/pluma-document-saver-unowned"
|
||||
#define UNOWNED_LOCAL_URI "/tmp/pluma-document-saver-unowned/pluma-document-saver-test.txt"
|
||||
|
||||
#define UNOWNED_REMOTE_DIRECTORY "sftp://localhost/tmp/gedit-document-saver-unowned"
|
||||
#define UNOWNED_REMOTE_URI "sftp://localhost/tmp/gedit-document-saver-unowned/gedit-document-saver-test.txt"
|
||||
#define UNOWNED_REMOTE_DIRECTORY "sftp://localhost/tmp/pluma-document-saver-unowned"
|
||||
#define UNOWNED_REMOTE_URI "sftp://localhost/tmp/pluma-document-saver-unowned/pluma-document-saver-test.txt"
|
||||
|
||||
#define UNOWNED_GROUP_LOCAL_URI "/tmp/gedit-document-saver-unowned-group.txt"
|
||||
#define UNOWNED_GROUP_REMOTE_URI "sftp://localhost/tmp/gedit-document-saver-unowned-group.txt"
|
||||
#define UNOWNED_GROUP_LOCAL_URI "/tmp/pluma-document-saver-unowned-group.txt"
|
||||
#define UNOWNED_GROUP_REMOTE_URI "sftp://localhost/tmp/pluma-document-saver-unowned-group.txt"
|
||||
|
||||
static gboolean test_completed;
|
||||
static gboolean mount_completed;
|
||||
@@ -76,17 +76,17 @@ saver_test_data_free (SaverTestData *data)
|
||||
g_slice_free (SaverTestData, data);
|
||||
}
|
||||
|
||||
static GeditDocument *
|
||||
static PlumaDocument *
|
||||
create_document (const gchar *contents)
|
||||
{
|
||||
GeditDocument *document = gedit_document_new ();
|
||||
PlumaDocument *document = pluma_document_new ();
|
||||
|
||||
gtk_text_buffer_set_text (GTK_TEXT_BUFFER (document), contents, -1);
|
||||
return document;
|
||||
}
|
||||
|
||||
static void
|
||||
complete_test_error (GeditDocument *document,
|
||||
complete_test_error (PlumaDocument *document,
|
||||
GError *error,
|
||||
SaverTestData *data)
|
||||
{
|
||||
@@ -119,7 +119,7 @@ read_file (const gchar *uri)
|
||||
}
|
||||
|
||||
static void
|
||||
complete_test (GeditDocument *document,
|
||||
complete_test (PlumaDocument *document,
|
||||
GError *error,
|
||||
SaverTestData *data)
|
||||
{
|
||||
@@ -189,18 +189,18 @@ ensure_mounted (GFile *file)
|
||||
static void
|
||||
test_saver (const gchar *filename_or_uri,
|
||||
const gchar *contents,
|
||||
GeditDocumentNewlineType newline_type,
|
||||
GeditDocumentSaveFlags save_flags,
|
||||
PlumaDocumentNewlineType newline_type,
|
||||
PlumaDocumentSaveFlags save_flags,
|
||||
GCallback saved_callback,
|
||||
SaverTestData *data)
|
||||
{
|
||||
GFile *file;
|
||||
gchar *uri;
|
||||
GeditDocument *document;
|
||||
PlumaDocument *document;
|
||||
gboolean existed;
|
||||
|
||||
document = create_document (contents);
|
||||
gedit_document_set_newline_type (document, newline_type);
|
||||
pluma_document_set_newline_type (document, newline_type);
|
||||
|
||||
g_signal_connect (document, "saved", G_CALLBACK (complete_test_error), data);
|
||||
|
||||
@@ -219,7 +219,7 @@ test_saver (const gchar *filename_or_uri,
|
||||
|
||||
ensure_mounted (file);
|
||||
|
||||
gedit_document_save_as (document, uri, gedit_encoding_get_utf8 (), save_flags);
|
||||
pluma_document_save_as (document, uri, pluma_encoding_get_utf8 (), save_flags);
|
||||
|
||||
while (!test_completed)
|
||||
{
|
||||
@@ -239,45 +239,45 @@ test_saver (const gchar *filename_or_uri,
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GeditDocumentNewlineType type;
|
||||
PlumaDocumentNewlineType type;
|
||||
const gchar *text;
|
||||
const gchar *result;
|
||||
} NewLineTestData;
|
||||
|
||||
static NewLineTestData newline_test_data[] = {
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\nworld", "\nhello\nworld\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\nworld\n", "\nhello\nworld\n\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\nworld\n\n", "\nhello\nworld\n\n\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\r\nhello\r\nworld", "\nhello\nworld\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\r\nhello\r\nworld\r\n", "\nhello\nworld\n\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\rhello\rworld", "\nhello\nworld\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\rhello\rworld\r", "\nhello\nworld\n\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\r\nworld", "\nhello\nworld\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\r\nworld\r", "\nhello\nworld\n\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\nworld", "\nhello\nworld\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\nworld\n", "\nhello\nworld\n\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\nworld\n\n", "\nhello\nworld\n\n\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\r\nhello\r\nworld", "\nhello\nworld\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\r\nhello\r\nworld\r\n", "\nhello\nworld\n\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\rhello\rworld", "\nhello\nworld\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\rhello\rworld\r", "\nhello\nworld\n\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\r\nworld", "\nhello\nworld\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_LF, "\nhello\r\nworld\r", "\nhello\nworld\n\n"},
|
||||
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\nworld", "\r\nhello\r\nworld\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\nworld\n", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\nworld\n\n", "\r\nhello\r\nworld\r\n\r\n\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\r\nhello\r\nworld", "\r\nhello\r\nworld\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\r\nhello\r\nworld\r\n", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\rhello\rworld", "\r\nhello\r\nworld\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\rhello\rworld\r", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\r\nworld", "\r\nhello\r\nworld\r\n"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\r\nworld\r", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\nworld", "\r\nhello\r\nworld\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\nworld\n", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\nworld\n\n", "\r\nhello\r\nworld\r\n\r\n\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\r\nhello\r\nworld", "\r\nhello\r\nworld\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\r\nhello\r\nworld\r\n", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\rhello\rworld", "\r\nhello\r\nworld\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\rhello\rworld\r", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\r\nworld", "\r\nhello\r\nworld\r\n"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR_LF, "\nhello\r\nworld\r", "\r\nhello\r\nworld\r\n\r\n"},
|
||||
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\nworld", "\rhello\rworld\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\nworld\n", "\rhello\rworld\r\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\nworld\n\n", "\rhello\rworld\r\r\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\r\nhello\r\nworld", "\rhello\rworld\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\r\nhello\r\nworld\r\n", "\rhello\rworld\r\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\rhello\rworld", "\rhello\rworld\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\rhello\rworld\r", "\rhello\rworld\r\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\r\nworld", "\rhello\rworld\r"},
|
||||
{GEDIT_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\r\nworld\r", "\rhello\rworld\r\r"}
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\nworld", "\rhello\rworld\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\nworld\n", "\rhello\rworld\r\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\nworld\n\n", "\rhello\rworld\r\r\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\r\nhello\r\nworld", "\rhello\rworld\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\r\nhello\r\nworld\r\n", "\rhello\rworld\r\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\rhello\rworld", "\rhello\rworld\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\rhello\rworld\r", "\rhello\rworld\r\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\r\nworld", "\rhello\rworld\r"},
|
||||
{PLUMA_DOCUMENT_NEWLINE_TYPE_CR, "\nhello\r\nworld\r", "\rhello\rworld\r\r"}
|
||||
};
|
||||
|
||||
static void
|
||||
test_new_line (const gchar *filename, GeditDocumentSaveFlags save_flags)
|
||||
test_new_line (const gchar *filename, PlumaDocumentSaveFlags save_flags)
|
||||
{
|
||||
gint i;
|
||||
gint num = sizeof (newline_test_data) / sizeof (NewLineTestData);
|
||||
@@ -306,21 +306,21 @@ test_local ()
|
||||
{
|
||||
test_saver (DEFAULT_LOCAL_URI,
|
||||
"hello world",
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (DEFAULT_LOCAL_URI, "hello world\n", NULL));
|
||||
|
||||
test_saver (DEFAULT_LOCAL_URI,
|
||||
"hello world\r\n",
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (DEFAULT_LOCAL_URI, "hello world\n\n", NULL));
|
||||
|
||||
test_saver (DEFAULT_LOCAL_URI,
|
||||
"hello world\n",
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (DEFAULT_LOCAL_URI, "hello world\n\n", NULL));
|
||||
@@ -337,21 +337,21 @@ test_remote ()
|
||||
{
|
||||
test_saver (DEFAULT_REMOTE_URI,
|
||||
"hello world",
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (DEFAULT_REMOTE_URI, "hello world\n", NULL));
|
||||
|
||||
test_saver (DEFAULT_REMOTE_URI,
|
||||
"hello world\r\n",
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (DEFAULT_REMOTE_URI, "hello world\n\n", NULL));
|
||||
|
||||
test_saver (DEFAULT_REMOTE_URI,
|
||||
"hello world\n",
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (DEFAULT_REMOTE_URI, "hello world\n\n", NULL));
|
||||
@@ -381,12 +381,12 @@ check_permissions (GFile *file,
|
||||
}
|
||||
|
||||
static void
|
||||
check_permissions_saved (GeditDocument *document,
|
||||
check_permissions_saved (PlumaDocument *document,
|
||||
GError *error,
|
||||
SaverTestData *data)
|
||||
{
|
||||
guint permissions = (guint)GPOINTER_TO_INT (data->data);
|
||||
GFile *file = gedit_document_get_location (document);
|
||||
GFile *file = pluma_document_get_location (document);
|
||||
|
||||
check_permissions (file, permissions);
|
||||
|
||||
@@ -434,7 +434,7 @@ test_permissions (const gchar *uri,
|
||||
|
||||
test_saver (uri,
|
||||
DEFAULT_CONTENT,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
G_CALLBACK (check_permissions_saved),
|
||||
saver_test_data_new (uri,
|
||||
@@ -460,7 +460,7 @@ test_local_unowned_directory ()
|
||||
{
|
||||
test_saver (UNOWNED_LOCAL_URI,
|
||||
DEFAULT_CONTENT,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (UNOWNED_LOCAL_URI,
|
||||
@@ -473,7 +473,7 @@ test_remote_unowned_directory ()
|
||||
{
|
||||
test_saver (UNOWNED_REMOTE_URI,
|
||||
DEFAULT_CONTENT,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
NULL,
|
||||
saver_test_data_new (UNOWNED_REMOTE_URI,
|
||||
@@ -492,7 +492,7 @@ test_remote_permissions ()
|
||||
}
|
||||
|
||||
static void
|
||||
test_unowned_group_permissions (GeditDocument *document,
|
||||
test_unowned_group_permissions (PlumaDocument *document,
|
||||
GError *error,
|
||||
SaverTestData *data)
|
||||
{
|
||||
@@ -526,7 +526,7 @@ test_unowned_group (const gchar *uri)
|
||||
{
|
||||
test_saver (uri,
|
||||
DEFAULT_CONTENT,
|
||||
GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
PLUMA_DOCUMENT_NEWLINE_TYPE_LF,
|
||||
0,
|
||||
G_CALLBACK (test_unowned_group_permissions),
|
||||
saver_test_data_new (uri,
|
||||
@@ -690,7 +690,7 @@ int main (int argc,
|
||||
g_type_init ();
|
||||
g_test_init (&argc, &argv, NULL);
|
||||
|
||||
gedit_prefs_manager_app_init ();
|
||||
pluma_prefs_manager_app_init ();
|
||||
|
||||
g_printf ("\n***\n");
|
||||
have_unowned = check_unowned_directory ();
|
||||
|
@@ -3,10 +3,10 @@
|
||||
# This script is used to setup some special directory structures, permissions
|
||||
# for the saver test
|
||||
|
||||
UNOWNED_DIRECTORY="/tmp/gedit-document-saver-unowned"
|
||||
UNOWNED_FILE="/tmp/gedit-document-saver-unowned/gedit-document-saver-test.txt"
|
||||
UNOWNED_DIRECTORY="/tmp/pluma-document-saver-unowned"
|
||||
UNOWNED_FILE="/tmp/pluma-document-saver-unowned/pluma-document-saver-test.txt"
|
||||
|
||||
UNOWNED_GROUP="/tmp/gedit-document-saver-unowned-group.txt"
|
||||
UNOWNED_GROUP="/tmp/pluma-document-saver-unowned-group.txt"
|
||||
|
||||
if [ -f "$UNOWNED_FILE" ]; then
|
||||
sudo rm "$UNOWNED_FILE"
|
||||
|
@@ -1,28 +1,28 @@
|
||||
/*
|
||||
* smart-converter.c
|
||||
* This file is part of gedit
|
||||
* This file is part of pluma
|
||||
*
|
||||
* Copyright (C) 2009 - Ignacio Casal Quinteiro
|
||||
*
|
||||
* gedit is free software; you can redistribute it and/or modify
|
||||
* pluma is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* gedit is distributed in the hope that it will be useful,
|
||||
* pluma is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with gedit; if not, write to the Free Software
|
||||
* along with pluma; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
|
||||
#include "gedit-smart-charset-converter.h"
|
||||
#include "gedit-encodings.h"
|
||||
#include "pluma-smart-charset-converter.h"
|
||||
#include "pluma-encodings.h"
|
||||
#include <gio/gio.h>
|
||||
#include <glib.h>
|
||||
#include <string.h>
|
||||
@@ -46,8 +46,8 @@ print_hex (gchar *ptr, gint len)
|
||||
static gchar *
|
||||
get_encoded_text (const gchar *text,
|
||||
gsize nread,
|
||||
const GeditEncoding *to,
|
||||
const GeditEncoding *from,
|
||||
const PlumaEncoding *to,
|
||||
const PlumaEncoding *from,
|
||||
gsize *bytes_written_aux,
|
||||
gboolean care_about_error)
|
||||
{
|
||||
@@ -58,8 +58,8 @@ get_encoded_text (const gchar *text,
|
||||
GConverterResult res;
|
||||
GError *err;
|
||||
|
||||
converter = g_charset_converter_new (gedit_encoding_get_charset (to),
|
||||
gedit_encoding_get_charset (from),
|
||||
converter = g_charset_converter_new (pluma_encoding_get_charset (to),
|
||||
pluma_encoding_get_charset (from),
|
||||
NULL);
|
||||
|
||||
out = g_malloc (200);
|
||||
@@ -125,9 +125,9 @@ get_all_encodings ()
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
const GeditEncoding *enc;
|
||||
const PlumaEncoding *enc;
|
||||
|
||||
enc = gedit_encoding_get_from_index (i);
|
||||
enc = pluma_encoding_get_from_index (i);
|
||||
|
||||
if (enc == NULL)
|
||||
break;
|
||||
@@ -144,9 +144,9 @@ do_test (const gchar *test_in,
|
||||
const gchar *enc,
|
||||
GSList *encodings,
|
||||
gsize nread,
|
||||
const GeditEncoding **guessed)
|
||||
const PlumaEncoding **guessed)
|
||||
{
|
||||
GeditSmartCharsetConverter *converter;
|
||||
PlumaSmartCharsetConverter *converter;
|
||||
gchar *out, *out_aux;
|
||||
gsize bytes_read, bytes_read_aux;
|
||||
gsize bytes_written, bytes_written_aux;
|
||||
@@ -156,10 +156,10 @@ do_test (const gchar *test_in,
|
||||
if (enc != NULL)
|
||||
{
|
||||
encodings = NULL;
|
||||
encodings = g_slist_prepend (encodings, (gpointer)gedit_encoding_get_from_charset (enc));
|
||||
encodings = g_slist_prepend (encodings, (gpointer)pluma_encoding_get_from_charset (enc));
|
||||
}
|
||||
|
||||
converter = gedit_smart_charset_converter_new (encodings);
|
||||
converter = pluma_smart_charset_converter_new (encodings);
|
||||
|
||||
out = g_malloc (200);
|
||||
out_aux = g_malloc (200);
|
||||
@@ -188,7 +188,7 @@ do_test (const gchar *test_in,
|
||||
out[bytes_written_aux] = '\0';
|
||||
|
||||
if (guessed != NULL)
|
||||
*guessed = gedit_smart_charset_converter_get_guessed (converter);
|
||||
*guessed = pluma_smart_charset_converter_get_guessed (converter);
|
||||
|
||||
return out;
|
||||
}
|
||||
@@ -200,7 +200,7 @@ do_test_roundtrip (const char *str, const char *charset)
|
||||
gchar *buf, *p;
|
||||
GInputStream *in, *tmp;
|
||||
GCharsetConverter *c1;
|
||||
GeditSmartCharsetConverter *c2;
|
||||
PlumaSmartCharsetConverter *c2;
|
||||
gsize n, tot;
|
||||
GError *err;
|
||||
GSList *enc = NULL;
|
||||
@@ -217,8 +217,8 @@ do_test_roundtrip (const char *str, const char *charset)
|
||||
g_object_unref (tmp);
|
||||
g_object_unref (c1);
|
||||
|
||||
enc = g_slist_prepend (enc, (gpointer)gedit_encoding_get_from_charset (charset));
|
||||
c2 = gedit_smart_charset_converter_new (enc);
|
||||
enc = g_slist_prepend (enc, (gpointer)pluma_encoding_get_from_charset (charset));
|
||||
c2 = pluma_smart_charset_converter_new (enc);
|
||||
g_slist_free (enc);
|
||||
|
||||
tmp = in;
|
||||
@@ -280,7 +280,7 @@ test_xxx_xxx ()
|
||||
are done ok */
|
||||
for (l = encs; l != NULL; l = g_slist_next (l))
|
||||
{
|
||||
do_test_roundtrip (TEXT_TO_CONVERT, gedit_encoding_get_charset ((const GeditEncoding *)l->data));
|
||||
do_test_roundtrip (TEXT_TO_CONVERT, pluma_encoding_get_charset ((const PlumaEncoding *)l->data));
|
||||
}
|
||||
|
||||
g_slist_free (encs);
|
||||
@@ -289,7 +289,7 @@ test_xxx_xxx ()
|
||||
static void
|
||||
test_empty ()
|
||||
{
|
||||
const GeditEncoding *guessed;
|
||||
const PlumaEncoding *guessed;
|
||||
gchar *out;
|
||||
GSList *encodings = NULL;
|
||||
|
||||
@@ -297,14 +297,14 @@ test_empty ()
|
||||
utf-8. In this case, the smart converter cannot determine the right
|
||||
encoding (because there is no input), but should still default to
|
||||
utf-8 for the detection */
|
||||
encodings = g_slist_prepend (encodings, (gpointer)gedit_encoding_get_from_charset ("UTF-16"));
|
||||
encodings = g_slist_prepend (encodings, (gpointer)gedit_encoding_get_from_charset ("ISO-8859-15"));
|
||||
encodings = g_slist_prepend (encodings, (gpointer)pluma_encoding_get_from_charset ("UTF-16"));
|
||||
encodings = g_slist_prepend (encodings, (gpointer)pluma_encoding_get_from_charset ("ISO-8859-15"));
|
||||
|
||||
out = do_test ("", NULL, encodings, 0, &guessed);
|
||||
|
||||
g_assert_cmpstr (out, ==, "");
|
||||
|
||||
g_assert (guessed == gedit_encoding_get_utf8 ());
|
||||
g_assert (guessed == pluma_encoding_get_utf8 ());
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -313,29 +313,29 @@ test_guessed ()
|
||||
GSList *encs = NULL;
|
||||
gchar *aux, *aux2, *fail;
|
||||
gsize aux_len, fail_len;
|
||||
const GeditEncoding *guessed;
|
||||
const PlumaEncoding *guessed;
|
||||
|
||||
aux = get_encoded_text (TEXT_TO_GUESS, -1,
|
||||
gedit_encoding_get_from_charset ("UTF-16"),
|
||||
gedit_encoding_get_from_charset ("UTF-8"),
|
||||
pluma_encoding_get_from_charset ("UTF-16"),
|
||||
pluma_encoding_get_from_charset ("UTF-8"),
|
||||
&aux_len,
|
||||
TRUE);
|
||||
|
||||
fail = get_encoded_text (aux, aux_len,
|
||||
gedit_encoding_get_from_charset ("UTF-8"),
|
||||
gedit_encoding_get_from_charset ("ISO-8859-15"),
|
||||
pluma_encoding_get_from_charset ("UTF-8"),
|
||||
pluma_encoding_get_from_charset ("ISO-8859-15"),
|
||||
&fail_len,
|
||||
FALSE);
|
||||
|
||||
g_assert (fail == NULL);
|
||||
|
||||
/* ISO-8859-15 should fail */
|
||||
encs = g_slist_append (encs, (gpointer)gedit_encoding_get_from_charset ("ISO-8859-15"));
|
||||
encs = g_slist_append (encs, (gpointer)gedit_encoding_get_from_charset ("UTF-16"));
|
||||
encs = g_slist_append (encs, (gpointer)pluma_encoding_get_from_charset ("ISO-8859-15"));
|
||||
encs = g_slist_append (encs, (gpointer)pluma_encoding_get_from_charset ("UTF-16"));
|
||||
|
||||
aux2 = do_test (aux, NULL, encs, aux_len, &guessed);
|
||||
|
||||
g_assert (guessed == gedit_encoding_get_from_charset ("UTF-16"));
|
||||
g_assert (guessed == pluma_encoding_get_from_charset ("UTF-16"));
|
||||
}
|
||||
|
||||
int main (int argc,
|
||||
|
Reference in New Issue
Block a user