-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from ASML-Labs/enable_hyperlinks
Enable hyperlinks feature by @xvries
- Loading branch information
Showing
8 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
@testset "Test Hyperlinks" begin | ||
pres = Presentation() | ||
s2 = Slide() | ||
s3 = Slide() | ||
|
||
box = TextBox(content = "Hyperlinked text", hlink = s3) | ||
|
||
@testset "has hyperlink" begin | ||
@test PPTX.has_hyperlink(box) | ||
box_nolink = TextBox(content = "Hyperlinked text") | ||
@test !PPTX.has_hyperlink(box_nolink) | ||
end | ||
|
||
@testset "hyperlink xml" begin | ||
xml = PPTX.hlink_xml(box.hlink) | ||
@test xml["a:hlinkClick"]["rId"] == "rId$(PPTX.rid(s3))" | ||
end | ||
|
||
push!(s2, box) | ||
push!(pres, s2) | ||
push!(pres, s3) | ||
|
||
@testset "hyperlink xml after rid update" begin | ||
# After updating the rId of s2 the hyperlink xml should also be updated | ||
xml = PPTX.hlink_xml(box.hlink) | ||
@test xml["a:hlinkClick"]["rId"] == "rId$(PPTX.rid(s3))" | ||
end | ||
|
||
# I malificently swap slides which should not affect hyperlinking | ||
pres.slides[2] = s3 | ||
pres.slides[3] = s2 | ||
|
||
@testset "update slide nrs" begin | ||
PPTX.update_slide_nrs!(pres) | ||
@test pres.slides[2].slide_nr == 2 | ||
@test pres.slides[3].slide_nr == 3 | ||
xml_rels = PPTX.relationship_xml(box.hlink) | ||
# Chech that rId is still the same | ||
@test xml_rels["Relationship"][1]["Id"] == "rId$(PPTX.rid(s3))" | ||
@test xml_rels["Relationship"][3]["Target"] == "slide$(PPTX.slide_nr(s3)).xml" | ||
end | ||
|
||
end |