// Copyright 2012 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/base/models/tree_node_model.h" #include <memory> #include <string> #include "base/compiler_specific.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" ASCIIToUTF16; namespace ui { class TreeNodeModelTest : public testing::Test, public TreeModelObserver { … }; TestNode; // Verifies if the model is properly adding a new node in the tree and // notifying the observers. // The tree looks like this: // root // +-- child1 // +-- foo1 // +-- foo2 // +-- child2 TEST_F(TreeNodeModelTest, AddNode) { … } // Verifies if the model is properly removing a node from the tree // and notifying the observers. TEST_F(TreeNodeModelTest, RemoveNode) { … } // Verifies if the nodes added under the root are all deleted when calling // DeleteAll. // The tree looks like this: // root // +-- child1 // +-- foo // +-- bar0 // +-- bar1 // +-- bar2 // +-- child2 // +-- child3 TEST_F(TreeNodeModelTest, DeleteAllNodes) { … } // Verifies if GetIndexOf() returns the correct index for the specified node. // The tree looks like this: // root // +-- child1 // +-- foo1 // +-- child2 TEST_F(TreeNodeModelTest, GetIndexOf) { … } // Verifies whether a specified node has or not an ancestor. // The tree looks like this: // root // +-- child1 // +-- foo1 // +-- child2 TEST_F(TreeNodeModelTest, HasAncestor) { … } // Verifies if GetTotalNodeCount returns the correct number of nodes from the // node specified. The count should include the node itself. // The tree looks like this: // root // +-- child1 // +-- child2 // +-- child3 // +-- foo1 // +-- foo2 // +-- foo3 // +-- foo4 // +-- bar1 // // The TotalNodeCount of root is: 9 // The TotalNodeCount of child1 is: 3 // The TotalNodeCount of child2 and foo2 is: 2 // The TotalNodeCount of bar1 is: 1 // And so on... TEST_F(TreeNodeModelTest, GetTotalNodeCount) { … } // Makes sure that we are notified when the node is renamed, // also makes sure the node is properly renamed. TEST_F(TreeNodeModelTest, SetTitle) { … } TEST_F(TreeNodeModelTest, BasicOperations) { … } TEST_F(TreeNodeModelTest, IsRoot) { … } TEST_F(TreeNodeModelTest, ReorderChildren) { … } TEST_F(TreeNodeModelTest, SortChildren) { … } } // namespace ui