#!/usr/bin/python import pcop import dcop import sys import time # this is a series of tests for row operations on # kword tables. Undo and redo of the operation is # also tested. # deletes and undos each row of table def row_test_1(view, doc, table): rows = table.nbRows() for i in range(0, rows): view.tableSelectCell(table.name, 0, 0) view.tableDeleteRow(i) sleep() doc.action('koffice_undo').activate() sleep() # inserts and undoes a row at each position def row_test_2(view, doc, table): rows = table.nbRows() for i in range(0, rows+1): view.tableSelectCell(table.name, 0, 0) view.tableInsertRow(i) sleep() doc.action('koffice_undo').activate() sleep() # inserts , undo's, redos and undoes again a row at each position def row_test_3(view, doc, table): rows = table.nbRows() for i in range(0, rows+1): view.tableSelectCell(table.name, 0, 0) view.tableInsertRow(i) sleep() doc.action('koffice_undo').activate() sleep() doc.action('koffice_redo').activate() sleep() doc.action('koffice_undo').activate() sleep() def sleep(): time.sleep(0.5) app = dcop.anyAppCalled( "kword" ) views = app.default.getViews() docs = app.default.getDocuments() view = views[0] doc = docs[0] table = doc.frameSet (doc.numFrameSets() - 1) if table.name.find("Table") < 0: print "No Table in document" sys.exit(1) row_test_1(view, doc, table) row_test_2(view, doc, table) row_test_3(view, doc, table)