]> Pileus Git - ~andy/gtk/blobdiff - gtk/tests/sortmodel.c
filechooserbutton: When the combo box changes, set the *file*, not the current folder
[~andy/gtk] / gtk / tests / sortmodel.c
index cec46b5020785874aded12f62ed1b1a7454c7469..147db53aeb8384aa2ae1f6ce35dc663780dfffc3 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <gtk/gtk.h>
@@ -292,6 +290,7 @@ ref_count_delete_row (void)
 
   path = gtk_tree_path_new_from_indices (1, -1);
   gtk_tree_view_expand_row (GTK_TREE_VIEW (tree_view), path, TRUE);
+  gtk_tree_path_free (path);
 
   assert_node_ref_count (ref_model, &grandparent1, 1);
   assert_node_ref_count (ref_model, &grandparent2, 2);
@@ -1071,6 +1070,8 @@ specific_bug_300089 (void)
   /* change the "E" row in a way that causes it to change position */ 
   gtk_tree_model_get_iter (child_model, &iter, path);
   gtk_tree_store_set (GTK_TREE_STORE (child_model), &iter, 0, "A", -1);
+
+  gtk_tree_path_free (path);
 }
 
 static void
@@ -1112,6 +1113,64 @@ specific_bug_364946 (void)
   gtk_tree_model_sort_clear_cache (GTK_TREE_MODEL_SORT (s_model));
 }
 
+static void
+iter_test (GtkTreeModel *model)
+{
+  GtkTreeIter a, b;
+
+  g_assert (gtk_tree_model_get_iter_first (model, &a));
+
+  g_assert (gtk_tree_model_iter_next (model, &a));
+  g_assert (gtk_tree_model_iter_next (model, &a));
+  b = a;
+  g_assert (!gtk_tree_model_iter_next (model, &b));
+
+  g_assert (gtk_tree_model_iter_previous (model, &a));
+  g_assert (gtk_tree_model_iter_previous (model, &a));
+  b = a;
+  g_assert (!gtk_tree_model_iter_previous (model, &b));
+}
+
+static void
+specific_bug_674587 (void)
+{
+  GtkListStore *l;
+  GtkTreeStore *t;
+  GtkTreeModel *m;
+  GtkTreeIter a;
+
+  l = gtk_list_store_new (1, G_TYPE_STRING);
+
+  gtk_list_store_append (l, &a);
+  gtk_list_store_set (l, &a, 0, "0", -1);
+  gtk_list_store_append (l, &a);
+  gtk_list_store_set (l, &a, 0, "1", -1);
+  gtk_list_store_append (l, &a);
+  gtk_list_store_set (l, &a, 0, "2", -1);
+
+  iter_test (GTK_TREE_MODEL (l));
+
+  g_object_unref (l);
+
+  t = gtk_tree_store_new (1, G_TYPE_STRING);
+
+  gtk_tree_store_append (t, &a, NULL);
+  gtk_tree_store_set (t, &a, 0, "0", -1);
+  gtk_tree_store_append (t, &a, NULL);
+  gtk_tree_store_set (t, &a, 0, "1", -1);
+  gtk_tree_store_append (t, &a, NULL);
+  gtk_tree_store_set (t, &a, 0, "2", -1);
+
+  iter_test (GTK_TREE_MODEL (t));
+
+  m = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (t));
+
+  iter_test (m);
+
+  g_object_unref (t);
+  g_object_unref (m);
+}
+
 /* main */
 
 void
@@ -1145,4 +1204,7 @@ register_sort_model_tests (void)
                    specific_bug_300089);
   g_test_add_func ("/TreeModelSort/specific/bug-364946",
                    specific_bug_364946);
+  g_test_add_func ("/TreeModelSort/specific/bug-674587",
+                   specific_bug_674587);
 }
+