Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Commit 7ee1d92

Browse files
authored
Merge pull request #29 from iZettle/feature/bump_dependencies
Bump dependencies
2 parents bb9b6df + 84ee722 commit 7ee1d92

File tree

8 files changed

+56
-38
lines changed

8 files changed

+56
-38
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Height will be calculated using WebView.getContentHeight()
1111
### Usage:
1212
```
1313
dependencies {
14-
implementation 'com.izettle:html2bitmap:1.6'
14+
implementation 'com.izettle:html2bitmap:1.9'
1515
}
1616
```
1717

Diff for: build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
jcenter()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.2.1'
10+
classpath 'com.android.tools.build:gradle:3.3.1'
1111

1212
}
1313
}

Diff for: html2bitmap/build.gradle

+6-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ android {
1818
}
1919

2020
dependencies {
21-
implementation 'androidx.annotation:annotation:1.0.0'
22-
testImplementation 'junit:junit:4.12'
23-
androidTestImplementation 'androidx.test:runner:1.1.0-beta02'
24-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-beta02'
21+
implementation 'androidx.annotation:annotation:1.0.2'
22+
testImplementation 'androidx.test.ext:junit:1.1.1-alpha01'
23+
androidTestImplementation 'androidx.test.ext:junit:1.1.1-alpha01'
24+
androidTestImplementation 'androidx.test:core:1.1.1-alpha01'
25+
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
26+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
2527
}
2628

2729
apply from: rootProject.file('gradle/gradle-mvn-push.gradle')

Diff for: html2bitmap/src/androidTest/java/com/izettle/html2bitmaptest/TestBitmapCSS.java

+11-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.izettle.html2bitmap.R;
88
import com.izettle.html2bitmap.content.WebViewContent;
99

10+
import org.junit.Before;
1011
import org.junit.Test;
1112
import org.junit.runner.RunWith;
1213

@@ -15,8 +16,8 @@
1516
import java.io.InputStream;
1617
import java.io.InputStreamReader;
1718

18-
import androidx.test.InstrumentationRegistry;
19-
import androidx.test.runner.AndroidJUnit4;
19+
import androidx.test.core.app.ApplicationProvider;
20+
import androidx.test.ext.junit.runners.AndroidJUnit4;
2021

2122
import static org.hamcrest.MatcherAssert.assertThat;
2223
import static org.hamcrest.Matchers.allOf;
@@ -27,11 +28,16 @@
2728

