~ubuntu-branches/ubuntu/maverick/glib2.0/maverick

« back to all changes in this revision

Viewing changes to gio/tests/memory-output-stream.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-08-09 11:51:31 UTC
  • mfrom: (1.51.1 upstream) (3.4.23 experimental)
  • Revision ID: james.westby@ubuntu.com-20100809115131-pbojavp0jx7vtcah
Tags: 2.25.13-1ubuntu1
* Merge with Debian unstable, remaining Ubuntu changes:
* debian/control.in:
  - Add Vcs-Bzr link
  - Recommend libdconf0
  - Don't use "linux-any" for now since soyuz doesn't handle it
  - Suggest python-subunit for dev package
* debian/libglib2.0-0.symbols:
  - Updated the symbols list for the gio launcher handler
* debian/rules:
  - Stop installing the sizable upstream changelog.
* debian/patches/01_gettext-desktopfiles.patch:
  - Updated to use gettext for X-GNOME-Fullname too
* debian/patches/05_file_size_units.patch:
  - Use base 10 units in g_format_size_for_display() (disabled)
* debian/patches/61_glib-compile-schemas-path.patch:
  - Don't use that change since there is a depends which assures to the 
    upstream binary location to be there
* debian/patches/71_gio_launch_handler.patch:
  - New GIO default launch handle feature required for wncksync
* debian/watch:
  - Watch for unstable versions

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
  g_test_bug ("540423");
36
36
 
37
37
  mo = g_memory_output_stream_new (NULL, 0, g_realloc, g_free);
 
38
  g_assert (g_seekable_can_truncate (G_SEEKABLE (mo)));
38
39
  o = g_data_output_stream_new (mo);
39
40
  for (i = 0; i < 1000; i++)
40
41
    {
54
55
}
55
56
 
56
57
static void
 
58
test_seek (void)
 
59
{
 
60
  GOutputStream *mo;
 
61
  GError *error;
 
62
 
 
63
  mo = g_memory_output_stream_new (g_new (gchar, 100), 100, g_realloc, g_free);
 
64
 
 
65
  g_assert (G_IS_SEEKABLE (mo));
 
66
  g_assert (g_seekable_can_seek (G_SEEKABLE (mo)));
 
67
 
 
68
  error = NULL;
 
69
  g_assert (g_seekable_seek (G_SEEKABLE (mo), 26, G_SEEK_SET, NULL, &error));
 
70
  g_assert_no_error (error);
 
71
  g_assert_cmpint (g_seekable_tell (G_SEEKABLE (mo)), ==, 26);
 
72
 
 
73
  g_assert (!g_seekable_seek (G_SEEKABLE (mo), 200, G_SEEK_CUR, NULL, &error));
 
74
  g_assert_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT);
 
75
  g_error_free (error);
 
76
 
 
77
  g_object_unref (mo);
 
78
}
 
79
 
 
80
static void
57
81
test_data_size (void)
58
82
{
59
83
  GOutputStream *mo;
80
104
  
81
105
  pos = g_memory_output_stream_get_data_size (G_MEMORY_OUTPUT_STREAM (mo));
82
106
  g_assert_cmpint (pos, ==, 1);
83
 
  
 
107
 
 
108
  g_assert_cmpint (g_memory_output_stream_get_size (G_MEMORY_OUTPUT_STREAM (mo)), ==, 16);
 
109
 
84
110
  g_object_unref (o);
85
111
  g_object_unref (mo);
86
112
}
130
156
  g_test_bug_base ("http://bugzilla.gnome.org/");
131
157
 
132
158
  g_test_add_func ("/memory-output-stream/truncate", test_truncate);
 
159
  g_test_add_func ("/memory-output-stream/seek", test_seek);
133
160
  g_test_add_func ("/memory-output-stream/get-data-size", test_data_size);
134
161
  g_test_add_func ("/memory-output-stream/properties", test_properties);
135
162