1 write to oldTree
Microsoft.AspNetCore.Components.Tests (1)
RenderTreeDiffBuilderTest.cs (1)
21oldTree = new RenderTreeBuilder();
335 references to oldTree
Microsoft.AspNetCore.Components.Tests (335)
RenderTreeDiffBuilderTest.cs (335)
28((IDisposable)oldTree).Dispose(); 38appendFragment(oldTree); 74oldTree.AddContent(0, "text0"); 75oldTree.AddContent(2, "text2"); 97oldTree.AddContent(0, "text0"); 98oldTree.AddContent(1, "text1"); 99oldTree.AddContent(2, "text2"); 115oldTree.OpenElement(0, "container"); 116oldTree.SetKey("retained key"); 117oldTree.AddContent(1, "Existing"); 118oldTree.CloseElement(); 150oldTree.OpenElement(0, "container"); 151oldTree.SetKey("will delete"); 152oldTree.AddContent(1, "First"); 153oldTree.CloseElement(); 155oldTree.OpenElement(0, "container"); 156oldTree.SetKey("will retain"); 157oldTree.AddContent(1, "Second"); 158oldTree.CloseElement(); 180oldTree.OpenElement(0, "container"); 181oldTree.SetKey("original key"); 182oldTree.AddContent(1, "Original"); 183oldTree.CloseElement(); 211oldTree.OpenComponent<CaptureSetParametersComponent>(0); 212oldTree.SetKey("retained key"); 213oldTree.AddComponentParameter(1, "ParamName", "Param old value"); 214oldTree.CloseComponent(); 216GetRenderedBatch(initial, oldTree, false); // Assign initial IDs 217var oldComponent = GetComponents<CaptureSetParametersComponent>(oldTree).Single(); 252oldTree.OpenComponent<FakeComponent>(0); 253oldTree.SetKey("will delete"); 254oldTree.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Anything"); 255oldTree.CloseComponent(); 257oldTree.OpenComponent<FakeComponent>(0); 258oldTree.SetKey("will retain"); 259oldTree.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Retained param value"); 260oldTree.CloseComponent(); 264GetRenderedBatch(initial, oldTree, false); 265var oldComponents = GetComponents(oldTree); 290oldTree.OpenComponent<FakeComponent>(0); 291oldTree.SetKey("will delete"); 292oldTree.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Will delete"); 293oldTree.CloseComponent(); 295oldTree.OpenComponent<FakeComponent>(2); 296oldTree.AddComponentParameter(3, nameof(FakeComponent.StringProperty), "Retained param value"); 297oldTree.CloseComponent(); 301GetRenderedBatch(initial, oldTree, false); 302var oldComponents = GetComponents(oldTree); 322oldTree.OpenComponent<FakeComponent>(1); 323oldTree.CloseComponent(); 327GetRenderedBatch(initial, oldTree, false); 328var oldComponents = GetComponents(oldTree); 351oldTree.OpenComponent<FakeComponent>(0); 352oldTree.SetKey("original key"); 353oldTree.CloseComponent(); 357GetRenderedBatch(renderTreeBuilder, oldTree, false); 358var oldComponent = GetComponents(oldTree).Single(); 389AddWithKey(oldTree, "key1", "attrib1a"); 390AddWithKey(oldTree, "key2", "attrib2"); 391AddWithKey(oldTree, "key1", "attrib3"); 406AddWithKey(oldTree, "key1", "attrib1a"); 407AddWithKey(oldTree, "key2", "attrib2"); 408AddWithKey(oldTree, "key3", "attrib3"); 425AddWithKey(oldTree, "key1", "attrib1a"); 426AddWithKey(oldTree, "key1", "attrib1b"); 444oldTree.OpenElement(1, "el"); 445oldTree.SetKey("some key"); 446oldTree.CloseElement(); 475oldTree.OpenElement(2, "other"); 476oldTree.CloseElement(); 478oldTree.OpenElement(1, "el"); 479oldTree.SetKey("some key"); 480oldTree.CloseElement(); 482oldTree.OpenElement(0, "other 2"); 483oldTree.CloseElement(); 506oldTree.OpenElement(0, "el"); 507oldTree.CloseElement(); 536oldTree.OpenElement(0, "el"); 537oldTree.SetKey("some key"); 538oldTree.CloseElement(); 558oldTree.AddContent(0, "x"); // Loop start 559oldTree.AddContent(1, "x"); // Will be removed 560oldTree.AddContent(2, "x"); // Will be removed 561oldTree.AddContent(0, "x"); // Loop start 578oldTree.AddContent(10, "x"); // Loop start 579oldTree.AddContent(10, "x"); // Loop start 608oldTree.AddContent(0, "x"); 609oldTree.AddContent(1, "x"); 610oldTree.AddContent(0, "x"); // Will be removed 611oldTree.AddContent(1, "x"); // Will be removed 628oldTree.AddContent(10, "x"); 629oldTree.AddContent(11, "x"); 658oldTree.AddContent(12, "x"); 659oldTree.AddContent(12, "x"); // Note that the '0' and '1' items are not present on this iteration 688oldTree.AddContent(2, "x"); 689oldTree.AddContent(0, "x"); 690oldTree.AddContent(1, "x"); 691oldTree.AddContent(2, "x"); 708oldTree.AddContent(0, "text"); 724oldTree.AddContent(123, "old text 1"); 725oldTree.AddContent(182, "old text 2"); 750oldTree.AddMarkupContent(1, "preserved"); 751oldTree.AddMarkupContent(3, "will be updated"); 752oldTree.AddMarkupContent(4, "will be removed"); 788oldTree.OpenElement(123, "old element"); 789oldTree.CloseElement(); 810oldTree.OpenComponent<FakeComponent>(123); 811oldTree.CloseComponent(); 813GetRenderedBatch(initial, oldTree, false); // Assign initial IDs 819var diff = RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, oldTree.GetFrames(), newTree.GetFrames()); 836oldTree.OpenElement(0, "My element"); 837oldTree.AddAttribute(1, "existing", "existing value"); 838oldTree.CloseElement(); 861oldTree.OpenElement(0, "My element"); 862oldTree.AddAttribute(1, "will be removed", "will be removed value"); 863oldTree.AddAttribute(2, "will survive", "surviving value"); 864oldTree.CloseElement(); 885oldTree.OpenElement(0, "My element"); 886oldTree.AddAttribute(1, "will remain", "will remain value"); 887oldTree.AddAttribute(2, "will change", "will change value"); 888oldTree.CloseElement(); 914oldTree.OpenElement(0, "My element"); 915oldTree.AddAttribute(1, "onfoo", retainedHandler); 916oldTree.AddAttribute(2, "onbar", removedHandler); 917oldTree.CloseElement(); 925var removedEventHandlerFrame = oldTree.GetFrames().Array[2]; 945oldTree.OpenElement(0, "My element"); 946oldTree.AddAttribute(1, "oldname", "same value"); 947oldTree.CloseElement(); 974oldTree.OpenElement(0, "My element"); 975oldTree.AddAttribute(0, "attr2", "value2"); 976oldTree.AddAttribute(0, "attr3", "value3"); 977oldTree.CloseElement(); 1004oldTree.OpenElement(0, "My element"); 1005oldTree.AddAttribute(0, "attr1", "value1"); 1006oldTree.AddAttribute(0, "attr3", "value3"); 1007oldTree.CloseElement(); 1035oldTree.OpenElement(0, "My element"); 1036oldTree.AddAttribute(0, "attr1", "value1"); 1037oldTree.AddAttribute(0, "attr2", "value2"); 1038oldTree.CloseElement(); 1066oldTree.OpenElement(0, "My element"); 1067oldTree.AddAttribute(2, "attr2", "value2"); 1068oldTree.AddAttribute(3, "attr3", "value3"); 1069oldTree.CloseElement(); 1096oldTree.OpenElement(0, "My element"); 1097oldTree.AddAttribute(1, "attr1", "value1"); 1098oldTree.AddAttribute(3, "attr3", "value3"); 1099oldTree.CloseElement(); 1127oldTree.OpenElement(0, "My element"); 1128oldTree.AddAttribute(1, "attr1", "value1"); 1129oldTree.AddAttribute(2, "attr2", "value2"); 1130oldTree.CloseElement(); 1158oldTree.OpenElement(0, "My element"); 1159oldTree.AddAttribute(0, "attr1", "value1"); 1160oldTree.AddAttribute(0, "attr2", "value2"); 1161oldTree.AddAttribute(0, "attr3", "value3"); 1162oldTree.CloseElement(); 1185oldTree.OpenElement(0, "My element"); 1186oldTree.AddAttribute(0, "attr1", "value1"); 1187oldTree.AddAttribute(0, "attr2", "value2"); 1188oldTree.AddAttribute(0, "attr3", "value3"); 1189oldTree.CloseElement(); 1212oldTree.OpenElement(0, "My element"); 1213oldTree.AddAttribute(0, "attr1", "value1"); 1214oldTree.AddAttribute(0, "attr2", "value2"); 1215oldTree.AddAttribute(0, "attr3", "value3"); 1216oldTree.CloseElement(); 1239oldTree.OpenElement(0, "My element"); 1240oldTree.AddAttribute(1, "attr1", "value1"); 1241oldTree.AddAttribute(2, "attr2", "value2"); 1242oldTree.AddAttribute(3, "attr3", "value3"); 1243oldTree.CloseElement(); 1266oldTree.OpenElement(0, "My element"); 1267oldTree.AddAttribute(1, "attr1", "value1"); 1268oldTree.AddAttribute(2, "attr2", "value2"); 1269oldTree.AddAttribute(3, "attr3", "value3"); 1270oldTree.CloseElement(); 1293oldTree.OpenElement(0, "My element"); 1294oldTree.AddAttribute(1, "attr1", "value1"); 1295oldTree.AddAttribute(2, "attr2", "value2"); 1296oldTree.AddAttribute(3, "attr3", "value3"); 1297oldTree.CloseElement(); 1320oldTree.AddContent(09, "unrelated"); 1321oldTree.OpenElement(10, "root"); 1322oldTree.OpenElement(11, "child"); 1323oldTree.OpenElement(12, "grandchild"); 1324oldTree.AddContent(13, "grandchild old text"); 1325oldTree.CloseElement(); 1326oldTree.CloseElement(); 1327oldTree.CloseElement(); 1361oldTree.OpenElement(10, "root"); 1362oldTree.AddContent(11, "Text that will change"); 1363oldTree.OpenElement(12, "Subtree that will not change"); 1364oldTree.OpenElement(13, "Another"); 1365oldTree.AddContent(14, "Text that will not change"); 1366oldTree.CloseElement(); 1367oldTree.CloseElement(); 1368oldTree.CloseElement(); 1398oldTree.AddContent(10, "text1"); 1399oldTree.AddContent(11, "text2"); 1400oldTree.AddContent(12, "text3"); 1401oldTree.AddContent(13, "text4"); 1424oldTree.AddContent(0, "Will not change"); 1452oldTree.AddContent(1, "Start"); 1453oldTree.AddContent(3, "End"); 1486oldTree.AddContent(1, "Start"); 1487oldTree.OpenRegion(2); 1488oldTree.AddContent(4, "Text inside region"); // Sequence number is unrelated to outside the region 1489oldTree.OpenRegion(5); 1490oldTree.AddContent(6, "Text inside nested region"); 1491oldTree.CloseRegion(); 1492oldTree.CloseRegion(); 1493oldTree.AddContent(3, "End"); 1510oldTree.AddContent(1, "Start"); 1511oldTree.OpenRegion(2); 1512oldTree.AddContent(4, "Text inside region"); 1513oldTree.AddContent(5, "Text to move"); 1514oldTree.OpenRegion(6); 1515oldTree.CloseRegion(); 1516oldTree.CloseRegion(); 1517oldTree.AddContent(3, "End"); 1551oldTree.AddContent(10, "text1"); // 0: text1 1552oldTree.OpenElement(11, "container"); // 1: <container> 1553oldTree.CloseElement(); // </container> 1613oldTree.AddContent(10, "text1"); // 0: text1 1614oldTree.OpenElement(11, "container"); // 1: <container> 1615oldTree.OpenComponent<FakeComponent>(12); // 2: <FakeComponent> 1616oldTree.CloseComponent(); // </FakeComponent> 1617oldTree.OpenComponent<FakeComponent2>(13); // 3: <FakeComponent2> 1618oldTree.CloseComponent(); // </FakeComponent2> 1619oldTree.CloseElement(); // </container> 1630RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTreeBuilder.GetFrames(), oldTree.GetFrames()); 1631var originalFakeComponentInstance = oldTree.GetFrames().Array[2].Component; 1632var originalFakeComponent2Instance = oldTree.GetFrames().Array[3].Component; 1652oldTree.OpenElement(0, "My element"); 1653oldTree.AddAttribute(1, "ontest", retainedHandler); 1654oldTree.CloseElement(); 1661var oldAttributeFrame = oldTree.GetFrames().Array[1]; 1678oldTree.OpenElement(0, "My element"); 1679oldTree.AddAttribute(0, "ontest", retainedHandler); 1680oldTree.CloseElement(); 1688var oldAttributeFrame = oldTree.GetFrames().Array[1]; 1705oldTree.OpenComponent<FakeComponent>(12); 1706oldTree.AddComponentParameter(13, nameof(FakeComponent.StringProperty), "String will change"); 1707oldTree.AddComponentParameter(14, nameof(FakeComponent.ObjectProperty), objectWillNotChange); 1708oldTree.CloseComponent(); 1716RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTree.GetFrames(), oldTree.GetFrames()); 1717var originalComponentInstance = (FakeComponent)oldTree.GetFrames().Array[0].Component; 1721var newComponentInstance = (FakeComponent)oldTree.GetFrames().Array[0].Component; 1742foreach (var tree in new[] { oldTree, newTree }) 1771RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTreeBuilder.GetFrames(), oldTree.GetFrames()); 1772var originalComponentInstance = (CaptureSetParametersComponent)oldTree.GetFrames().Array[0].Component; 1777var newComponentInstance = (CaptureSetParametersComponent)oldTree.GetFrames().Array[0].Component; 1792foreach (var tree in new[] { oldTree, newTree }) 1801RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTreeBuilder.GetFrames(), oldTree.GetFrames()); 1802var componentInstance = (CaptureSetParametersComponent)oldTree.GetFrames().Array[0].Component; 1816oldTree.OpenComponent<DisposableComponent>(10); // <DisposableComponent> 1817oldTree.CloseComponent(); // </DisposableComponent> 1818oldTree.OpenComponent<NonDisposableComponent>(20); // <NonDisposableComponent> 1819oldTree.CloseComponent(); // </NonDisposableComponent> 1820oldTree.OpenComponent<DisposableComponent>(30); // <DisposableComponent> 1821oldTree.CloseComponent(); // </DisposableComponent> 1827RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, renderTree.GetFrames(), oldTree.GetFrames()); 1833RenderTreeDiffBuilder.ComputeDiff(renderer, batchBuilder, 0, oldTree.GetFrames(), newTree.GetFrames()); 1884oldTree.OpenElement(0, "My element"); 1885oldTree.AddElementReferenceCapture(1, capture1); 1886oldTree.CloseElement(); 1950oldTree.OpenComponent<FakeComponent>(0); 1951oldTree.AddComponentReferenceCapture(1, assigner); 1952oldTree.CloseComponent(); 1972oldTree.OpenElement(0, "container"); 1973oldTree.SetKey("first key"); 1974oldTree.AddContent(1, "First"); 1975oldTree.CloseElement(); 1977oldTree.AddContent(2, "Unkeyed item"); 1979oldTree.OpenElement(0, "container"); 1980oldTree.SetKey("second key"); 1981oldTree.AddContent(1, "Second"); 1982oldTree.CloseElement(); 2024oldTree.OpenComponent<CaptureSetParametersComponent>(0); 2025oldTree.SetKey("first key"); 2026oldTree.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "First param"); 2027oldTree.CloseComponent(); 2029oldTree.AddContent(2, "Unkeyed item"); 2031oldTree.OpenComponent<CaptureSetParametersComponent>(0); 2032oldTree.SetKey("second key"); 2033oldTree.AddComponentParameter(1, nameof(FakeComponent.StringProperty), "Second param"); 2034oldTree.CloseComponent(); 2037GetRenderedBatch(renderTreeBuilder, oldTree, false); // Assign initial IDs 2038var oldComponents = GetComponents<CaptureSetParametersComponent>(oldTree); 2078AddWithKey(oldTree, "will retain"); 2079AddWithKey(oldTree, "will move"); 2105AddWithKey(oldTree, "will retain"); 2106AddWithKey(oldTree, "will delete"); 2107AddWithKey(oldTree, "will move"); 2127AddWithKey(oldTree, "will move"); 2128AddWithKey(oldTree, "will retain"); 2154AddWithKey(oldTree, "will move"); 2155AddWithKey(oldTree, "will delete"); 2156AddWithKey(oldTree, "will retain"); 2175oldTree.OpenElement(0, "some elem"); 2176oldTree.AddContent(1, "Hello!"); 2177oldTree.CloseElement(); 2198oldTree.OpenComponent<FakeComponent>(0); 2199oldTree.CloseComponent(); 2222oldTree.OpenElement(0, "existing"); 2223oldTree.AddAttribute(1, "attr1", "unrelated val1"); 2224oldTree.CloseElement(); 2253oldTree.OpenElement(0, "retaining"); 2254oldTree.AddAttribute(1, "attr1", "unrelated val1"); 2255oldTree.AddNamedEvent("someevent1", "removing from retained element"); 2256oldTree.CloseElement(); 2257oldTree.OpenElement(2, "removing"); 2258oldTree.AddNamedEvent("someevent2", "removed because element was removed"); 2259oldTree.CloseElement(); 2279oldTree.OpenElement(0, "elem"); 2280oldTree.AddNamedEvent("eventname", "assigned name"); 2281oldTree.CloseElement(); 2307oldTree.OpenElement(0, "elem"); 2308oldTree.AddNamedEvent("eventname1", "original name"); 2309oldTree.AddNamedEvent("eventname2", "will be left unchanged"); 2310oldTree.CloseElement(); 2333oldTree.OpenElement(0, "elem"); 2334for (var i = 0; oldTree.GetFrames().Count < oldTree.GetFrames().Array.Length; i++) 2336oldTree.AddAttribute(1, $"myattribute_{i}", "value"); 2348oldTree.CloseElement(); 2366oldTree.OpenElement(0, "elem"); 2367for (var i = 0; oldTree.GetFrames().Count < oldTree.GetFrames().Array.Length; i++) 2369oldTree.AddAttribute(1, $"myattribute_{i}", "value"); 2378oldTree.AddAttribute(1, $"myattribute_final", "value"); 2381oldTree.CloseElement(); 2409=> GetRenderedBatch(oldTree, newTree, initializeFromFrames, componentId);