Skip to content

Commit 70053e8

Browse files
committed
Fix tests
1 parent 8dd9507 commit 70053e8

File tree

11 files changed

+405
-589
lines changed

11 files changed

+405
-589
lines changed

docs/tutorials/DataTree Tutorial.md

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ DataTree appSettings("AppSettings");
2626

2727
// Use transactions to modify the tree
2828
{
29-
auto transaction = appSettings.beginTransaction("Set initial values");
29+
auto transaction = appSettings.beginTransaction();
3030
transaction.setProperty("version", "1.0.0");
3131
transaction.setProperty("debug", true);
3232
transaction.setProperty("maxConnections", 100);
@@ -51,7 +51,7 @@ DataTree uiConfig("UIConfig");
5151
5252
// Add children using transactions
5353
{
54-
auto transaction = appSettings.beginTransaction("Add configuration sections");
54+
auto transaction = appSettings.beginTransaction();
5555
transaction.addChild(serverConfig);
5656
transaction.addChild(uiConfig);
5757
}
@@ -60,7 +60,7 @@ DataTree uiConfig("UIConfig");
6060
DataTree foundServer = appSettings.getChildWithName("ServerConfig");
6161
if (foundServer.isValid())
6262
{
63-
auto serverTx = foundServer.beginTransaction("Configure server");
63+
auto serverTx = foundServer.beginTransaction();
6464
serverTx.setProperty("port", 8080);
6565
serverTx.setProperty("hostname", "localhost");
6666
}
@@ -101,14 +101,14 @@ DataTree settings("Settings");
101101

102102
// Basic transaction
103103
{
104-
auto tx = settings.beginTransaction("Update theme");
104+
auto tx = settings.beginTransaction();
105105
tx.setProperty("theme", "dark");
106106
tx.setProperty("fontSize", 14);
107107
// Auto-commits on scope exit
108108
}
109109

110110
// Explicit commit/abort
111-
auto tx = settings.beginTransaction("Conditional update");
111+
auto tx = settings.beginTransaction();
112112
tx.setProperty("experimental", true);
113113

114114
if (someCondition)
@@ -117,13 +117,14 @@ else
117117
tx.abort(); // Discard changes
118118

119119
// Transaction with undo support
120-
UndoManager undoManager;
120+
UndoManager::Ptr undoManager = new UndoManager;
121+
undoManager->beginNewTransaction("Change Language");
121122
{
122-
auto tx = settings.beginTransaction("Undoable changes", &undoManager);
123+
auto tx = settings.beginTransaction(undoManager);
123124
tx.setProperty("language", "en");
124125
tx.setProperty("region", "US");
125126
}
126-
// Later: undoManager.undo();
127+
// Later: undoManager->undo();
127128
```
128129
129130
### Child Management
@@ -134,7 +135,7 @@ DataTree child1("Child");
134135
DataTree child2("Child");
135136
136137
{
137-
auto tx = parent.beginTransaction("Manage children");
138+
auto tx = parent.beginTransaction();
138139
139140
// Add children
140141
tx.addChild(child1, 0); // Insert at index 0
@@ -168,12 +169,12 @@ Before diving into query examples, let's establish a realistic DataTree structur
168169
// Sample DataTree structure for examples
169170
DataTree appRoot("Application");
170171
{
171-
auto tx = appRoot.beginTransaction("Create sample structure");
172+
auto tx = appRoot.beginTransaction();
172173

173174
// Add buttons
174175
DataTree saveButton("Button");
175176
{
176-
auto saveTx = saveButton.beginTransaction("Setup save button");
177+
auto saveTx = saveButton.beginTransaction();
177178
saveTx.setProperty("text", "Save");
178179
saveTx.setProperty("enabled", true);
179180
saveTx.setProperty("x", 10);
@@ -182,7 +183,7 @@ DataTree appRoot("Application");
182183

183184
DataTree loadButton("Button");
184185
{
185-
auto loadTx = loadButton.beginTransaction("Setup load button");
186+
auto loadTx = loadButton.beginTransaction();
186187
loadTx.setProperty("text", "Load");
187188
loadTx.setProperty("enabled", false);
188189
loadTx.setProperty("x", 10);
@@ -192,7 +193,7 @@ DataTree appRoot("Application");
192193
// Add panels
193194
DataTree leftPanel("Panel");
194195
{
195-
auto leftTx = leftPanel.beginTransaction("Setup left panel");
196+
auto leftTx = leftPanel.beginTransaction();
196197
leftTx.setProperty("name", "LeftPanel");
197198
leftTx.setProperty("width", 200);
198199
leftTx.setProperty("docked", true);
@@ -202,7 +203,7 @@ DataTree appRoot("Application");
202203

203204
DataTree rightPanel("Panel");
204205
{
205-
auto rightTx = rightPanel.beginTransaction("Setup right panel");
206+
auto rightTx = rightPanel.beginTransaction();
206207
rightTx.setProperty("name", "RightPanel");
207208
rightTx.setProperty("width", 150);
208209
rightTx.setProperty("docked", false);
@@ -211,7 +212,7 @@ DataTree appRoot("Application");
211212
// Add main window
212213
DataTree mainWindow("Window");
213214
{
214-
auto windowTx = mainWindow.beginTransaction("Setup window");
215+
auto windowTx = mainWindow.beginTransaction();
215216
windowTx.setProperty("title", "My Application");
216217
windowTx.setProperty("width", 800);
217218
windowTx.setProperty("height", 600);
@@ -225,7 +226,7 @@ DataTree appRoot("Application");
225226
// Add settings dialog
226227
DataTree settingsDialog("Dialog");
227228
{
228-
auto dialogTx = settingsDialog.beginTransaction("Setup dialog");
229+
auto dialogTx = settingsDialog.beginTransaction();
229230
dialogTx.setProperty("title", "Settings");
230231
dialogTx.setProperty("modal", true);
231232
dialogTx.setProperty("visible", false);
@@ -843,7 +844,7 @@ DBG("Allowed child types: " << childConstraints.allowedTypes.size());
843844
```cpp
844845
// Schema-validated transactions prevent invalid data
845846
auto settings = schema->createNode("AppSettings");
846-
auto transaction = settings.beginTransaction(schema, "Update settings");
847+
auto transaction = settings.beginTransaction(schema);
847848
848849
// Valid operations
849850
auto result1 = transaction.setProperty("theme", "dark"); // Valid enum
@@ -941,7 +942,7 @@ AppComponent component(settingsTree);
941942

942943
// External change to DataTree
943944
{
944-
auto tx = settingsTree.beginTransaction("External update");
945+
auto tx = settingsTree.beginTransaction();
945946
tx.setProperty("theme", "dark");
946947
}
947948

@@ -1094,11 +1095,11 @@ UIComponentList components(uiRoot);
10941095
10951096
// Add components via DataTree
10961097
{
1097-
auto tx = uiRoot.beginTransaction("Add UI components");
1098+
auto tx = uiRoot.beginTransaction();
10981099
10991100
DataTree button("UIComponent");
11001101
{
1101-
auto buttonTx = button.beginTransaction("Setup button");
1102+
auto buttonTx = button.beginTransaction();
11021103
buttonTx.setProperty("name", "SubmitButton");
11031104
buttonTx.setProperty("x", 100.0f);
11041105
buttonTx.setProperty("y", 50.0f);
@@ -1114,15 +1115,15 @@ EXPECT_EQ("SubmitButton", buttonObj->getName());
11141115
11151116
// Modify object through DataTree - object reflects changes automatically
11161117
{
1117-
auto tx = uiRoot.getChild(0).beginTransaction("Move button");
1118+
auto tx = uiRoot.getChild(0).beginTransaction();
11181119
tx.setProperty("x", 200.0f);
11191120
}
11201121
11211122
EXPECT_EQ(200.0f, buttonObj->getX()); // CachedValue reflects change
11221123
11231124
// Remove component via DataTree
11241125
{
1125-
auto tx = uiRoot.beginTransaction("Remove button");
1126+
auto tx = uiRoot.beginTransaction();
11261127
tx.removeChild(0);
11271128
}
11281129

modules/yup_data_model/tree/yup_AtomicCachedValue.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ class YUP_API AtomicCachedValue : private DataTree::Listener
140140
try
141141
{
142142
var varValue = VariantConverter<T>::toVar (newValue);
143-
auto transaction = dataTree.beginTransaction ("AtomicCachedValue Set");
143+
144+
auto transaction = dataTree.beginTransaction();
144145
transaction.setProperty (propertyName, varValue);
145146
}
146147
catch (...)

modules/yup_data_model/tree/yup_CachedValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class YUP_API CachedValue : private DataTree::Listener
140140
try
141141
{
142142
var varValue = VariantConverter<T>::toVar (newValue);
143-
auto transaction = dataTree.beginTransaction ("CachedValue Set");
143+
auto transaction = dataTree.beginTransaction();
144144
transaction.setProperty (propertyName, varValue);
145145
}
146146
catch (...)

0 commit comments

Comments
 (0)