~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to krita/ui/tests/kis_node_model_test.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-21 15:36:35 UTC
  • mfrom: (1.4.1 upstream) (60.2.11 maverick)
  • Revision ID: james.westby@ubuntu.com-20100921153635-6tejqkiro2u21ydi
Tags: 1:2.2.2-0ubuntu3
Add kubuntu_03_fix-crash-on-closing-sqlite-connection-2.2.2.diff and
kubuntu_04_support-large-memo-values-for-msaccess-2.2.2.diff as
recommended by upstream http://kexi-
project.org/wiki/wikiview/index.php@Kexi2.2_Patches.html#sqlite_stab
ility

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
*/
55
55
void kisnodemodel_test::testRowcount()
56
56
{
57
 
    KisImageWSP img = new KisImage(0, 100, 100,  KoColorSpaceRegistry::instance()->rgb8(), "testimage");
 
57
    KisImageWSP image = new KisImage(0, 100, 100,  KoColorSpaceRegistry::instance()->rgb8(), "testimage");
58
58
 
59
59
    KisNodeModel model(0);
60
60
    ModelTest(&model, this);
61
 
    model.setImage(img);
 
61
    model.setImage(image);
62
62
 
63
 
    KisLayerSP l1 = new KisPaintLayer(img, "first", 200, img->colorSpace());
64
 
    img->addNode(l1.data(), img->root());
 
63
    KisLayerSP l1 = new KisPaintLayer(image, "first", 200, image->colorSpace());
 
64
    image->addNode(l1.data(), image->root());
65
65
    QCOMPARE(model.rowCount(), 1);
66
66
 
67
 
    KisLayerSP l2 = new KisPaintLayer(img, "second", 200, img->colorSpace());
68
 
    img->addNode(l2.data(), img->root());
 
67
    KisLayerSP l2 = new KisPaintLayer(image, "second", 200, image->colorSpace());
 
68
    image->addNode(l2.data(), image->root());
69
69
    QVERIFY(model.rowCount() == 2);
70
70
 
71
 
    KisGroupLayerSP parent = new KisGroupLayer(img, "group 1", 200);
72
 
    img->addNode(parent, img->rootLayer());
 
71
    KisGroupLayerSP parent = new KisGroupLayer(image, "group 1", 200);
 
72
    image->addNode(parent, image->rootLayer());
73
73
 
74
74
    QVERIFY(model.rowCount() == 3);
75
75
 
76
 
    KisPaintLayerSP child = new KisPaintLayer(img, "child", 200);
77
 
    img->addNode(child, parent);
 
76
    KisPaintLayerSP child = new KisPaintLayer(image, "child", 200);
 
77
    image->addNode(child, parent);
78
78
 
79
79
    QVERIFY(model.rowCount() == 3);
80
80
 
102
102
*/
103
103
void kisnodemodel_test::testModelIndex()
104
104
{
105
 
    KisImageWSP img = new KisImage(0, 100, 100,  KoColorSpaceRegistry::instance()->rgb8(), "testimage");
 
105
    KisImageWSP image = new KisImage(0, 100, 100,  KoColorSpaceRegistry::instance()->rgb8(), "testimage");
106
106
 
107
107
    KisNodeModel model(0);
108
108
    ModelTest(&model, this);
109
 
    model.setImage(img);
 
109
    model.setImage(image);
110
110
 
111
 
    KisLayerSP first = new KisPaintLayer(img, "first", 200, img->colorSpace());
112
 
    img->addNode(first.data());
 
111
    KisLayerSP first = new KisPaintLayer(image, "first", 200, image->colorSpace());
 
112
    image->addNode(first.data());
113
113
    QModelIndex idx = model.index(0, 0);
114
114
 
115
115
    QVERIFY(idx.isValid());
117
117
    QVERIFY(idx.internalPointer() == first.data());
118
118
    QVERIFY(model.hasChildren(idx) == false);
119
119
 
120
 
    KisLayerSP second = new KisPaintLayer(img, "second", 200, img->colorSpace());
121
 
    img->addNode(second.data());
 
120
    KisLayerSP second = new KisPaintLayer(image, "second", 200, image->colorSpace());
 
121
    image->addNode(second.data());
122
122
    QModelIndex idx2 = model.index(0, 0);
123
123
    QVERIFY(idx2 != idx);
124
124
    idx = model.index(1, 0);
146
146
            second 0
147
147
            first  1
148
148
     */
149
 
    KisGroupLayerSP parent = new KisGroupLayer(img, "group 1", 200);
150
 
    img->addNode(parent, img->rootLayer());
 
149
    KisGroupLayerSP parent = new KisGroupLayer(image, "group 1", 200);
 
150
    image->addNode(parent, image->rootLayer());
151
151
 
152
 
    KisPaintLayerSP child = new KisPaintLayer(img, "child", 200);
153
 
    img->addNode(child, parent);
 
152
    KisPaintLayerSP child = new KisPaintLayer(image, "child", 200);
 
153
    image->addNode(child, parent);
154
154
 
155
155
    QModelIndex parentIdx = model.index(0, 0);
156
156
 
180
180
 
181
181
void kisnodemodel_test::testGroupLayers()
182
182
{
183
 
    KisImageWSP img = new KisImage(0, 100, 100,  KoColorSpaceRegistry::instance()->rgb8(), "testimage");
 
183
    KisImageWSP image = new KisImage(0, 100, 100,  KoColorSpaceRegistry::instance()->rgb8(), "testimage");
184
184
 
185
185
    KisNodeModel model(0);
186
186
    ModelTest(&model, this);
187
187
 
188
 
    model.setImage(img);
189
 
 
190
 
    KisLayerSP first = new KisPaintLayer(img, "first", 200, img->colorSpace());
191
 
    KisLayerSP second = new KisPaintLayer(img, "second", 200, img->colorSpace());
192
 
 
193
 
    KisGroupLayerSP parent = new KisGroupLayer(img, "group 1", 200);
194
 
    img->addNode(parent, img->rootLayer());
195
 
 
196
 
    KisPaintLayerSP child = new KisPaintLayer(img, "child", 200);
197
 
    img->addNode(child, parent);
 
188
    model.setImage(image);
 
189
 
 
190
    KisLayerSP first = new KisPaintLayer(image, "first", 200, image->colorSpace());
 
191
    KisLayerSP second = new KisPaintLayer(image, "second", 200, image->colorSpace());
 
192
 
 
193
    KisGroupLayerSP parent = new KisGroupLayer(image, "group 1", 200);
 
194
    image->addNode(parent, image->rootLayer());
 
195
 
 
196
    KisPaintLayerSP child = new KisPaintLayer(image, "child", 200);
 
197
    image->addNode(child, parent);
198
198
 
199
199
    QModelIndex parentIdx = model.index(0, 0);
200
200
    QVERIFY(model.hasChildren(parentIdx));