21 Commits

Author SHA1 Message Date
Scott Goodson
8308a4ce49 [AsyncDisplayKit] Adopt #pragma once, remove last remaining dispatch_sync (UIScreen scale). 2016-03-19 19:56:41 -07:00
Adlai Holler
7bbe401727 Workaround deadlock when running table view tests in isolation 2016-02-20 15:40:47 -08:00
Rahul Malik
c4f489b074 Address comments. 2016-02-04 16:56:29 -08:00
Rahul Malik
521c3fa1c1 Move ASCellNode allocation off the main thread by the addition of a node block
API in ASDataController. Move allocations and loaded node layouts to occur
during batch layout phase.
2016-02-04 10:38:59 -08:00
Scott Goodson
44feece701 Implement node-backing for ASTableView and ASCollectionView, with a strong back-pointer in these cases. 2015-12-26 23:05:34 -08:00
Scott Goodson
7ece41ff64 Delegate definition tweaks for Table and Collection; ensure Table tests run with ARC enabled. 2015-12-24 21:41:12 -08:00
Huy Nguyen
72fca5395f Inject an ASDataController class to ASTableView, for testing purposes
- Injection can be done via a new internal initializer. The class will be used by ASTableView to create (and configure) a new data controller.
- ASTableViewTests now injects its own type of ASDataController. This facilitates new ways for testing ASTableView-specific behaviours. The first application is counting the number of times relayoutAllNodes is called on the data controller.
2015-10-26 13:52:49 +02:00
Huy Nguyen
048566aed5 Fix unstable tests related to relayoutAllNodes in ASTableViewTests
- After node constrained sizes were changed (because the table view width was changed, for example) and before relayoutAllNodes is executed (on main), if there is any layout tasks being executed on background, the new sizes will be used immediately. Therefore, by the time relayoutAllNodes is performed, some nodes already have an up-to-date layout and don't need to remeasure.
- As a result, after relayoutAllNodes is completed, the number of layout passes performed on main thread for each node increased between 0 and 1 (i.e some nodes were remeasured, others weren't). ASTableViewTests is updated to assert this behaviour.
2015-10-26 13:47:08 +02:00
Huy Nguyen
7b71462763 Refactor ASTableViewTests
- Add -triggerFirstLayoutMeasurementForTableView:
- Move -triggerSizeChangeAndAssertRelayoutAllRowsForTableView:newSize to the end of the file.
2015-10-25 18:54:39 +02:00
Steven Ramkumar
d09888f9c2 Add a indexPathForNode: to ASTableView 2015-09-22 12:09:56 -07:00
Huy Nguyen
dfbaa35706 Disable an unstable test in ASTableViewTests. 2015-09-16 23:04:18 +03:00
Huy Nguyen
2d575fcafc Relayout table view cell nodes if there is a mismatch between content view size and the node's constrained size
- Above is the generic case. Correctly handling it means relayout when the table view enters or leaves editing mode is solved as well.
- Async data source API removal: In a table view, cell nodes should always fill its content view and table view widths. Thus async data source can no longer provide custom constrained size for cell nodes. This removal allows table view to better handle relayout.
- Some more tests are added to ASTableViewTests to check against use cases handled in this diff.
2015-09-16 11:41:34 +03:00
Huy Nguyen
6383b69029 Update ASTableViewTests to detect the case when relayout is trigger during initial configuration. 2015-09-08 22:43:25 +03:00
Huy Nguyen
3e5d5c44cb Test relayout caused by a different constrained size for each and every node. All nodes, including loading ones, must be re-measured. 2015-08-21 00:59:21 +03:00
Ethan Nagel
3da7305abb Wait to begin thrashing until we have completed reloading the data so we aren't trying to do both operations concurrently. 2015-07-15 16:31:01 -07:00
Ethan Nagel
8c72118e69 Don't abuse the CI servers so much. Note - With this configuration we will often pass with a known race issue we currently have. Making ASTableViewStressTest more interesting so we can reliably reproduce the issue there. 2015-07-15 10:19:03 -07:00
Ethan Nagel
f010b0f3e3 Update ASTableView test to be more random and more rigorous. 2015-07-13 14:34:10 -07:00
Scott Goodson
57465c7fd3 Overhaul ASDataController and extensively test ASTableView.
This diff resolves all known consistency issues with ASTableView and ASCollectionView.
It includes significantly more aggressive thrash-testing in ASTableViewStressTest,
which now passes on a variety of device and simulator configurations.  It also updates
the unit tests run on every commit to ensure any regression is caught quickly.

A few of the salient changes in this diff:
- ASTableView now uses Rene's ASCollectionViewLayoutController, and actually uses a
UICollectionViewFlowLayout without any UICollectionView.  This resolves an issue where
ASFlowLayoutController was generating slightly out-of-bounds indicies when programmatically
scrolling past the end of the table content.  Because the custom implementation is likely
faster, I will revisit this later with profiling and possibly returning to the custom impl.
- There is now a second copy of the _nodes array maintained by ASDataController.  It shares
the same node instances, but this does add some overhead to manipulating the arrays. I've
filed a task to follow up with optimization, as there are several great opportunities to
make it faster.  However, I don't believe the overhead is a significant issue, and it does
guarantee correctness in even the toughest app usage scenarios.
- ASDataController no longer supports calling its delegate /before/ edit operations.  No
other class was relying on this behavior, and it would be unusual for an app developer to
use ASDataController directly.  However, it is possible that someone with a custom view
that integrates with ASDataController and ASRangeController could be affected by this.
- Further cleanup of organization, naming, additional comments, reduced code length
wherever possible.  Overall, significantly more accessible to a new reader.
2015-06-28 18:03:45 -07:00
Scott Goodson
c700618862 Improvements to thread safety during closely spaced edit events.
This applies primarily when beginUpdates / endUpdates is not used.
Due to user interaction-driven edits, like reloads or adding content
at the bottom, sometimes this is unavoidable in app design and thus
critical.

I have a diff in flight to make ASDataController / ASRangeController
robust against very aggressive thrash testing, which will be added
both to the unit test suite and this new example project.
2015-06-21 21:04:09 -07:00
Nadine Salter
ad3f3b5fdc Disable flakey test. 2015-03-23 15:59:29 -07:00
Ian Cloutier
41c3289a11 Fix retain cycles in ASDisplayNode and ASTableView 2014-10-09 19:00:38 -04:00