#!/usr/bin/python import pcop import dcop import sys import time # this is a series of tests for column operations on # kword tables. Undo and redo of the operation is # also tested. # deletes and undos each col of table def col_test_1(view, doc, table): cols = table.numCols() for i in range(0, cols): view.tableSelectCell(table.name, 0, 0) view.tableDeleteCol(i) sleep() doc.action('koffice_undo').activate() sleep() # inserts and undoes a row at each position def col_test_2(view, doc, table): cols = table.numCols() for i in range(0, cols+1): view.tableSelectCell(table.name, 0, 0) view.tableInsertCol(i) sleep() doc.action('koffice_undo').activate() sleep() # inserts , undo's, redos and undoes again a row at each position def col_test_3(view, doc, table): cols = table.numCols() for i in range(0, cols+1): view.tableSelectCell(table.name, 0, 0) view.tableInsertCol(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.6) 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) col_test_1(view, doc, table) col_test_2(view, doc, table) col_test_3(view, doc, table)