2829
@RunWith(AndroidJUnit4.class)
2930
public class TestBitmapCSS {
31+
private Context appContext;
32+
33+
@Before
34+
public void setUp() {
35+
appContext = ApplicationProvider.getApplicationContext();
36+
}
37+
3038
@Test
3139
public void testBitmap() throws Exception {
32-
Context appContext = InstrumentationRegistry.getTargetContext();
33-
34-
InputStream inputStream = InstrumentationRegistry.getContext().getResources().openRawResource(R.raw.csstest);
40+
InputStream inputStream = appContext.getResources().openRawResource(R.raw.csstest);
3541

3642
String html = stringFromStream(inputStream);
3743

Diff for: html2bitmap/src/androidTest/java/com/izettle/html2bitmaptest/TestBitmapSize.java

+11-10
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
import com.izettle.html2bitmap.Html2Bitmap;
77
import com.izettle.html2bitmap.content.WebViewContent;
88

9+
import org.junit.Before;
910
import org.junit.Test;
1011
import org.junit.runner.RunWith;
1112

12-
import androidx.test.InstrumentationRegistry;
13-
import androidx.test.runner.AndroidJUnit4;
13+
import androidx.test.core.app.ApplicationProvider;
14+
import androidx.test.ext.junit.runners.AndroidJUnit4;
1415

1516
import static org.hamcrest.MatcherAssert.assertThat;
1617
import static org.hamcrest.Matchers.allOf;
@@ -22,9 +23,15 @@
2223
@RunWith(AndroidJUnit4.class)
2324
public class TestBitmapSize {
2425

26+
private Context appContext;
27+
28+
@Before
29+
public void setUp() {
30+
appContext = ApplicationProvider.getApplicationContext();
31+
}
32+
2533
@Test
2634
public void testBitmap() {
27-
Context appContext = InstrumentationRegistry.getTargetContext();
2835

2936
Bitmap bitmap = new Html2Bitmap.Builder()
3037
.setContext(appContext)
@@ -41,8 +48,6 @@ public void testBitmap() {
4148

4249
@Test
4350
public void testWideBitmap() {
44-
Context appContext = InstrumentationRegistry.getTargetContext();
45-
4651
Bitmap bitmap = new Html2Bitmap.Builder()
4752
.setContext(appContext)
4853
.setContent(WebViewContent.html("<html><body><h1>Hello world</h1><p>foo <strong>bar</strong></p></body</html>"))
@@ -56,8 +61,6 @@ public void testWideBitmap() {
5661

5762
@Test
5863
public void testLongBitmap() {
59-
Context appContext = InstrumentationRegistry.getTargetContext();
60-
6164
StringBuilder sb = new StringBuilder();
6265
for (int i = 0; i < 20; i++) {
6366
sb.append("<p>i</p>");
@@ -76,8 +79,6 @@ public void testLongBitmap() {
7679

7780
@Test
7881
public void testExtraLongBitmap() {
79-
Context appContext = InstrumentationRegistry.getTargetContext();
80-
8182
StringBuilder sb = new StringBuilder();
8283
for (int i = 0; i < 500; i++) {
8384
sb.append("<p>i</p>");
@@ -93,6 +94,6 @@ public void testExtraLongBitmap() {
9394
assertNotNull(bitmap);
9495
assertEquals(100, bitmap.getWidth());
9596

96-
assertThat(bitmap.getHeight(), allOf(greaterThan(17600), lessThan(18200)));
97+
assertThat(bitmap.getHeight(), allOf(greaterThan(17400), lessThan(18200)));
9798
}
9899
}

Diff for: html2bitmap/src/androidTest/java/com/izettle/html2bitmaptest/TestLoadRelativeLocalFiles.java

+14-11
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.izettle.html2bitmap.content.WebViewContent;
1010
import com.izettle.html2bitmap.content.WebViewResource;
1111

12+
import org.junit.Before;
1213
import org.junit.Test;
1314
import org.junit.runner.RunWith;
1415

@@ -18,18 +19,24 @@
1819
import java.io.InputStreamReader;
1920
import java.util.List;
2021

21-
import androidx.test.InstrumentationRegistry;
22-
import androidx.test.runner.AndroidJUnit4;
22+
import androidx.test.core.app.ApplicationProvider;
23+
import androidx.test.ext.junit.runners.AndroidJUnit4;
2324

2425
import static org.junit.Assert.assertEquals;
2526
import static org.junit.Assert.assertNotNull;
2627

2728
@RunWith(AndroidJUnit4.class)
2829
public class TestLoadRelativeLocalFiles {
30+
31+
private Context appContext;
32+
33+
@Before
34+
public void setUp() {
35+
appContext = ApplicationProvider.getApplicationContext();
36+
}
37+
2938
@Test
3039
public void testLoadRelativeImage() {
31-
Context appContext = InstrumentationRegistry.getTargetContext();
32-
3340
Html2Bitmap html2Bitmap = new Html2Bitmap.Builder()
3441
.setContext(appContext)
3542
.setContent(WebViewContent.html("<html><body><h1>Hello world</h1><img src='faces_200_400.png'></body</html>"))
@@ -47,9 +54,7 @@ public void testLoadRelativeImage() {
4754

4855
@Test
4956
public void testLoadRemoteFontFilesFromGoogle() throws IOException {
50-
Context appContext = InstrumentationRegistry.getTargetContext();
51-
52-
InputStream inputStream = InstrumentationRegistry.getContext().getResources().openRawResource(R.raw.remotefonttest);
57+
InputStream inputStream = appContext.getResources().openRawResource(R.raw.remotefonttest);
5358

5459
String html = stringFromStream(inputStream);
5560

@@ -65,14 +70,12 @@ public void testLoadRemoteFontFilesFromGoogle() throws IOException {
6570

6671
assertEquals(3, webViewResources.size());
6772
assertEquals(Uri.parse("https://fonts.googleapis.com/css?family=Hanalei+Fill"), webViewResources.get(1).getUri());
68-
assertEquals(Uri.parse("https://fonts.gstatic.com/s/hanaleifill/v6/fC1mPYtObGbfyQznIaQzPQi8UAjFhFqtag.ttf"), webViewResources.get(2).getUri());
73+
assertEquals(Uri.parse("https://fonts.gstatic.com/s/hanaleifill/v7/fC1mPYtObGbfyQznIaQzPQi8UAjFhFqtag.ttf"), webViewResources.get(2).getUri());
6974
}
7075

7176
@Test
7277
public void testLoadLocalFontFiles() throws IOException {
73-
Context appContext = InstrumentationRegistry.getTargetContext();
74-
75-
InputStream inputStream = InstrumentationRegistry.getContext().getResources().openRawResource(R.raw.localfonttest);
78+
InputStream inputStream = appContext.getResources().openRawResource(R.raw.localfonttest);
7679

7780
String html = stringFromStream(inputStream);
7881

Diff for: html2bitmap/src/androidTest/java/com/izettle/html2bitmaptest/TestRemote.java

+10-4
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,29 @@
66
import com.izettle.html2bitmap.Html2Bitmap;
77
import com.izettle.html2bitmap.content.WebViewContent;
88

9+
import org.junit.Before;
910
import org.junit.Test;
1011
import org.junit.runner.RunWith;
1112

1213
import java.net.URL;
1314

14-
import androidx.test.InstrumentationRegistry;
15-
import androidx.test.runner.AndroidJUnit4;
15+
import androidx.test.core.app.ApplicationProvider;
16+
import androidx.test.ext.junit.runners.AndroidJUnit4;
1617

1718
import static org.junit.Assert.assertNotNull;
1819

1920
@RunWith(AndroidJUnit4.class)
2021
public class TestRemote {
2122

23+
private Context appContext;
24+
25+
@Before
26+
public void setUp() {
27+
appContext = ApplicationProvider.getApplicationContext();
28+
}
29+
2230
@Test
2331
public void restRemote() throws Exception {
24-
Context appContext = InstrumentationRegistry.getTargetContext();
25-
2632
String url = "https://raw.githubusercontent.com/iZettle/android-html2bitmap/develop/html2bitmap/src/debug/res/raw/simple.html";
2733
Html2Bitmap html2Bitmap = new Html2Bitmap.Builder(appContext, WebViewContent.url(new URL(url)))
2834
.setTimeout(5)

Diff for: html2bitmapdemo/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ dependencies {
2626
//implementation 'com.izettle:html2bitmap:1.8'
2727
implementation project(":html2bitmap")
2828

29-
implementation 'androidx.appcompat:appcompat:1.0.0'
30-
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
29+
implementation 'androidx.appcompat:appcompat:1.0.2'
30+
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
3131
}

0 commit comments

Comments
 (0)