Skip to content

Commit 1f59afa

Browse files
authored
Downgrade to jsoup 1.16.1 (#489)
1 parent a561e89 commit 1f59afa

File tree

2 files changed

+19
-15
lines changed

2 files changed

+19
-15
lines changed

gradle/libs.versions.toml

+5-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@ google-exoplayer = "2.19.1"
4646
google-material = "1.11.0"
4747

4848
joda-time = "2.12.6"
49-
jsoup = "1.17.2"
49+
# Jsoup 1.16.2 requires core library desugaring, otherwise it crashes on Android 7 devices when
50+
# opening the EPUB navigator.
51+
# Before enabling desugaring, we need to assess its impact on the toolkit.
52+
# See https://github.com/jhy/jsoup/issues/2022#issuecomment-1783931119
53+
jsoup = "1.16.1"
5054
junit = "4.13.2"
5155

5256
kotlinx-coroutines = "1.7.3"

readium/shared/src/test/java/org/readium/r2/shared/publication/services/content/iterators/HtmlResourceContentIteratorTest.kt

+14-14
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class HtmlResourceContentIteratorTest {
5454
TextElement(
5555
locator = locator(
5656
progression = 0.0,
57-
selector = "html > body > section > div.center",
57+
selector = "#pgepubid00498 > div.center",
5858
before = null,
5959
highlight = "171"
6060
),
@@ -63,7 +63,7 @@ class HtmlResourceContentIteratorTest {
6363
Segment(
6464
locator = locator(
6565
progression = 0.0,
66-
selector = "html > body > section > div.center",
66+
selector = "#pgepubid00498 > div.center",
6767
before = null,
6868
highlight = "171"
6969
),
@@ -75,7 +75,7 @@ class HtmlResourceContentIteratorTest {
7575
TextElement(
7676
locator = locator(
7777
progression = 0.2,
78-
selector = "html > body > section > h3",
78+
selector = "#pgepubid00498 > h3",
7979
before = "171",
8080
highlight = "INTRODUCTORY"
8181
),
@@ -84,7 +84,7 @@ class HtmlResourceContentIteratorTest {
8484
Segment(
8585
locator = locator(
8686
progression = 0.2,
87-
selector = "html > body > section > h3",
87+
selector = "#pgepubid00498 > h3",
8888
before = "171",
8989
highlight = "INTRODUCTORY"
9090
),
@@ -96,7 +96,7 @@ class HtmlResourceContentIteratorTest {
9696
TextElement(
9797
locator = locator(
9898
progression = 0.4,
99-
selector = "html > body > section > p:nth-child(3)",
99+
selector = "#pgepubid00498 > p:nth-child(3)",
100100
before = "171INTRODUCTORY",
101101
highlight = "The difficulties of classification are very apparent here, and once more it must be noted that illustrative and practical purposes rather than logical ones are served by the arrangement adopted. The modern fanciful story is here placed next to the real folk story instead of after all the groups of folk products. The Hebrew stories at the beginning belong quite as well, perhaps even better, in Section V, while the stories at the end of Section VI shade off into the more modern types of short tales."
102102
),
@@ -105,7 +105,7 @@ class HtmlResourceContentIteratorTest {
105105
Segment(
106106
locator = locator(
107107
progression = 0.4,
108-
selector = "html > body > section > p:nth-child(3)",
108+
selector = "#pgepubid00498 > p:nth-child(3)",
109109
before = "171INTRODUCTORY",
110110
highlight = "The difficulties of classification are very apparent here, and once more it must be noted that illustrative and practical purposes rather than logical ones are served by the arrangement adopted. The modern fanciful story is here placed next to the real folk story instead of after all the groups of folk products. The Hebrew stories at the beginning belong quite as well, perhaps even better, in Section V, while the stories at the end of Section VI shade off into the more modern types of short tales."
111111
),
@@ -117,7 +117,7 @@ class HtmlResourceContentIteratorTest {
117117
TextElement(
118118
locator = locator(
119119
progression = 0.6,
120-
selector = "html > body > section > p:nth-child(4)",
120+
selector = "#pgepubid00498 > p:nth-child(4)",
121121
before = "ade off into the more modern types of short tales.",
122122
highlight = "The child's natural literature. The world has lost certain secrets as the price of an advancing civilization."
123123
),
@@ -126,7 +126,7 @@ class HtmlResourceContentIteratorTest {
126126
Segment(
127127
locator = locator(
128128
progression = 0.6,
129-
selector = "html > body > section > p:nth-child(4)",
129+
selector = "#pgepubid00498 > p:nth-child(4)",
130130
before = "ade off into the more modern types of short tales.",
131131
highlight = "The child's natural literature. The world has lost certain secrets as the price of an advancing civilization."
132132
),
@@ -138,7 +138,7 @@ class HtmlResourceContentIteratorTest {
138138
TextElement(
139139
locator = locator(
140140
progression = 0.8,
141-
selector = "html > body > section > p:nth-child(5)",
141+
selector = "#pgepubid00498 > p:nth-child(5)",
142142
before = "secrets as the price of an advancing civilization.",
143143
highlight = "Without discussing the limits of the culture-epoch theory of human development as a complete guide in education, it is clear that the young child passes through a period when his mind looks out upon the world in a manner analogous to that of the folk as expressed in their literature."
144144
),
@@ -147,7 +147,7 @@ class HtmlResourceContentIteratorTest {
147147
Segment(
148148
locator = locator(
149149
progression = 0.8,
150-
selector = "html > body > section > p:nth-child(5)",
150+
selector = "#pgepubid00498 > p:nth-child(5)",
151151
before = "secrets as the price of an advancing civilization.",
152152
highlight = "Without discussing the limits of the culture-epoch theory of human development as a complete guide in education, it is clear that the young child passes through a period when his mind looks out upon the world in a manner analogous to that of the folk as expressed in their literature."
153153
),
@@ -271,13 +271,13 @@ class HtmlResourceContentIteratorTest {
271271

272272
@Test
273273
fun `starting from a CSS selector`() = runTest {
274-
val iter = iterator(html, locator(selector = "html > body > section > p:nth-child(3)"))
274+
val iter = iterator(html, locator(selector = "#pgepubid00498 > p:nth-child(3)"))
275275
assertEquals(elements.subList(2, elements.size), iter.elements())
276276
}
277277

278278
@Test
279279
fun `calling previous() when starting from a CSS selector`() = runTest {
280-
val iter = iterator(html, locator(selector = "html > body > section > p:nth-child(3)"))
280+
val iter = iterator(html, locator(selector = "#pgepubid00498 > p:nth-child(3)"))
281281
assertTrue(iter.hasPrevious())
282282
assertEquals(elements[1], iter.previous())
283283
}
@@ -557,7 +557,7 @@ class HtmlResourceContentIteratorTest {
557557
TextElement(
558558
locator = locator(
559559
progression = 2 / 3.0,
560-
selector = "html > body > ol.decimal > li > aside",
560+
selector = "#c06-li-0001 > aside",
561561
before = "e just described is very much a waterfall process.\n \n ",
562562
highlight = "Trailing text"
563563
),
@@ -566,7 +566,7 @@ class HtmlResourceContentIteratorTest {
566566
Segment(
567567
locator = locator(
568568
progression = 2 / 3.0,
569-
selector = "html > body > ol.decimal > li > aside",
569+
selector = "#c06-li-0001 > aside",
570570
before = "e just described is very much a waterfall process.\n ",
571571
highlight = "Trailing text"
572572
),

0 commit comments

Comments
 (0)