File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
Mixin/UserInterface/Controllers/Chat/Model Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -20,10 +20,10 @@ enum PhotoSizeCalculator {
20
20
if contentRatio > 1 {
21
21
if contentRatio > Height . max / Width. max {
22
22
height = Height . max
23
- width = round ( height / contentRatio)
23
+ width = max ( Width . min , round ( height / contentRatio) )
24
24
} else {
25
25
width = Width . max
26
- height = round ( width * contentRatio)
26
+ height = min ( Height . max , round ( width * contentRatio) )
27
27
}
28
28
} else {
29
29
width = Width . max
Original file line number Diff line number Diff line change @@ -36,20 +36,20 @@ class PhotoDisplayTests: XCTestCase {
36
36
let expected = [
37
37
// Bad input
38
38
CGSize ( width: 120 , height: 120 ) ,
39
-
39
+
40
40
// General photos
41
41
CGSize ( width: 210 , height: 280 ) ,
42
42
CGSize ( width: 210 , height: 158 ) ,
43
43
44
44
// Panoramas
45
45
CGSize ( width: 210 , height: 120 ) ,
46
- CGSize ( width: 97 , height: 280 ) ,
46
+ CGSize ( width: 120 , height: 280 ) ,
47
47
48
48
// Article
49
- CGSize ( width: 8 , height: 280 ) ,
49
+ CGSize ( width: 120 , height: 280 ) ,
50
50
51
51
// Irregular shapes
52
- CGSize ( width: 112 , height: 280 ) ,
52
+ CGSize ( width: 120 , height: 280 ) ,
53
53
CGSize ( width: 120 , height: 280 ) ,
54
54
CGSize ( width: 120 , height: 280 ) ,
55
55
You can’t perform that action at this time.
0 commit comments