mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Run SwiftFormat.
This commit is contained in:
@@ -11,7 +11,7 @@ import Testing
|
||||
|
||||
struct NSItemProviderTests {
|
||||
// MARK: - hasPathExtension
|
||||
|
||||
|
||||
@Test
|
||||
func hasPathExtensionRecognisesRegisteredExtensions() {
|
||||
#expect(("IMG_1234.jpg" as NSString).hasPathExtension)
|
||||
@@ -19,7 +19,7 @@ struct NSItemProviderTests {
|
||||
#expect(("clip.heic" as NSString).hasPathExtension)
|
||||
#expect(("doc.pdf" as NSString).hasPathExtension)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
func hasPathExtensionRejectsDateLikeTrailingSegments() {
|
||||
// iOS screenshot drags expose a `suggestedName` like
|
||||
@@ -30,38 +30,38 @@ struct NSItemProviderTests {
|
||||
#expect(!("report 2025.10" as NSString).hasPathExtension)
|
||||
#expect(!("v1.2.3" as NSString).hasPathExtension)
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
func hasPathExtensionRejectsAbsentExtension() {
|
||||
#expect(!("plainname" as NSString).hasPathExtension)
|
||||
#expect(!("" as NSString).hasPathExtension)
|
||||
#expect(!("trailing dot." as NSString).hasPathExtension)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - storeData()
|
||||
|
||||
|
||||
@Test
|
||||
func storeDataAppendsExtensionWhenSuggestedNameLooksLikeAScreenshot() async throws {
|
||||
let imageURL = try #require(Bundle(for: BundleAnchor.self).url(forResource: "test_image.png", withExtension: nil),
|
||||
"Failed retrieving fixture")
|
||||
let provider = try #require(NSItemProvider(contentsOf: imageURL))
|
||||
provider.suggestedName = "Screenshot 2026-05-22 at 14.49.40"
|
||||
|
||||
|
||||
let storedURL = try #require(await provider.storeData())
|
||||
|
||||
|
||||
#expect(storedURL.pathExtension == "png")
|
||||
#expect(storedURL.deletingPathExtension().lastPathComponent == "Screenshot 2026-05-22 at 14.49.40")
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
func storeDataPreservesSuggestedNameWithRealExtension() async throws {
|
||||
let imageURL = try #require(Bundle(for: BundleAnchor.self).url(forResource: "test_image.png", withExtension: nil),
|
||||
"Failed retrieving fixture")
|
||||
let provider = try #require(NSItemProvider(contentsOf: imageURL))
|
||||
provider.suggestedName = "IMG_1234.png"
|
||||
|
||||
|
||||
let storedURL = try #require(await provider.storeData())
|
||||
|
||||
|
||||
#expect(storedURL.lastPathComponent == "IMG_1234.png")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user