|
8 | 8 | def test_create_guide_file(gdf: GeoDataFarm): |
9 | 9 | clean_up() |
10 | 10 | gdf.create_guide() |
| 11 | + # Select the field first so the attribute list is filtered to tables linked |
| 12 | + # to this field. Without filtering, stale tables left in the shared |
| 13 | + # database from earlier runs may land at row 0 with no numeric columns, |
| 14 | + # making cellWidget(0, 1) return None. |
| 15 | + idx = gdf.guide.CGF.CBFields.findText('test_field') |
| 16 | + gdf.guide.CGF.CBFields.setCurrentIndex(idx) |
11 | 17 | gdf.guide.possible_attr('plant') |
| 18 | + # TWColumnNames row 0, column 1 is the QComboBox listing numeric attributes |
| 19 | + # of the first available plant table. setCurrentIndex(2) picks the third |
| 20 | + # attribute alphabetically (index 2) before it is added to the selected list. |
12 | 21 | widget = gdf.guide.CGF.TWColumnNames.cellWidget(0, 1) |
13 | 22 | widget.setCurrentIndex(2) |
14 | | - gdf.guide.add_to_param_list(2, 0) |
15 | | - gdf.guide.add_to_param_list(3, 0) |
| 23 | + gdf.guide.add_to_param_list(2, 0) # add attribute at combo-index 2, table row 0 |
| 24 | + gdf.guide.add_to_param_list(3, 0) # add attribute at combo-index 3, table row 0 |
16 | 25 | gdf.guide.CGF.TWSelected.selectRow(1) |
17 | 26 | gdf.guide.remove_from_param_list() |
18 | | - idx = gdf.guide.CGF.CBFields.findText('test_field') |
19 | | - gdf.guide.CGF.CBFields.setCurrentIndex(idx) |
20 | 27 | gdf.guide.update_max_min() |
21 | 28 | gdf.guide.set_output_path() |
22 | 29 | gdf.guide.create_file() |
|
0 commit comments