@@ -120,8 +120,8 @@ measure_time (Func&& func, const string& operation_name) {
120120 auto end= std::chrono::high_resolution_clock::now ();
121121 auto duration=
122122 std::chrono::duration_cast<std::chrono::microseconds> (end - start);
123+ Q_UNUSED (operation_name);
123124
124- qDebug () << as_charp (operation_name) << " : " << duration.count () << " μs" ;
125125 return duration.count ();
126126}
127127
@@ -167,6 +167,7 @@ private slots:
167167 void test_handle_decorations_correctness ();
168168 void test_handle_decorations_performance ();
169169 void test_cell_hyphen_wrapping ();
170+ void test_cell_hyphen_multi_column ();
170171 void cleanupTestCase ();
171172};
172173
@@ -177,7 +178,6 @@ TestTablePerformance::initTestCase () {
177178 cache_initialize ();
178179 init_tex ();
179180 moebius::drd::init_std_drd ();
180- qDebug () << " === Table Performance Test ===" ;
181181}
182182
183183void
@@ -197,7 +197,6 @@ TestTablePerformance::test_1x1_text_table () {
197197 simple_row[0 ] = tree (CELL , " hello" );
198198 simple_table[0 ][0 ]= simple_row;
199199
200- qDebug () << " Testing 1x1 table with text content..." ;
201200 auto simple_time= measure_table_creation_time (env, simple_table,
202201 " 1x1 text table creation" );
203202
@@ -219,7 +218,6 @@ TestTablePerformance::test_1x1_matrix_table () {
219218 simple_row[0 ] = tree (CELL , matrix_cell);
220219 simple_table[0 ][0 ]= simple_row;
221220
222- qDebug () << " Testing 1x1 table with matrix content..." ;
223221 auto matrix_time= measure_table_creation_time (env, simple_table,
224222 " 1x1 matrix table creation" );
225223
@@ -492,9 +490,6 @@ TestTablePerformance::test_handle_decorations_correctness () {
492490 int rows_after= tab->nr_rows ;
493491 int cols_after= tab->nr_cols ;
494492
495- qDebug () << " Table dimensions:" << rows_before << " x" << cols_before << " ->"
496- << rows_after << " x" << cols_after;
497-
498493 // Verify that decorations expanded the table
499494 QVERIFY (rows_after > rows_before);
500495 QVERIFY (cols_after > cols_before);
@@ -510,7 +505,6 @@ TestTablePerformance::test_handle_decorations_correctness () {
510505 }
511506 }
512507 }
513- qDebug () << " Non-nil cells after handle_decorations:" << total_cells;
514508 // At least original size * size cells should be present
515509 QVERIFY (total_cells >= size * size);
516510}
@@ -617,16 +611,6 @@ TestTablePerformance::test_handle_decorations_performance () {
617611 double per_n2d2=
618612 median_us / ((double ) size * (double ) size * (double ) d * (double ) d);
619613
620- qDebug () << as_charp (as_string (size) * " x" * as_string (size) *
621- " handle_decorations median" )
622- << " :" << median_us << " μs"
623- << " (d:" << d << " decorations:" << decorations << " )"
624- << " (us/n^2:" << per_n2 << " us/n^4:" << per_n4
625- << " us/(n^2*d^2):" << per_n2d2 << " )"
626- << " (min:" << min_us << " max:" << max_us << " )"
627- << " (" << rows_before << " x" << cols_before << " ->" << rows_after
628- << " x" << cols_after << " )" ;
629-
630614 QVERIFY (median_us >= 0.0 );
631615 QVERIFY (rows_after > rows_before);
632616 QVERIFY (cols_after > cols_before);
@@ -673,21 +657,78 @@ TestTablePerformance::test_cell_hyphen_wrapping () {
673657 tab_wrap->position_rows ();
674658 tab_wrap->finish ();
675659
676- SI width_no_wrap= tab_no_wrap->T [0 ][0 ]->b ->w ();
677- SI width_wrap = tab_wrap->T [0 ][0 ]->b ->w ();
678-
679- qDebug () << " No wrap width:" << width_no_wrap;
680- qDebug () << " Wrap width:" << width_wrap;
660+ SI width_no_wrap = tab_no_wrap->T [0 ][0 ]->b ->w ();
661+ SI width_wrap = tab_wrap->T [0 ][0 ]->b ->w ();
662+ SI height_no_wrap = tab_no_wrap->T [0 ][0 ]->b ->h ();
663+ SI height_wrap = tab_wrap->T [0 ][0 ]->b ->h ();
664+ SI inner_width_no_wrap = tab_no_wrap->T [0 ][0 ]->b [0 ]->w ();
665+ SI inner_width_wrap = tab_wrap->T [0 ][0 ]->b [0 ]->w ();
666+ SI inner_height_no_wrap= tab_no_wrap->T [0 ][0 ]->b [0 ]->h ();
667+ SI inner_height_wrap = tab_wrap->T [0 ][0 ]->b [0 ]->h ();
681668
682669 // When cell-hyphen is enabled, the cell should wrap and be narrower
683670 // than the non-wrapping case
684671 QVERIFY (width_wrap < width_no_wrap);
685672}
686673
687674void
688- TestTablePerformance::cleanupTestCase () {
689- qDebug () << " \n === Performance Test Complete ===" ;
675+ TestTablePerformance::test_cell_hyphen_multi_column () {
676+ cache_refresh ();
677+ edit_env env= create_test_env ();
678+
679+ // Use actual text pattern from 0117.tmu
680+ string long_text = " sdasd dasd sdsdasd dasd sdsdasd dasd sdsdasd dasd sd"
681+ " sdasd dasd sdsdasd dasd sdsdasd dasd sdsdasd dasd sd"
682+ " sdasd dasd sdsdasd dasd sdsdasd dasd sdsdasd dasd sd" ;
683+ string short_text= " sdasd dasd sd" ;
684+
685+ // Create 2x5 table with cell-hyphen enabled for all cells
686+ // Matching the 0117.tmu test case layout
687+ tree table_wrap (TFORMAT );
688+ table_wrap << tree (CWITH , " 1" , " -1" , " 1" , " -1" , " cell-hyphen" , " t" );
689+ table_wrap << tree (TABLE , 2 );
690+
691+ // Row 0: 3 long text cols + 1 short + 1 empty
692+ tree row0 (ROW , 5 );
693+ row0[0 ] = tree (CELL , tree (DOCUMENT , long_text));
694+ row0[1 ] = tree (CELL , tree (DOCUMENT , long_text));
695+ row0[2 ] = tree (CELL , tree (DOCUMENT , long_text));
696+ row0[3 ] = tree (CELL , tree (DOCUMENT , short_text));
697+ row0[4 ] = tree (CELL , tree (DOCUMENT , " " ));
698+ table_wrap[1 ][0 ]= row0;
699+
700+ // Row 1: 4 empty + 1 long text
701+ tree row1 (ROW , 5 );
702+ row1[0 ] = tree (CELL , tree (DOCUMENT , " " ));
703+ row1[1 ] = tree (CELL , tree (DOCUMENT , " " ));
704+ row1[2 ] = tree (CELL , tree (DOCUMENT , " " ));
705+ row1[3 ] = tree (CELL , tree (DOCUMENT , " " ));
706+ row1[4 ] = tree (CELL , tree (DOCUMENT , long_text));
707+ table_wrap[1 ][1 ]= row1;
708+
709+ // Typeset table
710+ table tab_wrap (env);
711+ tab_wrap->typeset (table_wrap, path ());
712+ tab_wrap->position_columns (true );
713+
714+ SI pw, d1, d2, d3, d4, d5, d6, d7;
715+ tab_wrap->env ->get_page_pars (pw, d1, d2, d3, d4, d5, d6, d7);
716+ tab_wrap->finish_horizontal ();
717+ tab_wrap->position_rows ();
718+ tab_wrap->finish ();
719+
720+ // Check each cell's box width vs column width
721+ for (int i= 0 ; i < 2 ; i++)
722+ for (int j= 0 ; j < 5 ; j++) {
723+ SI box_w= tab_wrap->T [i][j]->b ->w ();
724+ SI col_w= tab_wrap->mw [j];
725+ Q_UNUSED (box_w);
726+ Q_UNUSED (col_w);
727+ }
690728}
691729
730+ void
731+ TestTablePerformance::cleanupTestCase () {}
732+
692733QTEST_MAIN (TestTablePerformance)
693734#include " table_performance_test.moc"
0 commit comments