~ubuntu-branches/ubuntu/raring/gedit/raring

« back to all changes in this revision

Viewing changes to tests/document-saver.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2010-04-29 10:16:12 UTC
  • mfrom: (1.1.79 upstream)
  • Revision ID: james.westby@ubuntu.com-20100429101612-cawm9u2kja132bpc
Tags: 2.30.2-0ubuntu1
* New upstream release:
  - Fix cut and paste typo that broke syntax detection

Show diffs side-by-side

added added

removed removed

Lines of Context:
357
357
                    saver_test_data_new (DEFAULT_REMOTE_URI, "hello world\n\n", NULL));
358
358
}
359
359
 
 
360
#ifndef G_OS_WIN32
360
361
static void
361
362
check_permissions (GFile *file,
362
363
                   guint  permissions)
452
453
        test_permissions (DEFAULT_LOCAL_URI, 0666);
453
454
        test_permissions (DEFAULT_LOCAL_URI, 0760);
454
455
}
 
456
#endif
455
457
 
456
458
static void
457
459
test_local_unowned_directory ()
467
469
}
468
470
 
469
471
static void
 
472
test_remote_unowned_directory ()
 
473
{
 
474
        test_saver (UNOWNED_REMOTE_URI,
 
475
                    DEFAULT_CONTENT,
 
476
                    GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
 
477
                    0,
 
478
                    NULL,
 
479
                    saver_test_data_new (UNOWNED_REMOTE_URI,
 
480
                                         DEFAULT_CONTENT_RESULT,
 
481
                                         NULL));
 
482
}
 
483
 
 
484
#ifndef G_OS_WIN32
 
485
static void
470
486
test_remote_permissions ()
471
487
{
472
488
        test_permissions (DEFAULT_REMOTE_URI, 0600);
476
492
}
477
493
 
478
494
static void
479
 
test_remote_unowned_directory ()
480
 
{
481
 
        test_saver (UNOWNED_REMOTE_URI,
482
 
                    DEFAULT_CONTENT,
483
 
                    GEDIT_DOCUMENT_NEWLINE_TYPE_LF,
484
 
                    0,
485
 
                    NULL,
486
 
                    saver_test_data_new (UNOWNED_REMOTE_URI,
487
 
                                         DEFAULT_CONTENT_RESULT,
488
 
                                         NULL));
489
 
}
490
 
 
491
 
static void
492
495
test_unowned_group_permissions (GeditDocument *document,
493
496
                                GError        *error,
494
497
                                SaverTestData *data)
543
546
        test_unowned_group (UNOWNED_GROUP_REMOTE_URI);
544
547
}
545
548
 
 
549
#endif
 
550
 
546
551
static gboolean
547
552
check_unowned_directory ()
548
553
{
658
663
                return FALSE;
659
664
        }
660
665
 
 
666
#ifndef G_OS_WIN32
661
667
        if ((g_file_info_get_attribute_uint32 (info, G_FILE_ATTRIBUTE_UNIX_MODE) & ACCESSPERMS) != 0660)
662
668
        {
663
669
                g_object_unref (unowned);
666
672
                g_object_unref (info);
667
673
                return FALSE;
668
674
        }
 
675
#endif
669
676
 
670
677
        g_object_unref (info);
671
678
        g_object_unref (unowned);
692
699
 
693
700
        g_test_add_func ("/document-saver/local", test_local);
694
701
        g_test_add_func ("/document-saver/local-new-line", test_local_newline);
695
 
        g_test_add_func ("/document-saver/local-permissions", test_local_permissions);
696
702
 
697
703
        if (have_unowned)
698
704
        {
699
705
                g_test_add_func ("/document-saver/local-unowned-directory", test_local_unowned_directory);
700
706
        }
701
707
 
702
 
        if (have_unowned_group)
703
 
        {
704
 
                g_test_add_func ("/document-saver/local-unowned-group", test_local_unowned_group);
705
 
        }
706
 
 
707
708
        g_test_add_func ("/document-saver/remote", test_remote);
708
709
        g_test_add_func ("/document-saver/remote-new-line", test_remote_newline);
709
 
        g_test_add_func ("/document-saver/remote-permissions", test_remote_permissions);
 
710
        
710
711
 
711
712
        if (have_unowned)
712
713
        {
719
720
                /* g_test_add_func ("/document-saver/remote-unowned-group", test_remote_unowned_group); */
720
721
        }
721
722
 
 
723
#ifndef G_OS_WIN32
 
724
        g_test_add_func ("/document-saver/local-permissions", test_local_permissions);
 
725
 
 
726
        if (have_unowned_group)
 
727
        {
 
728
                g_test_add_func ("/document-saver/local-unowned-group", test_local_unowned_group);
 
729
        }
 
730
 
 
731
        g_test_add_func ("/document-saver/remote-permissions", test_remote_permissions);
 
732
#endif
 
733
 
722
734
        return g_test_run ();
723
735
}